dmatrix4d.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
11 
18 struct GEOMDLLIMPEXP DMatrix4d
19 {
21 double coff[4][4];
22 #ifdef __cplusplus
23 
24 //BEGIN_FROM_METHODS
25 
26 
47 static DMatrix4d FromRowValues
48 (
49 double x00,
50 double x01,
51 double x02,
52 double x03,
53 double x10,
54 double x11,
55 double x12,
56 double x13,
57 double x20,
58 double x21,
59 double x22,
60 double x23,
61 double x30,
62 double x31,
63 double x32,
64 double x33
65 );
66 
67 
74 static DMatrix4d FromScaleAndTranslation
75 (
76 DPoint3dCR scale,
77 DPoint3dCR translation
78 );
79 
87 static DMatrix4d From101WeightedProduct
88 (
89 TransformCR transformA,
90 RotMatrixCR matrixB,
91 TransformCR transformC
92 );
93 
94 
104 static DMatrix4d FromColumnVectors
105 (
106 DVec3dCR col0,
107 DVec3dCR col1,
108 DVec3dCR col2,
109 DPoint3dCR translation
110 );
111 
119 static DMatrix4d From (RotMatrixCR B);
120 
121 
129 static DMatrix4d From (TransformCR transfrom);
130 
131 
140 static DMatrix4d FromTranslation
141 (
142 double tx,
143 double ty,
144 double tz
145 );
146 
155 static DMatrix4d FromPerspective
156 (
157 double px,
158 double py,
159 double pz
160 );
161 
164 static DMatrix4d FromZero ();
165 
166 //END_FROM_METHODS
187 void InitFromRowValues
188 (
189 double x00,
190 double x01,
191 double x02,
192 double x03,
193 double x10,
194 double x11,
195 double x12,
196 double x13,
197 double x20,
198 double x21,
199 double x22,
200 double x23,
201 double x30,
202 double x31,
203 double x32,
204 double x33
205 );
206 
213 void TransposeOf (DMatrix4dCR B);
214 
224 void Multiply
225 (
226 DPoint4dP outPoint,
227 DPoint4dCP inPoint,
228 int n
229 ) const;
230 
234 DPoint4d Multiply (DPoint3dCR xyz, double w);
235 
236 
241 void SymmetricEigenvectors
242 (
243 DMatrix4dR Q,
244 DPoint4dR D
245 ) const;
246 
255 void Multiply
256 (
257 GraphicsPointP outPoint,
258 GraphicsPointCP inPoint,
259 size_t n
260 ) const;
261 
277 bool EvaluateImageGrid
278 (
279 DPoint2dP grid,
280 double x00,
281 double y00,
282 int m,
283 int n,
284 double tol
285 ) const;
286 
295 void MultiplyAndRenormalize
296 (
297 DPoint3dP outPoint,
298 DPoint3dCP inPoint,
299 int n
300 ) const;
301 
308 void MultiplyAndRenormalize
309 (
310 DPoint3dR outPoint,
311 DPoint3dCR inPoint
312 ) const;
313 
322 void MultiplyAndNormalize
323 (
324 DPoint3dP outPoint,
325 DPoint4dCP inPoint,
326 size_t n
327 ) const;
328 
329 
338 void MultiplyAffine
339 (
340 DPoint4dP outPoint,
341 DPoint4dCP inPoint,
342 int n
343 ) const;
344 
345 
354 void MultiplyScaleAndTranslate
355 (
356 DPoint4dP outPoint,
357 DPoint4dCP inPoint,
358 int n
359 ) const;
360 
368 void MultiplyAffine
369 (
370 DPoint3dP outPoint,
371 DPoint3dCP inPoint,
372 int n
373 ) const;
374 
383 void MultiplyAffineVectors
384 (
385 DPoint3dP out,
386 DPoint3dCP in,
387 int n
388 ) const;
389 
398 void MultiplyScaleAndTranslate
399 (
400 DPoint3dP outPoint,
401 DPoint3dCP inPoint,
402 int n
403 ) const;
404 
414 void Multiply
415 (
416 DPoint4dP hPoint,
417 DPoint3dCP point,
418 const double *pWeight,
419 int n
420 ) const;
421 
422 
423 
424 
432 void Multiply
433 (
434 DPoint4dR outPoint,
435 DPoint4dCR inPoint
436 ) const;
437 
446 void MultiplyTranspose
447 (
448 DPoint4dP outPoint,
449 DPoint4dCP inPoint,
450 int n
451 ) const;
452 
462 void SetRow
463 (
464 int i,
465 double c0,
466 double c1,
467 double c2,
468 double c3
469 );
470 
477 void SetRow
478 (
479 int i,
480 DPoint4dCR data
481 );
482 
483 
484 
494 void SetColumn
495 (
496 int i,
497 double r0,
498 double r1,
499 double r2,
500 double r3
501 );
502 
509 void SetColumn
510 (
511 int i,
512 DPoint4dCR point
513 );
514 
521 void SwapColumns
522 (
523 int i,
524 int j
525 );
526 
533 void SwapRows
534 (
535 int i,
536 int j
537 );
538 
545 void GetColumn
546 (
547 DPoint4dR vec,
548 int i
549 ) const;
550 
557 void GetRow
558 (
559 DPoint4dR vec,
560 int i
561 ) const;
562 
563 
564 
573 void GetRows
574 (
575 DPoint4dR row0,
576 DPoint4dR row1,
577 DPoint4dR row2,
578 DPoint4dR row3
579 ) const;
580 
585 void InitIdentity ();
586 
593 void InitFromScaleAndTranslation
594 (
595 DPoint3dCR scale,
596 DPoint3dCR translation
597 );
598 
608 void InitFromColumnVectors
609 (
610 DVec3dCR col0,
611 DVec3dCR col1,
612 DVec3dCR col2,
613 DPoint3dCR translation
614 );
615 
616 
624 void InitFrom (RotMatrixCR B);
625 
626 
634 void InitFrom (TransformCR transfrom);
635 
636 
645 void InitFromTranslation
646 (
647 double tx,
648 double ty,
649 double tz
650 );
651 
660 void InitFromPerspective
661 (
662 double px,
663 double py,
664 double pz
665 );
666 
677 void PreMultiplyByTranslateAndScale
678 (
679 double tx,
680 double ty,
681 double tz,
682 double sx,
683 double sy,
684 double sz,
685 DMatrix4dCR matrixA
686 );
687 
693 void InitProduct
694 (
695 DMatrix4dCR A,
696 DMatrix4dCR B
697 );
698 
706 void InitProduct
707 (
708 DMatrix4dCR A,
709 DMatrix4dCR B,
710 DMatrix4dCR C
711 );
712 
720 void DifferenceOf
721 (
722 DMatrix4dCR A,
723 DMatrix4dCR B
724 );
725 
731 void Add (DMatrix4dCR delta);
732 
739 void Add (DMatrix4dCR delta, double scaleFactor);
740 
745 void Scale (double scaleFactor);
746 
747 
751 void AddSymmetricScaledOuterProduct (DPoint3d xyz, double scale);
752 
756 void AddSymmetricScaledOuterProduct (DPoint4dCR xyzw, double scale);
757 
762 void AddSymmetricScaledOuterProduct (DPoint4dCR U, DPoint4dCR V, double scale);
763 
765 void CopyUpperTriangleToLower ();
766 
772 void Subtract (DMatrix4dCR delta);
773 
774 
784 void InitSymmetricProduct
785 (
786 DPoint4dCR sigma,
787 DMatrix4dCR B
788 );
789 
803 static DMatrix4d FromSandwichProduct
804 (
805 TransformCR transform,
806 DMatrix4dCR momentMatrix,
807 double scaleFactor
808 );
809 
817 bool ConvertInertiaProductsToPrincipalMoments (double &volume, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const;
818 
827 bool ConvertInertiaProductsToPrincipalMoments (TransformCR localToWorld, double &volume, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const;
828 
837 bool ConvertInertiaProductsToPrincipalAreaMoments (TransformCR localToWorld, double &area, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const;
838 
847 bool ConvertInertiaProductsToPrincipalWireMoments (TransformCR localToWorld, double &length, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const;
848 
849 
850 
855 static DMatrix4d SweepMomentProducts (DMatrix4dCR baseProducts, DVec3d sweepVector);
856 
862 void GetBlocks (RotMatrixR products, DVec3dR row, DVec3dR column, double &scalar) const;
863 
869 double MaxAbs () const;
870 
880 double MaxAbsDiff (DMatrix4dCR other, double &matrixDiff, double &colDiff, double &rowDiff, double &weightDiff) const;
881 
890 double MaxAbs (double &matrixMax, double &colMax, double &rowMax, double &weightAbs) const;
891 
900 bool IsIdentity () const;
901 
907 bool IsAffine () const;
908 
918 bool ApproximateNullVectorForUpperTriangle
919 (
920 DPoint4dR nullVector,
921 double &residual
922 ) const;
923 
924 
925 #endif
926 };
struct RotMatrix & RotMatrixR
Definition: msgeomstructs_typedefs.h:135
struct DPoint4d & DPoint4dR
Definition: msgeomstructs_typedefs.h:96
struct DPoint3d const * DPoint3dCP
Definition: msgeomstructs_typedefs.h:79
struct DPoint4d * DPoint4dP
Definition: msgeomstructs_typedefs.h:96
struct DMatrix4d const & DMatrix4dCR
Definition: msgeomstructs_typedefs.h:97
struct DVec3d & DVec3dR
Definition: msgeomstructs_typedefs.h:89
#define END_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:30
struct RotMatrix const & RotMatrixCR
Definition: msgeomstructs_typedefs.h:135
struct DPoint2d * DPoint2dP
Definition: msgeomstructs_typedefs.h:78
4d point coordinates.
Definition: dpoint4d.h:17
struct DPoint3d * DPoint3dP
Definition: msgeomstructs_typedefs.h:79
struct DMatrix4d & DMatrix4dR
Definition: msgeomstructs_typedefs.h:97
struct DPoint3d & DPoint3dR
Definition: msgeomstructs_typedefs.h:79
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
struct GraphicsPoint * GraphicsPointP
Definition: msgeomstructs_typedefs.h:101
#define BEGIN_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:29
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
struct DVec3d const & DVec3dCR
Definition: msgeomstructs_typedefs.h:89
struct DPoint4d const * DPoint4dCP
Definition: msgeomstructs_typedefs.h:96
struct DPoint4d const & DPoint4dCR
Definition: msgeomstructs_typedefs.h:96
struct GraphicsPoint const * GraphicsPointCP
Definition: msgeomstructs_typedefs.h:101
4x4 matrix used for perspective (homogeneous coordinate) calculations.
Definition: dmatrix4d.h:18

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.