@itwin/core-geometry 3.6.0-dev.10 → 3.6.0-dev.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/lib/cjs/Geometry.d.ts +7 -8
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +7 -8
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/geometry3d/Angle.d.ts +1 -0
  6. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  7. package/lib/cjs/geometry3d/Angle.js +1 -0
  8. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  9. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -0
  10. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  11. package/lib/cjs/geometry3d/AngleSweep.js +1 -0
  12. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  13. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  14. package/lib/cjs/geometry3d/Matrix3d.js +1 -0
  15. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  16. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts +42 -8
  17. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  18. package/lib/cjs/geometry3d/OrderedRotationAngles.js +140 -85
  19. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  20. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +1 -0
  21. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  22. package/lib/cjs/geometry3d/Point2dVector2d.js +1 -0
  23. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  24. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -3
  25. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  26. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
  27. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  28. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  29. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  30. package/lib/esm/Geometry.d.ts +7 -8
  31. package/lib/esm/Geometry.d.ts.map +1 -1
  32. package/lib/esm/Geometry.js +7 -8
  33. package/lib/esm/Geometry.js.map +1 -1
  34. package/lib/esm/geometry3d/Angle.d.ts +1 -0
  35. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  36. package/lib/esm/geometry3d/Angle.js +1 -0
  37. package/lib/esm/geometry3d/Angle.js.map +1 -1
  38. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -0
  39. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  40. package/lib/esm/geometry3d/AngleSweep.js +1 -0
  41. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  42. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  43. package/lib/esm/geometry3d/Matrix3d.js +1 -0
  44. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  45. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts +42 -8
  46. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  47. package/lib/esm/geometry3d/OrderedRotationAngles.js +140 -85
  48. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  49. package/lib/esm/geometry3d/Point2dVector2d.d.ts +1 -0
  50. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  51. package/lib/esm/geometry3d/Point2dVector2d.js +1 -0
  52. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  53. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -3
  54. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  55. package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
  56. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  57. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  58. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  59. package/package.json +4 -4
@@ -5,19 +5,26 @@ import { AxisOrder } from "../Geometry";
5
5
  import { Angle } from "./Angle";
6
6
  import { Matrix3d } from "./Matrix3d";
7
7
  /**
8
- * * OrderedRotationAngles represents a non-trivial rotation using three simple axis rotation angles, and an order in which to apply them.
9
- * * This class accommodates application-specific interpretation of "Multiplying 3 rotation matrices" with regard to
8
+ * * represents a non-trivial rotation using three simple axis rotation angles and an
9
+ * order in which to apply them.
10
+ * * This class accommodates application-specific interpretation of "multiplying 3 rotation matrices" with regard to
10
11
  * * Whether a "vector" is a "row" or a "column"
11
- * * The order in which the X,Y, Z rotations are applied.
12
+ * * The order in which the X,Y,Z rotations are applied.
12
13
  * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.
13
14
  * @alpha
14
15
  */
