Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SMatrix.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include "RshPluginScript/SClass/SObject.h"
10
11#ifndef FCT_DOC
12namespace rsh::ScriptBinding
13{
14#endif // !FCT_DOC
15
20class SMatrix : public SObject
21{
22 //======================================================================================================================
23 // INTERNAL FUNCTION
24 //======================================================================================================================
25
26 //======================================================================================================================
27 // DOCUMENTED FUNCTION
28 //======================================================================================================================
29public:
31 {
32 TRANSLATION_X,
34 TRANSLATION_Y,
36 TRANSLATION_Z,
38 ROTATION_X,
40 ROTATION_Y,
42 ROTATION_Z,
44 ALL_MOVEMENT
46 };
47
49 {
51 DEGREE};
52
54 {
55 OrderXYZ, // * 0: Applied in order X->Y->Z such that R = Rz*Ry*Rx. This is the Euler convention
56 // In aerial photogrammetric measurements this transformation corresponds to the OPK sequence
57 // also called (Omega Phi Kappa) with Omega, Phi=Ry and Kappa=Rz.
58 OrderYXZ, // * 1: Applied in order Y->X->Z such that R=Rz*Rx*Ry.
59 // In aerial photogrammetric measurements this transformation corresponds to the POK sequence
60 // also called (Phi Omega Kappa) with Omega, Phi=Ry and Kappa=Rz.
61 OrderZXY// * 2: Applied in order Z->X->Y such that R=Ry*Rx*Rz.
62 // In terrestrial photogrammetric measurements this transformation corresponds to the POK sequence
63 // also called (Phi Omega Kappa) with Omega, Kappa=Ry and Phi=Rz.
64 };
65
66public slots: // these functions (slots) will be available in QtScript
71 // TESTED
73
77 // TESTED
79
83 Number w, Number x, Number y, Number z
85 );
86
90 // TESTED
91 Boolean IsIdentity() ;
92
98 // TESTED
101 );
102
108 // TESTED
109 Array InitRot(
110 SPoint iAxisPt,
112 SVector iAxisVect,
114 Number iAngle,
116 UnitEnum iUnit
120 );
121
127 Array InitRot(
128 Number AngX,
130 Number AngY,
132 Number AngZ,
134 UnitEnum Unit,
138 SequenceEnum Sequence,
149 SPoint OriginPoint
151 );
152
155 // TESTED
157 SPoint ScaleCenter,
159 Number XScale,
161 Number YScale,
163 Number ZScale
165 );
166
169 InitMirrorPnt(SPoint iMirrorCenter);
170
173 InitMirrorAxis(SPoint iAxisP1, SPoint iAxisP2);
174
177 InitMirrorPlane(SPoint iPlanePnt, SVector NormalVect);
178
184 // TESTED
186 SPoint iFixed_P1,
188 SPoint iFixed_P2,
190 SPoint iMobile_P1,
192 SPoint iMobile_P2
194 );
195
197 // TESTED
199 SPoint iFixed_P1,
201 SPoint iFixed_P2,
203 SPoint iFixed_P3,
205 SPoint iMobile_P1,
207 SPoint iMobile_P2,
209 SPoint iMobile_P3
211 );
212
226 SComp RefComp,
228 SComp CompToAlign
230 );
231
241 // TESTED
243 Array<SPoint> TargetPoints,
245 Array<SPoint> SourcePoints,
247 Number Mode,
251 ConstraintFlag ConstraintBitMask,
259 SPoint FixedPoint,
261 SVector ConstraintAxis
263 );
264
274 // TESTED
276 Array<SPoint> TargetPoints,
278 Array<SPoint> SourcePoints
280 );
281
291 // TESTED
293 Array<SPoint> TargetPoints,
295 Array<SPoint> SourcePoints,
297 SPoint iFixPoint
299 );
300
312 Array<SPoint> TargetPoints,
314 Array<SPoint> SourcePoints,
316 Array<Array<Boolean>> XYZ_Constraints,
318 Array<SCloud> AssociatedClouds,
322 Number Neighborhood
324 );
325
328 Number GetValue(
329 Number Row,
331 Number Column
333 );
334
347 Array GetEuler(UnitEnum Unit
351 );
352
355 String toString() ;
356
359 String ValuesToString() ;
360
369 Number UpdateUCS( String Name);
370
378 // @note (not in the documentation)
379 // if no error occurred the ownership is taken by the DComptree
380 // TESTED
382 String Name,
384 Boolean IsActivated
386 );
387};
388
389// @brief
390// this class allow to wrap static function to SMatrix easily
391// this allow to wrap constructor more easily the constructor will be declared with the function New(...)
392class SMatrix
393#ifndef FCT_DOC
394 : public SObjectStatic
395#endif // FCT_DOC
396{
397 //======================================================================================================================
398 // INTERNAL FUNCTION
399 //======================================================================================================================
400 //======================================================================================================================
401 // DOCUMENTED FUNCTION
402 //======================================================================================================================
403
404public slots:
407 // TESTED
408 static SMatrix New();
409
412 // TESTED
413 static SMatrix New( SMatrix Other);
414
417 // TESTED
418 static SMatrix New(
419 SVector TranslateVector);
420
424 // TESTED
425 static SMatrix New(
426 SPoint AxisPt,
428 SVector AxisVect,
430 Number Angle,
432 UnitEnum Unit
436 );
437
440 // TESTED
441 static SMatrix New(
442 Array<Number> Row1,
444 Array<Number> Row2,
446 Array<Number> Row3
448 );
449
499 // TESTED
500 static Array BestFitCompute(
501 Array<SComp> CompTable,
505 Number ThresDist,
520 Number BestFitType,
527 ConstraintFlag ConstraintBitMask,
535 SPoint FixedPoint,
537 SVector ConstraintAxis,
539 Boolean iAttractReversedNormals
545 );
546
549 static String toString();
550
557 // TESTED
559 Number Index,
561 SMatrix NewMatrix
563 );
564
571 // TESTED
573 Number Index,
575 SMatrix NewMatrix
577 );
578
585 // TESTED
586 Array GetArmCoordinateSystem(Number Index
588 );
589
593 static Array FromUCS( String Name);
594
597 static Array FromActiveCS();
598};
599Q_DECLARE_METATYPE(SMatrix::_SMatrixDummy);
600Q_DECLARE_METATYPE(SMatrix);
601
602#ifndef FCT_DOC
603} // namespace rsh::ScriptBinding
604#endif // !FCT_DOC
The SComp class is an abstract class. Use derived classes SCircle, SCylinder, SCloud,...
Definition: SComp.h:32
Matrix with 3 lines and 4 columns to make any transformation. This class should be used in order to a...
Definition: SMatrix.h:21
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 o...
InitMirrorPnt(SPoint iMirrorCenter)
Sets the matrix for a point mirror.
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,...
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 ...
UnitEnum
Definition: SMatrix.h:49
@ RADIAN
Definition: SMatrix.h:50
Array GetEuler(UnitEnum Unit)
To interpret values from a SMatrix and find the rotation angle and the translation vector.
String ValuesToString()
Get a string representation of the point.
Array InitAlign(SPoint iFixed_P1, SPoint iFixed_P2, SPoint iMobile_P1, SPoint iMobile_P2)
Calculates the transformation matrix from matching point couples.
String toString()
Get the type of the variable.
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 lea...
static Array FromActiveCS()
Return the matrix associated to the active UCS/WCS.
static Array FromUCS(String Name)
Search all the component with the given name.
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.
Number GetValue(Number Row, Number Column)
InitMirrorAxis(SPoint iAxisP1, SPoint iAxisP2)
Sets the matrix for an axis mirror.
Number UpdateUCS(String Name)
Update with the current matrix the UCS found with the given name.
static String toString()
Get the type of the variable.
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.
InitQuaternion(Number w, Number x, Number y, Number z)
Initialize a rotation matrix from a quaternion tuple.
ApplyTransformation(SMatrix iMatrixToMul)
To multiply a matrix by another matrix Apply the transformation on the current matrix....
ConstraintFlag
Definition: SMatrix.h:31
static SMatrix New()
Default constructor. The matrix is initialized to the unitary matrix. The vector is the null vector.
Boolean IsIdentity()
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 ...
Number AddToDocAsUCS(String Name, Boolean IsActivated)
To add the matrix to the scene as an UCS with the given name.
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 squar...
static SMatrix New(Array< Number > Row1, Array< Number > Row2, Array< Number > Row3)
Constructor to define a matrix by defining its rows.
static SMatrix New(SMatrix Other)
Constructs a SMatrix by copying the SMatrix Other.
Array UpdateArmCoordinateSystem(Number Index, SMatrix NewMatrix)
Update the matrix at the input index, by multiplying the current matrix by the input matrix.
InitMirrorPlane(SPoint iPlanePnt, SVector NormalVect)
Sets the matrix for a planar mirror.
Array InitRot(SPoint iAxisPt, SVector iAxisVect, Number iAngle, UnitEnum iUnit)
Sets the matrix for the rotation of an angle around an axis.
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.
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.
Array InitInverse(SMatrix Mat)
Initialises the current matrix to the inversed matrix that is: CurrentMatrix*Mat=IdentityMatrix.
InitIdentity()
The matrix is initialized to the unitary matrix. All the cells are initialized to zero except the dia...
static SMatrix New(SVector TranslateVector)
Constructor. The SMatrix obtained is a pure translation.
SequenceEnum
Definition: SMatrix.h:54
@ OrderYXZ
Definition: SMatrix.h:58
@ OrderXYZ
Definition: SMatrix.h:55
Array InitAutoRoughAlign(SComp RefComp, SComp CompToAlign)
Compute the matrix to roughly align a component on another.
Array GetArmCoordinateSystem(Number Index)
Return the Matrix saved at a given index.
This class is an abstract class, you can use these function in its derived classes.
Definition: SObject.h:35
3D point manipulation class. The SPoint creation can be done by calling the static functions:
Definition: SPoint.h:23
The mathematical object vector.
Definition: SVector3.h:26