Matrix with 3 lines and 4 columns to make any transformation.
This class should be used in order to apply transformations to other components.
More...
#include <SMatrix.h>
Public Types | |
enum | ConstraintFlag { TRANSLATION_X , TRANSLATION_Y , TRANSLATION_Z , ROTATION_X , ROTATION_Y , ROTATION_Z , ALL_MOVEMENT } |
enum | SequenceEnum { OrderXYZ , OrderYXZ , OrderZXY } |
enum | UnitEnum { RADIAN , DEGREE } |
Public Slots | |
Number | AddToDocAsUCS (String Name, Boolean IsActivated) |
To add the matrix to the scene as an UCS with the given name. More... | |
ApplyTransformation (SMatrix iMatrixToMul) | |
To multiply a matrix by another matrix Apply the transformation on the current matrix. it's the matrix product of the two matrix : this*_iMatrixToMul. More... | |
static Array | BestFitCompute (Array< SComp > CompTable, Number ThresDist, Number BestFitType, ConstraintFlag ConstraintBitMask, SPoint FixedPoint, SVector ConstraintAxis, Boolean iAttractReversedNormals) |
Calculate the matrix that should be applied to each component of a set to make a best fit of all the components in a least squares sense. More... | |
static Array | FromActiveCS () |
Return the matrix associated to the active UCS/WCS. More... | |
static Array | FromUCS (String Name) |
Search all the component with the given name. More... | |
Array | GetArmCoordinateSystem (Number Index) |
Return the Matrix saved at a given index. More... | |
Array | GetEuler (UnitEnum Unit) |
To interpret values from a SMatrix and find the rotation angle and the translation vector. More... | |
Number | GetValue (Number Row, Number Column) |
Array | InitAlign (SPoint iFixed_P1, SPoint iFixed_P2, SPoint iFixed_P3, SPoint iMobile_P1, SPoint iMobile_P2, SPoint iMobile_P3) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
Array | InitAlign (SPoint iFixed_P1, SPoint iFixed_P2, SPoint iMobile_P1, SPoint iMobile_P2) |
Calculates the transformation matrix from matching point couples. More... | |
Array | InitAutoRoughAlign (SComp RefComp, SComp CompToAlign) |
Compute the matrix to roughly align a component on another. More... | |
Array | InitBestAlign (Array< SPoint > TargetPoints, Array< SPoint > SourcePoints, Number Mode, ConstraintFlag ConstraintBitMask, SPoint FixedPoint, SVector ConstraintAxis) |
Sets the matrix for the best fit mapping of the source points onto the target points in a least squares sense. More... | |
Array | InitBestRotate (Array< SPoint > TargetPoints, Array< SPoint > SourcePoints, SPoint iFixPoint) |
Sets the matrix for the best ROTATION mapping of the source points onto the target points in a least squares sense. ONLY ROTATION. More... | |
Array | InitBestTranslate (Array< SPoint > TargetPoints, Array< SPoint > SourcePoints) |
Sets the matrix for the best TRANSLATION mapping of the source points onto the target points in a least squares sense. ONLY TRANSLATION. More... | |
InitIdentity () | |
The matrix is initialized to the unitary matrix. All the cells are initialized to zero except the diagonal which is to 1. More... | |
Array | InitInverse (SMatrix Mat) |
Initialises the current matrix to the inversed matrix that is: CurrentMatrix*Mat=IdentityMatrix. More... | |
InitMirrorAxis (SPoint iAxisP1, SPoint iAxisP2) | |
Sets the matrix for an axis mirror. More... | |
InitMirrorPlane (SPoint iPlanePnt, SVector NormalVect) | |
Sets the matrix for a planar mirror. More... | |
InitMirrorPnt (SPoint iMirrorCenter) | |
Sets the matrix for a point mirror. More... | |
InitQuaternion (Number w, Number x, Number y, Number z) | |
Initialize a rotation matrix from a quaternion tuple. More... | |
Array | InitRot (Number AngX, Number AngY, Number AngZ, UnitEnum Unit, SequenceEnum Sequence, SPoint OriginPoint) |
Sets the matrix for the rotation around the 3 axis X,Y,Z. More... | |
Array | InitRot (SPoint iAxisPt, SVector iAxisVect, Number iAngle, UnitEnum iUnit) |
Sets the matrix for the rotation of an angle around an axis. More... | |
Array | InitRPSAlignment (Array< SPoint > TargetPoints, Array< SPoint > SourcePoints, Array< Array< Boolean > > XYZ_Constraints, Array< SCloud > AssociatedClouds, Number Neighborhood) |
Computes the RPS alignement matrix from given source and target points. More... | |
InitScale (SPoint ScaleCenter, Number XScale, Number YScale, Number ZScale) | |
Sets the matrix for a different scale ratio along X, Y and Z with a center. More... | |
Boolean | IsIdentity () |
static SMatrix | New () |
Default constructor. The matrix is initialized to the unitary matrix. The vector is the null vector. More... | |
static SMatrix | New (Array< Number > Row1, Array< Number > Row2, Array< Number > Row3) |
Constructor to define a matrix by defining its rows. More... | |
static SMatrix | New (SMatrix Other) |
Constructs a SMatrix by copying the SMatrix Other. More... | |
static SMatrix | New (SPoint AxisPt, SVector AxisVect, Number Angle, UnitEnum Unit) |
Constructor to set a rotation matrix of an angle around an axis. If the input data are not coherent, the matrix returned is the identity. More... | |
static SMatrix | New (SVector TranslateVector) |
Constructor. The SMatrix obtained is a pure translation. More... | |
Array | SaveArmCoordinateSystem (Number Index, SMatrix NewMatrix) |
Save a Matrix as a Coordinate System. If a matrix exists at the input index, it will be deleted. More... | |
String | toString () |
Get the type of the variable. More... | |
static String | toString () |
Get the type of the variable. More... | |
Array | UpdateArmCoordinateSystem (Number Index, SMatrix NewMatrix) |
Update the matrix at the input index, by multiplying the current matrix by the input matrix. More... | |
Number | UpdateUCS (String Name) |
Update with the current matrix the UCS found with the given name. More... | |
String | ValuesToString () |
Get a string representation of the point. More... | |
Public Slots inherited from SObject | |
Clear () | |
To deallocate memory of the object. More... | |
String | toString () |
Get the type of the variable. More... | |
Matrix with 3 lines and 4 columns to make any transformation.
This class should be used in order to apply transformations to other components.
enum SMatrix::UnitEnum |
|
slot |
To add the matrix to the scene as an UCS with the given name.
0 | There is no error |
1 | The matrix is not well defined |
[in] | Name | Name of the UCS |
[in] | IsActivated | True if the UCS should be activated |
|
slot |
To multiply a matrix by another matrix Apply the transformation on the current matrix.
it's the matrix product of the two matrix : this*_iMatrixToMul.
|
staticslot |
Calculate the matrix that should be applied to each component of a set to make a best fit of all the components in a least squares sense.
Array.ErrorCode | The error code:
|
Array.MatrixTbl | Array of resulting matrices defining new component positions, in the same order as the input component table. The first component being assumed as immobile, the first matrix is initialized with the identity matrix. |
Array.StdDeviationTbl | the registration standard deviation error of each component |
Array.MeanErrorTbl | the registration mean error of each component |
If you register several components together (BestFitType==1), do not forget that if one of the component has a "bad shape" so that it cannot fit correctly with its neighbors, this will also affect the fitting error of the neighbors. However, there is a high chance that the standard deviation of the "worst component" is the highest.
If you register several components together (BestFitType==1), Array.StdDeviationTbl[0] will contain a value although component zero do not moves. This represent the fitting error of component zero with its neighbors in the overlapping areas. If you register all components on the first (BestFitType==0), or if there are only two components, Array.StdDeviationTbl[0] is returned with a null value.
[in] | CompTable | Table of components to best fit together The first component of the list is assumed to be immobile. Valid components in the list are: SCloud, SPoly, SMultiline, SCADSurface |
[in] | ThresDist | Ignore the part of the components whose distance with other components is greater than this threshold. If a complete session is done and BestFitCompute has not been called previously, this value can be set to null to tell the function to take 1/100 of the greatest size. The parameter "ThresDist" is very critical To explain this value, we will take the comparison of a "magnet". When you make the best fit, you "attract" some parts of the shape so that they get closer and to minimize a distance. However, the fitting between the shapes will be correct only if the "attraction" is done between 2 parts representing the same shape in the different objects to fit. In other words, if you attract 2 parts at the opposite extremities of the object to fit, there is a high chance that the position at the end will be incorrect. To avoid this, the "magnet" must limit his attraction to a certain distance and it is the goal of this parameter. The value to set should be in relation with the misalignment error before entering in the command. In other words "how far are the object to align?". In this value, you must also take in account the measurement accuracy and the noise thickness, if any. |
[in] | BestFitType | Which type of best fit should be done ?
|
[in] | ConstraintBitMask | Transformation constraints (bit mask option)
|
[in] | FixedPoint | Fixed point. If not null, this point will not move during the rotation. |
[in] | ConstraintAxis | Axis of constraint. If not null, the translation will be guided by this vector. |
[in] | iAttractReversedNormals | Should we make attraction between surfaces having reversed normals ?
|
|
staticslot |
Return the matrix associated to the active UCS/WCS.
|
staticslot |
Search all the component with the given name.
Array | All the SMatrix with the given name |
|
slot |
Return the Matrix saved at a given index.
Array.ErrorCode | The error code |
Array.Matrix | The matrix
|
[in] | Index | index of the CS to update (1 to 9) |
|
slot |
To interpret values from a SMatrix and find the rotation angle and the translation vector.
Array.ErrorCode | The error code:
|
Array.Vector | The translation SVector |
Array.RotX | The pitch angle (left handed rotation around X) (default RADIAN) |
Array.RotY | The roll angle (left handed rotation around Y) (default RADIAN) |
Array.RotZ | The yaw or heading angle (left handed rotation around Z) (default RADIAN) |
Array.ScaleX | The matrix scale along X |
Array.ScaleY | The matrix scale along Y |
Array.ScaleZ | The matrix scale along Z |
[in] | Unit | In which unit will be expressed Angle SMatrix.RADIAN: Angle is in radians SMatrix.DEGREE: Angle is in degrees |
|
slot |
[in] | Row | index of the row 0 <= Row < 3 |
[in] | Column | index of the column 0 <= Column < 4 |
|
slot |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | iFixed_P1 | Arrival P1 |
[in] | iFixed_P2 | Arrival P2 |
[in] | iFixed_P3 | Arrival P3 |
[in] | iMobile_P1 | Departure P1 to move on iFixed_P1 |
[in] | iMobile_P2 | Departure P2 to align on segment iFixed_P1 iFixed_P2 |
[in] | iMobile_P3 | Departure P3 to put on the same plane as iFixed_P1 iFixed_P2 iFixed_P3 |
|
slot |
Calculates the transformation matrix from matching point couples.
Array.ErrorCode | The error code:
|
[in] | iFixed_P1 | Arrival P1 |
[in] | iFixed_P2 | Arrival P2 |
[in] | iMobile_P1 | Departure P1 to move on iFixed_P1 |
[in] | iMobile_P2 | Departure P2 to align on segment iFixed_P1 iFixed_P2 |
Compute the matrix to roughly align a component on another.
Array.ErrorCode | The error code:
|
|
slot |
Sets the matrix for the best fit mapping of the source points onto the target points in a least squares sense.
Array.ErrorCode | The error code:
|
[in] | TargetPoints | Table of target points |
[in] | SourcePoints | Table of departure points |
[in] | Mode | The type of transformation to do
|
[in] | ConstraintBitMask | Transformation constraints (bit mask option)
|
[in] | FixedPoint | Fixed point. If not 0, this point will not move during the rotation. |
[in] | ConstraintAxis | Axis of constraint. If not 0, the translation will be guided by this vector. |
|
slot |
Sets the matrix for the best ROTATION mapping of the source points onto the target points in a least squares sense. ONLY ROTATION.
Array.ErrorCode | The error code:
|
[in] | TargetPoints | Table of target points |
[in] | SourcePoints | Table of departure points |
[in] | iFixPoint | The point which must not move |
|
slot |
Sets the matrix for the best TRANSLATION mapping of the source points onto the target points in a least squares sense. ONLY TRANSLATION.
Array.ErrorCode | The error code:
|
[in] | TargetPoints | Table of target points |
[in] | SourcePoints | Table of departure points |
|
slot |
The matrix is initialized to the unitary matrix. All the cells are initialized to zero except the diagonal which is to 1.
|
slot |
Initialises the current matrix to the inversed matrix that is: CurrentMatrix*Mat=IdentityMatrix.
Array.ErrorCode | The error code:
|
[in] | Mat | Matrix to inverse |
Sets the matrix for a planar mirror.
|
slot |
Sets the matrix for a point mirror.
|
slot |
Initialize a rotation matrix from a quaternion tuple.
[in] | z | Quaternion tuple (w, x, y, z) |
|
slot |
Sets the matrix for the rotation around the 3 axis X,Y,Z.
Array.ErrorCode | The error code
|
[in] | AngX | Omega |
[in] | AngY | Phi |
[in] | AngZ | Kappa |
[in] | Unit | In which unit is expressed Angle SMatrix.RADIAN: Angle is in radians SMatrix.DEGREE: Angle is in degrees |
[in] | Sequence | Order applied of the angles to the Axis SMatrix.OrderXYZ : Applied in order X->Y->Z such that R = Rz*Ry*Rx. This is the Euler convention In aerial photogrammetric measurements this transformation corresponds to the OPK sequence also called (Omega Phi Kappa) with Omega, Phi=Ry and Kappa=Rz. SMatrix.OrderYXZ : Applied in order Y->X->Z such that R=Rz*Rx*Ry. In aerial photogrammetric measurements this transformation corresponds to the POK sequence also called (Phi Omega Kappa) with Omega, Phi=Ry and Kappa=Rz. SMatrix.OrderZXY : Applied in order Z->X->Y such that R=Ry*Rx*Rz. In terrestrial photogrammetric measurements this transformation corresponds to the POK sequence also called (Phi Omega Kappa) with Omega, Kappa=Ry and Phi=Rz. |
OriginPoint | translation done in space |
Sets the matrix for the rotation of an angle around an axis.
Array.ErrorCode | The error code
|
[in] | iAxisPt | First point of the axis |
[in] | iAxisVect | Vector of the axis |
[in] | iAngle | Angle |
[in] | iUnit | In which unit is expressed Angle SMatrix.RADIAN: Angle is in radians SMatrix.DEGREE: Angle is in degrees |
|
slot |
Computes the RPS alignement matrix from given source and target points.
Array.ErrorCode | The error code:
|
[in] | TargetPoints | Table of target points |
[in] | SourcePoints | Table of departure points |
[in] | XYZ_Constraints | ; The X, Y and Z direction constraints (for RPS alignment) |
[in] | AssociatedClouds | table of clouds associated with the Source points or null if no optimization on source points to do The better point nearest from SourcePoints will be used, the distance Neighborhood is used to find this point in the cloud |
[in] | Neighborhood | The distance to which mobile points can be adjusted |
|
slot |
Sets the matrix for a different scale ratio along X, Y and Z with a center.
[in] | ScaleCenter | Scale center |
[in] | XScale | X scale |
[in] | YScale | Y scale |
[in] | ZScale | Z scale |
|
slot |
true | The matrix is the identity |
false | The matrix is not the identity |
|
staticslot |
Default constructor. The matrix is initialized to the unitary matrix. The vector is the null vector.
|
staticslot |
Constructor to define a matrix by defining its rows.
[in] | Row1 | the 4 data of the first row |
[in] | Row2 | the 4 data of the second row |
[in] | Row3 | the 4 data of the third row |
|
staticslot |
Constructor to set a rotation matrix of an angle around an axis. If the input data are not coherent, the matrix returned is the identity.
[in] | AxisPt | First point of the axis |
[in] | AxisVect | Vector of the axis |
[in] | Angle | Angle |
[in] | Unit | in which unit is expressed Angle SMatrix.RADIAN: Angle is in radians SMatrix.DEGREE: Angle is in degrees |
Constructor. The SMatrix obtained is a pure translation.
|
slot |
Save a Matrix as a Coordinate System. If a matrix exists at the input index, it will be deleted.
Array.ErrorCode | The error code
|
[in] | Index | index of the CS to update (1 to 9) |
[in] | NewMatrix | new matrix |
|
slot |
Get the type of the variable.
|
staticslot |
Get the type of the variable.
|
slot |
Update the matrix at the input index, by multiplying the current matrix by the input matrix.
Array.ErrorCode | The error code
|
[in] | Index | index of the CS to update (1 to 9) |
[in] | NewMatrix | new matrix |
|
slot |
Update with the current matrix the UCS found with the given name.
0 | There is no error |
1 | There are more than one UCS with the given name or this is the WCS |
2 | The matrix is not well defined |
|
slot |
Get a string representation of the point.