15
16
  export declare class OrderedRotationAngles {
17
+ /** rotation around x */
16
18
  private _x;
19
+ /** rotation around y */
17
20
  private _y;
21
+ /** rotation around z */
18
22
  private _z;
23
+ /** rotation order. For example XYZ means to rotate around x axis first, then y axis, and finally Z axis */
19
24
  private _order;
25
+ /** treat vectors as matrix columns */
20
26
  private static _sTreatVectorsAsColumns;
27
+ /** constructor */
21
28
  private constructor();
22
29
  /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */
23
30
  get order(): AxisOrder;
@@ -42,20 +49,47 @@ export declare class OrderedRotationAngles {
42
49
  /** Flag controlling whether vectors are treated as rows or as columns */
43
50
  static get treatVectorsAsColumns(): boolean;
44
51
  static set treatVectorsAsColumns(value: boolean);
45
- /** Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
52
+ /**
53
+ * Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
46
54
  * @param xRotation rotation around x
47
55
  * @param yRotation rotation around y
48
56
  * @param zRotation rotation around z
49
- * @param axisOrder right to left order of axis names identifies the order that rotations are applied to xyz data.
57
+ * @param order left to right order of axis names identifies the order that rotations are applied.
58
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
59
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
60
+ * matrix multiplication would be zRot*yRot*xRot
50
61
  */
51
62
  static createAngles(xRotation: Angle, yRotation: Angle, zRotation: Angle, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles;
52
- /** Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply them when rotating. */
63
+ /**
64
+ * Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply
65
+ * them when rotating.
66
+ * @param xRadians rotation around x
67
+ * @param yRadians rotation around y
68
+ * @param zRadians rotation around z
69
+ * @param order left to right order of axis names identifies the order that rotations are applied.
70
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
71
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
72
+ * matrix multiplication would be zRot*yRot*xRot
73
+ */
53
74
  static createRadians(xRadians: number, yRadians: number, zRadians: number, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles;
54
- /** Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply them when rotating. */
75
+ /**
76
+ * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply
77
+ * them when rotating.
78
+ * @param xRadians rotation around x
79
+ * @param yRadians rotation around y
80
+ * @param zRadians rotation around z
81
+ * @param order left to right order of axis names identifies the order that rotations are applied.
82
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
83
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
84
+ * matrix multiplication would be zRot*yRot*xRot
85
+ */
55
86
  static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles;
56
87
  /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */
57
88
  static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles;
58
- /** Create a 3x3 rotational matrix from this OrderedRotationAngles. */
89
+ /**
90
+ * Create a 3x3 rotational matrix from this OrderedRotationAngles.
91
+ ** math details can be found at docs/learning/geometry/Angle.md
92
+ **/
59
93
  toMatrix3d(result?: Matrix3d): Matrix3d;
60
94
  }
61
95
  //# sourceMappingURL=OrderedRotationAngles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedRotationAngles.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/OrderedRotationAngles.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;GAOG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,EAAE,CAAQ;IAClB,OAAO,CAAC,EAAE,CAAQ;IAClB,OAAO,CAAC,EAAE,CAAQ;IAClB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAkB;IAExD,OAAO;IAOP,0FAA0F;IAC1F,IAAW,KAAK,IAAI,SAAS,CAAwB;IACrD,gFAAgF;IAChF,IAAW,MAAM,IAAI,KAAK,CAA4B;IACtD,gFAAgF;IAChF,IAAW,MAAM,IAAI,KAAK,CAA4B;IACtD,gFAAgF;IAChF,IAAW,MAAM,IAAI,KAAK,CAA4B;IACtD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAA4B;IACzD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAA4B;IACzD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAA4B;IACzD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAA4B;IACzD,4EAA4E;IAC5E,IAAW,QAAQ,IAAI,MAAM,CAA4B;IACzD,4EAA4E;IAC5E,IAAW,QAAQ,IA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AAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAChG,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAexD,uIAAuI;WACzH,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB;IAiG3H;;;QAGI;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;CA2D/C"}
@@ -8,15 +8,18 @@
8
8
  import { AxisOrder } from "../Geometry";
9
9
  import { Angle } from "./Angle";
10
10
  import { Matrix3d } from "./Matrix3d";
11
+ /* cspell:word cxcz, cxsz, cxcy, cxsy, sxcz, sxsz, sxcy, sxsy, cycz, cysz, sycz, sysz */
11
12
  /**
12
- * * OrderedRotationAngles represents a non-trivial rotation using three simple axis rotation angles, and an order in which to apply them.
13
- * * This class accommodates application-specific interpretation of "Multiplying 3 rotation matrices" with regard to
13
+ * * represents a non-trivial rotation using three simple axis rotation angles and an
14
+ * order in which to apply them.
15
+ * * This class accommodates application-specific interpretation of "multiplying 3 rotation matrices" with regard to
14
16
  * * Whether a "vector" is a "row" or a "column"
15
- * * The order in which the X,Y, Z rotations are applied.
17
+ * * The order in which the X,Y,Z rotations are applied.
16
18
  * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.
17
19
  * @alpha
18
20
  */
19
21
  export class OrderedRotationAngles {
22
+ /** constructor */
20
23
  constructor(x, y, z, axisOrder) {
21
24
  this._x = x;
22
25
  this._y = y;
@@ -24,33 +27,61 @@ export class OrderedRotationAngles {
24
27
  this._order = axisOrder;
25
28
  }
26
29
  /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */
27
- get order() { return this._order; }
30
+ get order() {
31
+ return this._order;
32
+ }
28
33
  /** (Property accessor) Return the strongly typed angle of rotation around x. */
29
- get xAngle() { return this._x.clone(); }
34
+ get xAngle() {
35
+ return this._x.clone();
36
+ }
30
37
  /** (Property accessor) Return the strongly typed angle of rotation around y. */
31
- get yAngle() { return this._y.clone(); }
38
+ get yAngle() {
39
+ return this._y.clone();
40
+ }
32
41
  /** (Property accessor) Return the strongly typed angle of rotation around z. */
33
- get zAngle() { return this._z.clone(); }
42
+ get zAngle() {
43
+ return this._z.clone();
44
+ }
34
45
  /** (Property accessor) Return the angle of rotation around x, in degrees */
35
- get xDegrees() { return this._x.degrees; }
46
+ get xDegrees() {
47
+ return this._x.degrees;
48
+ }
36
49
  /** (Property accessor) Return the angle of rotation around y, in degrees */
37
- get xRadians() { return this._x.radians; }
50
+ get xRadians() {
51
+ return this._x.radians;
52
+ }
38
53
  /** (Property accessor) Return the angle of rotation around z, in degrees */
39
- get yDegrees() { return this._y.degrees; }
54
+ get yDegrees() {
55
+ return this._y.degrees;
56
+ }
40
57
  /** (Property accessor) Return the angle of rotation around x, in radians */
41
- get yRadians() { return this._y.radians; }
58
+ get yRadians() {
59
+ return this._y.radians;
60
+ }
42
61
  /** (Property accessor) Return the angle of rotation around y, in radians */
43
- get zDegrees() { return this._z.degrees; }
62
+ get zDegrees() {
63
+ return this._z.degrees;
64
+ }
44
65
  /** (Property accessor) Return the angle of rotation around z, in radians */
45
- get zRadians() { return this._z.radians; }
66
+ get zRadians() {
67
+ return this._z.radians;
68
+ }
46
69
  /** Flag controlling whether vectors are treated as rows or as columns */
47
- static get treatVectorsAsColumns() { return OrderedRotationAngles._sTreatVectorsAsColumns; }
48
- static set treatVectorsAsColumns(value) { OrderedRotationAngles._sTreatVectorsAsColumns = value; }
49
- /** Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
70
+ static get treatVectorsAsColumns() {
71
+ return OrderedRotationAngles._sTreatVectorsAsColumns;
72
+ }
73
+ static set treatVectorsAsColumns(value) {
74
+ OrderedRotationAngles._sTreatVectorsAsColumns = value;
75
+ }
76
+ /**
77
+ * Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
50
78
  * @param xRotation rotation around x
51
79
  * @param yRotation rotation around y
52
80
  * @param zRotation rotation around z
53
- * @param axisOrder right to left order of axis names identifies the order that rotations are applied to xyz data.
81
+ * @param order left to right order of axis names identifies the order that rotations are applied.
82
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
83
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
84
+ * matrix multiplication would be zRot*yRot*xRot
54
85
  */
55
86
  static createAngles(xRotation, yRotation, zRotation, order, result) {
56
87
  if (result) {
@@ -62,7 +93,17 @@ export class OrderedRotationAngles {
62
93
  }
63
94
  return new OrderedRotationAngles(xRotation.clone(), yRotation.clone(), zRotation.clone(), order);
64
95
  }
65
- /** Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply them when rotating. */
96
+ /**
97
+ * Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply
98
+ * them when rotating.
99
+ * @param xRadians rotation around x
100
+ * @param yRadians rotation around y
101
+ * @param zRadians rotation around z
102
+ * @param order left to right order of axis names identifies the order that rotations are applied.
103
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
104
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
105
+ * matrix multiplication would be zRot*yRot*xRot
106
+ */
66
107
  static createRadians(xRadians, yRadians, zRadians, order, result) {
67
108
  if (result) {
68
109
  result._x.setRadians(xRadians);
@@ -73,7 +114,17 @@ export class OrderedRotationAngles {
73
114
  }
74
115
  return new OrderedRotationAngles(Angle.createRadians(xRadians), Angle.createRadians(yRadians), Angle.createRadians(zRadians), order);
75
116
  }
76
- /** Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply them when rotating. */
117
+ /**
118
+ * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply
119
+ * them when rotating.
120
+ * @param xRadians rotation around x
121
+ * @param yRadians rotation around y
122
+ * @param zRadians rotation around z
123
+ * @param order left to right order of axis names identifies the order that rotations are applied.
124
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
125
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
126
+ * matrix multiplication would be zRot*yRot*xRot
127
+ */
77
128
  static createDegrees(xDegrees, yDegrees, zDegrees, order, result) {
78
129
  if (result) {
79
130
  result._x.setDegrees(xDegrees);
@@ -86,87 +137,95 @@ export class OrderedRotationAngles {
86
137
  }
87
138
  /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */
88
139
  static createFromMatrix3d(matrix, order, result) {
89
- let m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];
90
- let m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];
91
- let m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];
92
- if (OrderedRotationAngles.treatVectorsAsColumns) {
93
- // the formulas are from row order .. flip the mIJ
94
- m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];
95
- m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];
96
- m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];
140
+ // treat vector as columns
141
+ let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];
142
+ let m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];
143
+ let m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];
144
+ // treat vector as rows
145
+ if (!OrderedRotationAngles.treatVectorsAsColumns) {
146
+ m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];
147
+ m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];
148
+ m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];
97
149
  }
