4 #include "ExchangeToolkit.h" 33 A3DVector3dData result;
34 A3D_INITIALIZE_DATA( A3DVector3dData, result );
51 static inline ts3d::MatrixType getMatrixFromCartesian( A3DMiscCartesianTransformation *xform ) {
53 auto const mirror = (d->m_ucBehaviour & kA3DTransformationMirror) ? -1. : 1.;
58 auto const z = x.cross3( y ) * mirror;
61 for(
auto idx = 0u; idx < 4u; idx++) {
62 result( idx, 0 ) = x( idx ) * s( 0 );
63 result( idx, 1 ) = y( idx ) * s( 1 );
64 result( idx, 2 ) = z( idx ) * s( 2 );
65 result( idx, 3 ) = o( idx );
71 static inline ts3d::MatrixType getMatrixFromGeneralTransformation( A3DMiscGeneralTransformation *xform ) {
74 auto const coeff = d->m_adCoeff;
76 for(
auto idx = 0u; idx < 16; ++idx) {
77 result( idx ) = coeff[idx];
92 if(
nullptr == xform) {
93 return ts3d::MatrixType::Identity();
96 auto t = kA3DTypeUnknown;
97 A3DEntityGetType( xform, &t );
100 case kA3DTypeMiscCartesianTransformation:
101 return getMatrixFromCartesian( xform );
103 case kA3DTypeMiscGeneralTransformation:
105 return getMatrixFromGeneralTransformation( xform );
107 throw std::invalid_argument(
"Unexpected argument type provided" );
110 return ts3d::MatrixType::Identity();
117 auto const leaf_type = i.
leafType();
118 if( kA3DTypeAsmProductOccurrence == leaf_type ) {
125 return MatrixType::Identity();
137 if(i.
path().size() > 1) {
static VectorType getVector(A3DVector3dData const &vec)
Use this function to obtain a vector to be used with the matrix.
Definition: ExchangeEigenBridge.h:25
Eigen::Vector4d VectorType
Alias for a 4d vector type.
Definition: ExchangeEigenBridge.h:15
A3DEEntityType leafType(void) const
Gets the type of the leaf entity.
Definition: ExchangeToolkit.h:1733
InstancePath const & path(void) const
Gets the InstancePath this Instance references.
Definition: ExchangeToolkit.h:1693
static bool isRepresentationItem(A3DEEntityType const &t)
Check if type is Ri or derived Ri type.
Definition: ExchangeToolkit.h:832
static MatrixType getMatrix(A3DMiscTransformation *xform)
This function returns a matrix corresponding to the A3DMiscTranslformation. Both general and cartesia...
Definition: ExchangeEigenBridge.h:91
Instance owner(void) const
Gets an Instance object for the parent.
Definition: ExchangeToolkit.h:1699
An instance should be thought of as a specific path through the Exchange product structure to a parti...
Definition: ExchangeToolkit.h:1630
The ts3d namespace is used to contain all Exchange Toolkit functionality.
Definition: ExchangeEigenBridge.h:6
Provides a wrapper for accessing A3DRiRepresentationItemData.
Definition: ExchangeToolkit.h:736
static MatrixType getNetMatrix(ts3d::Instance const &i)
Gets the net matrix for a given instance.The matrix of each entry in the instance path is obtained an...
Definition: ExchangeEigenBridge.h:136
Eigen::Matrix4d MatrixType
Alias for a 4x4 matrix type.
Definition: ExchangeEigenBridge.h:10
static PositionType getPosition(A3DVector3dData const &vec)
Use this function to obtain a direction.
Definition: ExchangeEigenBridge.h:44
static A3DVector3dData getExchangeVector(Eigen::Vector4d const &vec)
Use this function to obtain and Exchange Vector from an Eigen vector/position.
Definition: ExchangeEigenBridge.h:32
Eigen::Vector4d PositionType
Alias for a 4d position type.
Definition: ExchangeEigenBridge.h:20
Provides a wrapper for accessing A3DRiCoordinateSystemData.
Definition: ExchangeToolkit.h:729
A3DEntity * leaf(void) const
Gets the leaf entity pointer.
Definition: ExchangeToolkit.h:1727