98
150
  let xRad;
99
151
  let yRad;
100
152
  let zRad;
101
153
  switch (order) {
102
154
  case AxisOrder.XYZ: {
103
- yRad = Math.asin(Math.max(-1, Math.min(1, m13)));
104
- if (Math.abs(m13) < 0.99999) {
105
- xRad = Math.atan2(-m23, m33);
106
- zRad = Math.atan2(-m12, m11);
155
+ yRad = Math.asin(Math.max(-1, Math.min(1, -m31))); // limit asin domain to [-1,1]
156
+ if (Math.abs(m31) < 0.99999) {
157
+ xRad = Math.atan2(m32, m33);
158
+ zRad = Math.atan2(m21, m11);
107
159
  }
108
160
  else {
109
- xRad = Math.atan2(m32, m22);
161
+ /*
162
+ * If Math.abs(m31) = 1 then yRad = 90 degrees and therefore, we have a gimbal lock.
163
+ * This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.
164
+ * so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).
165
+ * Math details can be found
166
+ * https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles
167
+ */
168
+ xRad = Math.atan2(-m23, m22);
110
169
  zRad = 0;
111
170
  }
112
171
  break;
113
172
  }
114
173
  case AxisOrder.YXZ: {
115
- xRad = Math.asin(-Math.max(-1, Math.min(1, m23)));
116
- if (Math.abs(m23) < 0.99999) {
117
- yRad = Math.atan2(m13, m33);
118
- zRad = Math.atan2(m21, m22);
174
+ xRad = Math.asin(Math.max(-1, Math.min(1, m32))); // limit asin domain to [-1,1]
175
+ if (Math.abs(m32) < 0.99999) {
176
+ yRad = Math.atan2(-m31, m33);
177
+ zRad = Math.atan2(-m12, m22);
119
178
  }
120
179
  else {
121
- yRad = Math.atan2(-m31, m11);
180
+ yRad = Math.atan2(m13, m11);
122
181
  zRad = 0;
123
182
  }
124
183
  break;
125
184
  }
126
185
  case AxisOrder.ZXY: {
127
- xRad = Math.asin(Math.max(-1, Math.min(1, m32)));
128
- if (Math.abs(m32) < 0.99999) {
129
- yRad = Math.atan2(-m31, m33);
130
- zRad = Math.atan2(-m12, m22);
186
+ xRad = Math.asin(Math.max(-1, Math.min(1, -m23))); // limit asin domain to [-1,1]
187
+ if (Math.abs(m23) < 0.99999) {
188
+ yRad = Math.atan2(m13, m33);
189
+ zRad = Math.atan2(m21, m22);
131
190
  }
132
191
  else {
133
192
  yRad = 0;
134
- zRad = Math.atan2(m21, m11);
193
+ zRad = Math.atan2(-m12, m11);
135
194
  }
136
195
  break;
137
196
  }
138
197
  case AxisOrder.ZYX: {
139
- yRad = -Math.asin(Math.max(-1, Math.min(1, m31)));
140
- if (Math.abs(m31) < 0.99999) {
141
- xRad = Math.atan2(m32, m33);
142
- zRad = Math.atan2(m21, m11);
198
+ yRad = Math.asin(Math.max(-1, Math.min(1, m13))); // limit asin domain to [-1,1]
199
+ if (Math.abs(m13) < 0.99999) {
200
+ xRad = Math.atan2(-m23, m33);
201
+ zRad = Math.atan2(-m12, m11);
143
202
  }
144
203
  else {
145
204
  xRad = 0;
146
- zRad = Math.atan2(-m12, m22);
205
+ zRad = Math.atan2(m21, m22);
147
206
  }
148
207
  break;
149
208
  }
150
209
  case AxisOrder.YZX: {
151
- zRad = Math.asin(Math.max(-1, Math.min(1, m21)));
152
- if (Math.abs(m21) < 0.99999) {
153
- xRad = Math.atan2(-m23, m22);
154
- yRad = Math.atan2(-m31, m11);
210
+ zRad = Math.asin(Math.max(-1, Math.min(1, -m12))); // limit asin domain to [-1,1]
211
+ if (Math.abs(m12) < 0.99999) {
212
+ xRad = Math.atan2(m32, m22);
213
+ yRad = Math.atan2(m13, m11);
155
214
  }
156
215
  else {
157
216
  xRad = 0;
158
- yRad = Math.atan2(m13, m33);
217
+ yRad = Math.atan2(-m31, m33);
159
218
  }
160
219
  break;
161
220
  }
162
221
  case AxisOrder.XZY: {
163
- zRad = -Math.asin(Math.max(-1, Math.min(1, m12)));
164
- if (Math.abs(m12) < 0.99999) {
165
- xRad = Math.atan2(m32, m22);
166
- yRad = Math.atan2(m13, m11);
222
+ zRad = Math.asin(Math.max(-1, Math.min(1, m21))); // limit asin domain to [-1,1]
223
+ if (Math.abs(m21) < 0.99999) {
224
+ xRad = Math.atan2(-m23, m22);
225
+ yRad = Math.atan2(-m31, m11);
167
226
  }
168
227
  else {
169
- xRad = Math.atan2(-m23, m33);
228
+ xRad = Math.atan2(m32, m33);
170
229
  yRad = 0;
171
230
  }
172
231
  break;
@@ -175,54 +234,50 @@ export class OrderedRotationAngles {
175
234
  xRad = yRad = zRad = 0;
176
235
  }
177
236
  }
178
- if (OrderedRotationAngles.treatVectorsAsColumns)
179
- return OrderedRotationAngles.createRadians(-xRad, -yRad, -zRad, order, result);
180
237
  return OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, result);
181
238
  }
182
- /** Create a 3x3 rotational matrix from this OrderedRotationAngles. */
239
+ /**
240
+ * Create a 3x3 rotational matrix from this OrderedRotationAngles.
241
+ ** math details can be found at docs/learning/geometry/Angle.md
242
+ **/
183
243
  toMatrix3d(result) {
184
- const rot = result !== undefined ? result : new Matrix3d();
244
+ const rot = (result !== undefined) ? result : new Matrix3d();
185
245
  const axisOrder = this.order;
186
246
  const x = this.xAngle, y = this.yAngle, z = this.zAngle;
187
- const a = x.cos();
188
- let b = x.sin();
189
- const c = y.cos();
190
- let d = y.sin();
191
- const e = z.cos();
192
- let f = z.sin();
193
- if (OrderedRotationAngles.treatVectorsAsColumns) {
194
- b = -b;
195
- d = -d;
196
- f = -f;
197
- }
247
+ const cx = x.cos(), sx = x.sin();
248
+ const cy = y.cos(), sy = y.sin();
249
+ const cz = z.cos(), sz = z.sin();
250
+ const cxcz = cx * cz, cxsz = cx * sz, cxcy = cx * cy, cxsy = cx * sy;
251
+ const sxcz = sx * cz, sxsz = sx * sz, sxcy = sx * cy, sxsy = sx * sy;
252
+ const cycz = cy * cz, cysz = cy * sz, sycz = sy * cz, sysz = sy * sz;
253
+ // the rotation matrix we build below is created using column-based base rotation matrixes
198
254
  if (axisOrder === AxisOrder.XYZ) {
199
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
200
- rot.setRowValues(c * e, af + be * d, bf - ae * d, -c * f, ae - bf * d, be + af * d, d, -b * c, a * c);
255
+ rot.setRowValues(cy * cz, sxcz * sy - cxsz, cxcz * sy + sxsz, cy * sz, cxcz + sxsz * sy, cxsz * sy - sxcz, -sy, sx * cy, cx * cy);
201
256
  }
202
257
  else if (axisOrder === AxisOrder.YXZ) {
203
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
204
- rot.setRowValues(ce + df * b, a * f, cf * b - de, de * b - cf, a * e, df + ce * b, a * d, -b, a * c);
258
+ rot.setRowValues(cycz - sysz * sx, -cx * sz, cysz * sx + sycz, sycz * sx + cysz, cx * cz, sysz - cycz * sx, -cx * sy, sx, cx * cy);
205
259
  }
206
260
  else if (axisOrder === AxisOrder.ZXY) {
207
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
208
- rot.setRowValues(ce - df * b, cf + de * b, -a * d, -a * f, a * e, b, de + cf * b, df - ce * b, a * c);
261
+ rot.setRowValues(cycz + sysz * sx, sycz * sx - cysz, cx * sy, cx * sz, cx * cz, -sx, cysz * sx - sycz, cycz * sx + sysz, cx * cy);
209
262
  }
210
263
  else if (axisOrder === AxisOrder.ZYX) {
211
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
212
- rot.setRowValues(c * e, c * f, -d, be * d - af, bf * d + ae, b * c, ae * d + bf, af * d - be, a * c);
264
+ rot.setRowValues(cy * cz, -cy * sz, sy, sxcz * sy + cxsz, cxcz - sxsz * sy, -sx * cy, sxsz - cxcz * sy, sxcz + cxsz * sy, cx * cy);
213
265
  }
214
266
  else if (axisOrder === AxisOrder.YZX) {
215
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
216
- rot.setRowValues(c * e, f, -d * e, bd - ac * f, a * e, ad * f + bc, bc * f + ad, -b * e, ac - bd * f);
267
+ rot.setRowValues(cy * cz, -sz, sy * cz, sxsy + cxcy * sz, cx * cz, cxsy * sz - sxcy, sxcy * sz - cxsy, sx * cz, cxcy + sxsy * sz);
217
268
  }
218
269
  else if (axisOrder === AxisOrder.XZY) {
219
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
220
- rot.setRowValues(c * e, ac * f + bd, bc * f - ad, -f, a * e, b * e, d * e, ad * f - bc, bd * f + ac);
270
+ rot.setRowValues(cy * cz, sxsy - cxcy * sz, cxsy + sxcy * sz, sz, cx * cz, -sx * cz, -sy * cz, sxcy + cxsy * sz, cxcy - sxsy * sz);
271
+ }
272
+ else {
273
+ rot.setIdentity();
221
274
  }
222
- if (OrderedRotationAngles.treatVectorsAsColumns)
275
+ // if we need row-based rotation matrix, we transpose the rotation matrix
276
+ if (!OrderedRotationAngles.treatVectorsAsColumns)
223
277
  rot.transposeInPlace();
224
278
  return rot;
225
279
  }
226
280
  }
281
+ /** treat vectors as matrix columns */
227
282
  OrderedRotationAngles._sTreatVectorsAsColumns = false;
228
283
  //# sourceMappingURL=OrderedRotationAngles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedRotationAngles.js","sourceRoot":"","sources":["../../../src/geometry3d/OrderedRotationAngles.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAqB;IAOhC,YAAoB,CAAQ,EAAE,CAAQ,EAAE,CAAQ,EAAE,SAAoB;QACpE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED,0FAA0F;IAC1F,IAAW,KAAK,KAAgB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,gFAAgF;IAChF,IAAW,MAAM,KAAY,OAAO,IAAI,CAAC,EAAE,CAA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,EAAE;YACtC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;YACrD,GAAG,CAAC,YAAY,CACd,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAC/B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAChB,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,CAChC,CAAC;SACH;QACD,IAAI,qBAAqB,CAAC,qBAAqB;YAC7C,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAEzB,OAAO,GAAG,CAAC;IACb,CAAC;;AAvOc,6CAAuB,GAAY,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { AxisOrder } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\n\r\n/**\r\n * * OrderedRotationAngles represents a non-trivial rotation using three simple axis rotation angles, and an order in which to apply them.\r\n * * This class accommodates application-specific interpretation of \"Multiplying 3 rotation matrices\" with regard to\r\n * * Whether a \"vector\" is a \"row\" or a \"column\"\r\n * * The order in which the X,Y, Z rotations are applied.\r\n * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.\r\n * @alpha\r\n */\r\nexport class OrderedRotationAngles {\r\n private _x: Angle;\r\n private _y: Angle;\r\n private _z: Angle;\r\n private _order: AxisOrder;\r\n private static _sTreatVectorsAsColumns: boolean = false;\r\n\r\n private constructor(x: Angle, y: Angle, z: Angle, axisOrder: AxisOrder) {\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._order = axisOrder;\r\n }\r\n\r\n /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */\r\n public get order(): AxisOrder { return this._order; }\r\n /** (Property accessor) Return the strongly typed angle of rotation around x. */\r\n public get xAngle(): Angle { return this._x.clone(); }\r\n /** (Property accessor) Return the strongly typed angle of rotation around y. */\r\n public get yAngle(): Angle { return this._y.clone(); }\r\n /** (Property accessor) Return the strongly typed angle of rotation around z. */\r\n public get zAngle(): Angle { return this._z.clone(); }\r\n /** (Property accessor) Return the angle of rotation around x, in degrees */\r\n public get xDegrees(): number { return this._x.degrees; }\r\n /** (Property accessor) Return the angle of rotation around y, in degrees */\r\n public get xRadians(): number { return this._x.radians; }\r\n /** (Property accessor) Return the angle of rotation around z, in degrees */\r\n public get yDegrees(): number { return this._y.degrees; }\r\n /** (Property accessor) Return the angle of rotation around x, in radians */\r\n public get yRadians(): number { return this._y.radians; }\r\n /** (Property accessor) Return the angle of rotation around y, in radians */\r\n public get zDegrees(): number { return this._z.degrees; }\r\n /** (Property accessor) Return the angle of rotation around z, in radians */\r\n public get zRadians(): number { return this._z.radians; }\r\n /** Flag controlling whether vectors are treated as rows or as columns */\r\n public static get treatVectorsAsColumns(): boolean { return OrderedRotationAngles._sTreatVectorsAsColumns; }\r\n public static set treatVectorsAsColumns(value: boolean) { OrderedRotationAngles._sTreatVectorsAsColumns = value; }\r\n\r\n /** Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.\r\n * @param xRotation rotation around x\r\n * @param yRotation rotation around y\r\n * @param zRotation rotation around z\r\n * @param axisOrder right to left order of axis names identifies the order that rotations are applied to xyz data.\r\n */\r\n public static createAngles(xRotation: Angle, yRotation: Angle, zRotation: Angle, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (result) {\r\n result._x.setFrom(xRotation);\r\n result._y.setFrom(yRotation);\r\n result._z.setFrom(zRotation);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(xRotation.clone(), yRotation.clone(), zRotation.clone(), order);\r\n }\r\n\r\n /** Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply them when rotating. */\r\n public static createRadians(xRadians: number, yRadians: number, zRadians: number, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (result) {\r\n result._x.setRadians(xRadians);\r\n result._y.setRadians(yRadians);\r\n result._z.setRadians(zRadians);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(Angle.createRadians(xRadians), Angle.createRadians(yRadians), Angle.createRadians(zRadians), order);\r\n }\r\n\r\n /** Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply them when rotating. */\r\n public static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (result) {\r\n result._x.setDegrees(xDegrees);\r\n result._y.setDegrees(yDegrees);\r\n result._z.setDegrees(zDegrees);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(Angle.createDegrees(xDegrees), Angle.createDegrees(yDegrees), Angle.createDegrees(zDegrees), order);\r\n }\r\n\r\n /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */\r\n public static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles {\r\n\r\n let m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];\r\n let m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];\r\n let m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];\r\n\r\n if (OrderedRotationAngles.treatVectorsAsColumns) {\r\n // the formulas are from row order .. flip the mIJ\r\n m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];\r\n m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];\r\n m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];\r\n\r\n }\r\n\r\n let xRad: number;\r\n let yRad: number;\r\n let zRad: number;\r\n\r\n switch (order) {\r\n case AxisOrder.XYZ: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, m13)));\r\n\r\n if (Math.abs(m13) < 0.99999) {\r\n xRad = Math.atan2(- m23, m33);\r\n zRad = Math.atan2(- m12, m11);\r\n } else {\r\n xRad = Math.atan2(m32, m22);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.YXZ: {\r\n xRad = Math.asin(-Math.max(-1, Math.min(1, m23)));\r\n\r\n if (Math.abs(m23) < 0.99999) {\r\n yRad = Math.atan2(m13, m33);\r\n zRad = Math.atan2(m21, m22);\r\n } else {\r\n yRad = Math.atan2(-m31, m11);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.ZXY: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, m32)));\r\n\r\n if (Math.abs(m32) < 0.99999) {\r\n yRad = Math.atan2(-m31, m33);\r\n zRad = Math.atan2(-m12, m22);\r\n } else {\r\n yRad = 0;\r\n zRad = Math.atan2(m21, m11);\r\n }\r\n break;\r\n } case AxisOrder.ZYX: {\r\n yRad = -Math.asin(Math.max(-1, Math.min(1, m31)));\r\n\r\n if (Math.abs(m31) < 0.99999) {\r\n xRad = Math.atan2(m32, m33);\r\n zRad = Math.atan2(m21, m11);\r\n } else {\r\n xRad = 0;\r\n zRad = Math.atan2(-m12, m22);\r\n }\r\n break;\r\n } case AxisOrder.YZX: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, m21)));\r\n\r\n if (Math.abs(m21) < 0.99999) {\r\n xRad = Math.atan2(-m23, m22);\r\n yRad = Math.atan2(-m31, m11);\r\n } else {\r\n xRad = 0;\r\n yRad = Math.atan2(m13, m33);\r\n }\r\n break;\r\n } case AxisOrder.XZY: {\r\n zRad = -Math.asin(Math.max(-1, Math.min(1, m12)));\r\n\r\n if (Math.abs(m12) < 0.99999) {\r\n xRad = Math.atan2(m32, m22);\r\n yRad = Math.atan2(m13, m11);\r\n } else {\r\n xRad = Math.atan2(-m23, m33);\r\n yRad = 0;\r\n }\r\n break;\r\n } default: {\r\n xRad = yRad = zRad = 0;\r\n }\r\n }\r\n if (OrderedRotationAngles.treatVectorsAsColumns)\r\n return OrderedRotationAngles.createRadians(-xRad, -yRad, -zRad, order, result);\r\n\r\n return OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, result);\r\n }\r\n\r\n /** Create a 3x3 rotational matrix from this OrderedRotationAngles. */\r\n public toMatrix3d(result?: Matrix3d): Matrix3d {\r\n const rot = result !== undefined ? result : new Matrix3d();\r\n const axisOrder = this.order;\r\n const x = this.xAngle, y = this.yAngle, z = this.zAngle;\r\n const a = x.cos(); let b = x.sin();\r\n const c = y.cos(); let d = y.sin();\r\n const e = z.cos(); let f = z.sin();\r\n if (OrderedRotationAngles.treatVectorsAsColumns) {\r\n b = -b;\r\n d = -d;\r\n f = -f;\r\n }\r\n\r\n if (axisOrder === AxisOrder.XYZ) {\r\n const ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n rot.setRowValues(\r\n c * e, af + be * d, bf - ae * d,\r\n -c * f, ae - bf * d, be + af * d,\r\n d, -b * c, a * c,\r\n );\r\n } else if (axisOrder === AxisOrder.YXZ) {\r\n const ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n rot.setRowValues(\r\n ce + df * b, a * f, cf * b - de,\r\n de * b - cf, a * e, df + ce * b,\r\n a * d, -b, a * c,\r\n );\r\n } else if (axisOrder === AxisOrder.ZXY) {\r\n const ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n rot.setRowValues(\r\n ce - df * b, cf + de * b, -a * d,\r\n -a * f, a * e, b,\r\n de + cf * b, df - ce * b, a * c,\r\n );\r\n } else if (axisOrder === AxisOrder.ZYX) {\r\n const ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n rot.setRowValues(\r\n c * e, c * f, -d,\r\n be * d - af, bf * d + ae, b * c,\r\n ae * d + bf, af * d - be, a * c,\r\n );\r\n } else if (axisOrder === AxisOrder.YZX) {\r\n const ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n rot.setRowValues(\r\n c * e, f, -d * e,\r\n bd - ac * f, a * e, ad * f + bc,\r\n bc * f + ad, -b * e, ac - bd * f,\r\n );\r\n } else if (axisOrder === AxisOrder.XZY) {\r\n const ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n rot.setRowValues(\r\n c * e, ac * f + bd, bc * f - ad,\r\n -f, a * e, b * e,\r\n d * e, ad * f - bc, bd * f + ac,\r\n );\r\n }\r\n if (OrderedRotationAngles.treatVectorsAsColumns)\r\n rot.transposeInPlace();\r\n\r\n return rot;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"OrderedRotationAngles.js","sourceRoot":"","sources":["../../../src/geometry3d/OrderedRotationAngles.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,wFAAwF;AAExF;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAqB;IAWhC,kBAAkB;IAClB,YAAoB,CAAQ,EAAE,CAAQ,EAAE,CAAQ,EAAE,SAAoB;QACpE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IACD,0FAA0F;IAC1F,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAC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C,gBAAgB,EAAE,CAAC;QAEzB,OAAO,GAAG,CAAC;IACb,CAAC;;AAnSD,sCAAsC;AACvB,6CAAuB,GAAY,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\nimport { AxisOrder } from \"../Geometry\";\r\nimport { Angle } from \"./Angle\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\n\r\n/* cspell:word cxcz, cxsz, cxcy, cxsy, sxcz, sxsz, sxcy, sxsy, cycz, cysz, sycz, sysz */\r\n\r\n/**\r\n * * represents a non-trivial rotation using three simple axis rotation angles and an\r\n * order in which to apply them.\r\n * * This class accommodates application-specific interpretation of \"multiplying 3 rotation matrices\" with regard to\r\n * * Whether a \"vector\" is a \"row\" or a \"column\"\r\n * * The order in which the X,Y,Z rotations are applied.\r\n * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.\r\n * @alpha\r\n */\r\nexport class OrderedRotationAngles {\r\n /** rotation around x */\r\n private _x: Angle;\r\n /** rotation around y */\r\n private _y: Angle;\r\n /** rotation around z */\r\n private _z: Angle;\r\n /** rotation order. For example XYZ means to rotate around x axis first, then y axis, and finally Z axis */\r\n private _order: AxisOrder;\r\n /** treat vectors as matrix columns */\r\n private static _sTreatVectorsAsColumns: boolean = false;\r\n /** constructor */\r\n private constructor(x: Angle, y: Angle, z: Angle, axisOrder: AxisOrder) {\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._order = axisOrder;\r\n }\r\n /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */\r\n public get order(): AxisOrder {\r\n return this._order;\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around x. */\r\n public get xAngle(): Angle {\r\n return this._x.clone();\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around y. */\r\n public get yAngle(): Angle {\r\n return this._y.clone();\r\n }\r\n /** (Property accessor) Return the strongly typed angle of rotation around z. */\r\n public get zAngle(): Angle {\r\n return this._z.clone();\r\n }\r\n /** (Property accessor) Return the angle of rotation around x, in degrees */\r\n public get xDegrees(): number {\r\n return this._x.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around y, in degrees */\r\n public get xRadians(): number {\r\n return this._x.radians;\r\n }\r\n /** (Property accessor) Return the angle of rotation around z, in degrees */\r\n public get yDegrees(): number {\r\n return this._y.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around x, in radians */\r\n public get yRadians(): number {\r\n return this._y.radians;\r\n }\r\n /** (Property accessor) Return the angle of rotation around y, in radians */\r\n public get zDegrees(): number {\r\n return this._z.degrees;\r\n }\r\n /** (Property accessor) Return the angle of rotation around z, in radians */\r\n public get zRadians(): number {\r\n return this._z.radians;\r\n }\r\n /** Flag controlling whether vectors are treated as rows or as columns */\r\n public static get treatVectorsAsColumns(): boolean {\r\n return OrderedRotationAngles._sTreatVectorsAsColumns;\r\n }\r\n public static set treatVectorsAsColumns(value: boolean) {\r\n OrderedRotationAngles._sTreatVectorsAsColumns = value;\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.\r\n * @param xRotation rotation around x\r\n * @param yRotation rotation around y\r\n * @param zRotation rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n */\r\n public static createAngles(xRotation: Angle, yRotation: Angle, zRotation: Angle, order: AxisOrder,\r\n result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (result) {\r\n result._x.setFrom(xRotation);\r\n result._y.setFrom(yRotation);\r\n result._z.setFrom(zRotation);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(xRotation.clone(), yRotation.clone(), zRotation.clone(), order);\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply\r\n * them when rotating.\r\n * @param xRadians rotation around x\r\n * @param yRadians rotation around y\r\n * @param zRadians rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n */\r\n public static createRadians(xRadians: number, yRadians: number, zRadians: number, order: AxisOrder,\r\n result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (result) {\r\n result._x.setRadians(xRadians);\r\n result._y.setRadians(yRadians);\r\n result._z.setRadians(zRadians);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(\r\n Angle.createRadians(xRadians),\r\n Angle.createRadians(yRadians),\r\n Angle.createRadians(zRadians),\r\n order\r\n );\r\n }\r\n /**\r\n * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply\r\n * them when rotating.\r\n * @param xRadians rotation around x\r\n * @param yRadians rotation around y\r\n * @param zRadians rotation around z\r\n * @param order left to right order of axis names identifies the order that rotations are applied.\r\n * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.\r\n * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation\r\n * matrix multiplication would be zRot*yRot*xRot\r\n */\r\n public static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder,\r\n result?: OrderedRotationAngles): OrderedRotationAngles {\r\n if (result) {\r\n result._x.setDegrees(xDegrees);\r\n result._y.setDegrees(yDegrees);\r\n result._z.setDegrees(zDegrees);\r\n result._order = order;\r\n return result;\r\n }\r\n return new OrderedRotationAngles(\r\n Angle.createDegrees(xDegrees),\r\n Angle.createDegrees(yDegrees),\r\n Angle.createDegrees(zDegrees),\r\n order\r\n );\r\n }\r\n /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */\r\n public static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles {\r\n // treat vector as columns\r\n let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];\r\n let m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];\r\n let m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];\r\n // treat vector as rows\r\n if (!OrderedRotationAngles.treatVectorsAsColumns) {\r\n m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];\r\n m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];\r\n m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];\r\n }\r\n\r\n let xRad: number;\r\n let yRad: number;\r\n let zRad: number;\r\n\r\n switch (order) {\r\n case AxisOrder.XYZ: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, -m31))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m31) < 0.99999) {\r\n xRad = Math.atan2(m32, m33);\r\n zRad = Math.atan2(m21, m11);\r\n } else {\r\n /*\r\n * If Math.abs(m31) = 1 then yRad = 90 degrees and therefore, we have a gimbal lock.\r\n * This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.\r\n * so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).\r\n * Math details can be found\r\n * https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles\r\n */\r\n xRad = Math.atan2(-m23, m22);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.YXZ: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, m32))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m32) < 0.99999) {\r\n yRad = Math.atan2(-m31, m33);\r\n zRad = Math.atan2(-m12, m22);\r\n } else {\r\n yRad = Math.atan2(m13, m11);\r\n zRad = 0;\r\n }\r\n break;\r\n } case AxisOrder.ZXY: {\r\n xRad = Math.asin(Math.max(-1, Math.min(1, -m23))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m23) < 0.99999) {\r\n yRad = Math.atan2(m13, m33);\r\n zRad = Math.atan2(m21, m22);\r\n } else {\r\n yRad = 0;\r\n zRad = Math.atan2(-m12, m11);\r\n }\r\n break;\r\n } case AxisOrder.ZYX: {\r\n yRad = Math.asin(Math.max(-1, Math.min(1, m13))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m13) < 0.99999) {\r\n xRad = Math.atan2(-m23, m33);\r\n zRad = Math.atan2(-m12, m11);\r\n } else {\r\n xRad = 0;\r\n zRad = Math.atan2(m21, m22);\r\n }\r\n break;\r\n } case AxisOrder.YZX: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, -m12))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m12) < 0.99999) {\r\n xRad = Math.atan2(m32, m22);\r\n yRad = Math.atan2(m13, m11);\r\n } else {\r\n xRad = 0;\r\n yRad = Math.atan2(-m31, m33);\r\n }\r\n break;\r\n } case AxisOrder.XZY: {\r\n zRad = Math.asin(Math.max(-1, Math.min(1, m21))); // limit asin domain to [-1,1]\r\n\r\n if (Math.abs(m21) < 0.99999) {\r\n xRad = Math.atan2(-m23, m22);\r\n yRad = Math.atan2(-m31, m11);\r\n } else {\r\n xRad = Math.atan2(m32, m33);\r\n yRad = 0;\r\n }\r\n break;\r\n } default: {\r\n xRad = yRad = zRad = 0;\r\n }\r\n }\r\n\r\n return OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, result);\r\n }\r\n /**\r\n * Create a 3x3 rotational matrix from this OrderedRotationAngles.\r\n ** math details can be found at docs/learning/geometry/Angle.md\r\n **/\r\n public toMatrix3d(result?: Matrix3d): Matrix3d {\r\n const rot = (result !== undefined) ? result : new Matrix3d();\r\n const axisOrder = this.order;\r\n const x = this.xAngle, y = this.yAngle, z = this.zAngle;\r\n\r\n const cx = x.cos(), sx = x.sin();\r\n const cy = y.cos(), sy = y.sin();\r\n const cz = z.cos(), sz = z.sin();\r\n\r\n const cxcz = cx * cz, cxsz = cx * sz, cxcy = cx * cy, cxsy = cx * sy;\r\n const sxcz = sx * cz, sxsz = sx * sz, sxcy = sx * cy, sxsy = sx * sy;\r\n const cycz = cy * cz, cysz = cy * sz, sycz = sy * cz, sysz = sy * sz;\r\n\r\n // the rotation matrix we build below is created using column-based base rotation matrixes\r\n if (axisOrder === AxisOrder.XYZ) {\r\n rot.setRowValues(\r\n cy * cz, sxcz * sy - cxsz, cxcz * sy + sxsz,\r\n cy * sz, cxcz + sxsz * sy, cxsz * sy - sxcz,\r\n -sy, sx * cy, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.YXZ) {\r\n rot.setRowValues(\r\n cycz - sysz * sx, -cx * sz, cysz * sx + sycz,\r\n sycz * sx + cysz, cx * cz, sysz - cycz * sx,\r\n -cx * sy, sx, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.ZXY) {\r\n rot.setRowValues(\r\n cycz + sysz * sx, sycz * sx - cysz, cx * sy,\r\n cx * sz, cx * cz, -sx,\r\n cysz * sx - sycz, cycz * sx + sysz, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.ZYX) {\r\n rot.setRowValues(\r\n cy * cz, -cy * sz, sy,\r\n sxcz * sy + cxsz, cxcz - sxsz * sy, -sx * cy,\r\n sxsz - cxcz * sy, sxcz + cxsz * sy, cx * cy,\r\n );\r\n } else if (axisOrder === AxisOrder.YZX) {\r\n rot.setRowValues(\r\n cy * cz, -sz, sy * cz,\r\n sxsy + cxcy * sz, cx * cz, cxsy * sz - sxcy,\r\n sxcy * sz - cxsy, sx * cz, cxcy + sxsy * sz,\r\n );\r\n } else if (axisOrder === AxisOrder.XZY) {\r\n rot.setRowValues(\r\n cy * cz, sxsy - cxcy * sz, cxsy + sxcy * sz,\r\n sz, cx * cz, -sx * cz,\r\n -sy * cz, sxcy + cxsy * sz, cxcy - sxsy * sz,\r\n );\r\n } else {\r\n rot.setIdentity();\r\n }\r\n // if we need row-based rotation matrix, we transpose the rotation matrix\r\n if (!OrderedRotationAngles.treatVectorsAsColumns)\r\n rot.transposeInPlace();\r\n\r\n return rot;\r\n }\r\n}\r\n"]}
@@ -182,6 +182,7 @@ export declare class Vector2d extends XY implements BeJSONFunctions {
182
182
  /**
183
183
  * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines
184
184
  * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)
185
+ * * math details can be found at docs/learning/geometry/PointVector.md
185
186
  * @param unitPerpA unit perpendicular to incoming direction
186
187
  * @param unitPerpB unit perpendicular to outgoing direction
187
188
  * @param offset offset distance
@@ -1 +1 @@
1
- {"version":3,"file":"Point2dVector2d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Point2dVector2d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAY,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,EAAG,YAAW,KAAK;IAC9B,kBAAkB;IACX,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IACX,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACjB,GAAG,CAAC,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU;IAIvC,+BAA+B;IACxB,OAAO;IAId,SAAS,aAAa,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU;IAIlD,mCAAmC;IAC5B,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK;IAS5B,8CAA8C;IACvC,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC;IAG/B,+FAA+F;IACxF,aAAa,C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AAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAMlJ,4BAA4B;IACrB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAMxD,iEAAiE;IAC1D,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IAM7E,kDAAkD;IAC3C,UAAU,CAAC,OAAO,EAAE,KAAK,GAAG,MAAM;IAGzC,oDAAoD;IAC7C,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM;IAG/D,gDAAgD;IACzC,YAAY,CAAC,OAAO,EAAE,KAAK,GAAG,MAAM;IAG3C;;;OAGG;IACI,SAAS,CAAC,OAAO,EAAE,KAAK,GAAG,MAAM;IAGxC;;;OAGG;IACI,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,KAAK;IAGrC;;;;;;;OAOG;IACI,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,kBAAkB,GAAE,OAAe,EACtE,gCAAgC,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO;IAgB5F;;;;;;;OAOG;IACI,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,gCAAgC,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO;CAUrI"}
@@ -362,6 +362,7 @@ export class Vector2d extends XY {
362
362
  /**
363
363
  * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines
364
364
  * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)
365
+ * * math details can be found at docs/learning/geometry/PointVector.md
365
366
  * @param unitPerpA unit perpendicular to incoming direction
366
367
  * @param unitPerpB unit perpendicular to outgoing direction
367
368
  * @param offset offset distance