@itwin/core-geometry 3.6.0-dev.11 → 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"}
@@ -11,15 +11,18 @@ exports.OrderedRotationAngles = void 0;
11
11
  const Geometry_1 = require("../Geometry");
12
12
  const Angle_1 = require("./Angle");
13
13
  const Matrix3d_1 = require("./Matrix3d");
14
+ /* cspell:word cxcz, cxsz, cxcy, cxsy, sxcz, sxsz, sxcy, sxsy, cycz, cysz, sycz, sysz */
14
15
  /**
15
- * * OrderedRotationAngles represents a non-trivial rotation using three simple axis rotation angles, and an order in which to apply them.
16
- * * This class accommodates application-specific interpretation of "Multiplying 3 rotation matrices" with regard to
16
+ * * represents a non-trivial rotation using three simple axis rotation angles and an
17
+ * order in which to apply them.
18
+ * * This class accommodates application-specific interpretation of "multiplying 3 rotation matrices" with regard to
17
19
  * * Whether a "vector" is a "row" or a "column"
18
- * * The order in which the X,Y, Z rotations are applied.
20
+ * * The order in which the X,Y,Z rotations are applied.
19
21
  * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.
20
22
  * @alpha
21
23
  */
22
24
  class OrderedRotationAngles {
25
+ /** constructor */
23
26
  constructor(x, y, z, axisOrder) {
24
27
  this._x = x;
25
28
  this._y = y;
@@ -27,33 +30,61 @@ class OrderedRotationAngles {
27
30
  this._order = axisOrder;
28
31
  }
29
32
  /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */
30
- get order() { return this._order; }
33
+ get order() {
34
+ return this._order;
35
+ }
31
36
  /** (Property accessor) Return the strongly typed angle of rotation around x. */
32
- get xAngle() { return this._x.clone(); }
37
+ get xAngle() {
38
+ return this._x.clone();
39
+ }
33
40
  /** (Property accessor) Return the strongly typed angle of rotation around y. */
34
- get yAngle() { return this._y.clone(); }
41
+ get yAngle() {
42
+ return this._y.clone();
43
+ }
35
44
  /** (Property accessor) Return the strongly typed angle of rotation around z. */
36
- get zAngle() { return this._z.clone(); }
45
+ get zAngle() {
46
+ return this._z.clone();
47
+ }
37
48
  /** (Property accessor) Return the angle of rotation around x, in degrees */
38
- get xDegrees() { return this._x.degrees; }
49
+ get xDegrees() {
50
+ return this._x.degrees;
51
+ }
39
52
  /** (Property accessor) Return the angle of rotation around y, in degrees */
40
- get xRadians() { return this._x.radians; }
53
+ get xRadians() {
54
+ return this._x.radians;
55
+ }
41
56
  /** (Property accessor) Return the angle of rotation around z, in degrees */
42
- get yDegrees() { return this._y.degrees; }
57
+ get yDegrees() {
58
+ return this._y.degrees;
59
+ }
43
60
  /** (Property accessor) Return the angle of rotation around x, in radians */
44
- get yRadians() { return this._y.radians; }
61
+ get yRadians() {
62
+ return this._y.radians;
63
+ }
45
64
  /** (Property accessor) Return the angle of rotation around y, in radians */
46
- get zDegrees() { return this._z.degrees; }
65
+ get zDegrees() {
66
+ return this._z.degrees;
67
+ }
47
68
  /** (Property accessor) Return the angle of rotation around z, in radians */
48
- get zRadians() { return this._z.radians; }
69
+ get zRadians() {
70
+ return this._z.radians;
71
+ }
49
72
  /** Flag controlling whether vectors are treated as rows or as columns */
50
- static get treatVectorsAsColumns() { return OrderedRotationAngles._sTreatVectorsAsColumns; }
51
- static set treatVectorsAsColumns(value) { OrderedRotationAngles._sTreatVectorsAsColumns = value; }
52
- /** Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
73
+ static get treatVectorsAsColumns() {
74
+ return OrderedRotationAngles._sTreatVectorsAsColumns;
75
+ }
76
+ static set treatVectorsAsColumns(value) {
77
+ OrderedRotationAngles._sTreatVectorsAsColumns = value;
78
+ }
79
+ /**
80
+ * Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
53
81
  * @param xRotation rotation around x
54
82
  * @param yRotation rotation around y
55
83
  * @param zRotation rotation around z
56
- * @param axisOrder right to left order of axis names identifies the order that rotations are applied to xyz data.
84
+ * @param order left to right order of axis names identifies the order that rotations are applied.
85
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
86
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
87
+ * matrix multiplication would be zRot*yRot*xRot
57
88
  */
58
89
  static createAngles(xRotation, yRotation, zRotation, order, result) {
59
90
  if (result) {
@@ -65,7 +96,17 @@ class OrderedRotationAngles {
65
96
  }
66
97
  return new OrderedRotationAngles(xRotation.clone(), yRotation.clone(), zRotation.clone(), order);
67
98
  }
68
- /** Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply them when rotating. */
99
+ /**
100
+ * Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply
101
+ * them when rotating.
102
+ * @param xRadians rotation around x
103
+ * @param yRadians rotation around y
104
+ * @param zRadians rotation around z
105
+ * @param order left to right order of axis names identifies the order that rotations are applied.
106
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
107
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
108
+ * matrix multiplication would be zRot*yRot*xRot
109
+ */
69
110
  static createRadians(xRadians, yRadians, zRadians, order, result) {
70
111
  if (result) {
71
112
  result._x.setRadians(xRadians);
@@ -76,7 +117,17 @@ class OrderedRotationAngles {
76
117
  }
77
118
  return new OrderedRotationAngles(Angle_1.Angle.createRadians(xRadians), Angle_1.Angle.createRadians(yRadians), Angle_1.Angle.createRadians(zRadians), order);
78
119
  }
79
- /** Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply them when rotating. */
120
+ /**
121
+ * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply
122
+ * them when rotating.
123
+ * @param xRadians rotation around x
124
+ * @param yRadians rotation around y
125
+ * @param zRadians rotation around z
126
+ * @param order left to right order of axis names identifies the order that rotations are applied.
127
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
128
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
129
+ * matrix multiplication would be zRot*yRot*xRot
130
+ */
80
131
  static createDegrees(xDegrees, yDegrees, zDegrees, order, result) {
81
132
  if (result) {
82
133
  result._x.setDegrees(xDegrees);
@@ -89,87 +140,95 @@ class OrderedRotationAngles {
89
140
  }
90
141
  /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */
91
142
  static createFromMatrix3d(matrix, order, result) {
92
- let m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];
93
- let m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];
94
- let m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];
95
- if (OrderedRotationAngles.treatVectorsAsColumns) {
96
- // the formulas are from row order .. flip the mIJ
97
- m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];
98
- m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];
99
- m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];
143
+ // treat vector as columns
144
+ let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];
145
+ let m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];
146
+ let m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];
147
+ // treat vector as rows
148
+ if (!OrderedRotationAngles.treatVectorsAsColumns) {
149
+ m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];
150
+ m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];
151
+ m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];
100
152
  }
101
153
  let xRad;
102
154
  let yRad;
103
155
  let zRad;
104
156
  switch (order) {
105
157
  case Geometry_1.AxisOrder.XYZ: {
106
- yRad = Math.asin(Math.max(-1, Math.min(1, m13)));
107
- if (Math.abs(m13) < 0.99999) {
108
- xRad = Math.atan2(-m23, m33);
109
- zRad = Math.atan2(-m12, m11);
158
+ yRad = Math.asin(Math.max(-1, Math.min(1, -m31))); // limit asin domain to [-1,1]
159
+ if (Math.abs(m31) < 0.99999) {
160
+ xRad = Math.atan2(m32, m33);
161
+ zRad = Math.atan2(m21, m11);
110
162
  }
111
163
  else {
112
- xRad = Math.atan2(m32, m22);
164
+ /*
165
+ * If Math.abs(m31) = 1 then yRad = 90 degrees and therefore, we have a gimbal lock.
166
+ * This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.
167
+ * so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).
168
+ * Math details can be found
169
+ * https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles
170
+ */
171
+ xRad = Math.atan2(-m23, m22);
113
172
  zRad = 0;
114
173
  }
115
174
  break;
116
175
  }
117
176
  case Geometry_1.AxisOrder.YXZ: {
118
- xRad = Math.asin(-Math.max(-1, Math.min(1, m23)));
119
- if (Math.abs(m23) < 0.99999) {
120
- yRad = Math.atan2(m13, m33);
121
- zRad = Math.atan2(m21, m22);
177
+ xRad = Math.asin(Math.max(-1, Math.min(1, m32))); // limit asin domain to [-1,1]
178
+ if (Math.abs(m32) < 0.99999) {
179
+ yRad = Math.atan2(-m31, m33);
180
+ zRad = Math.atan2(-m12, m22);
122
181
  }
123
182
  else {
124
- yRad = Math.atan2(-m31, m11);
183
+ yRad = Math.atan2(m13, m11);
125
184
  zRad = 0;
126
185
  }
127
186
  break;
128
187
  }
129
188
  case Geometry_1.AxisOrder.ZXY: {
130
- xRad = Math.asin(Math.max(-1, Math.min(1, m32)));
131
- if (Math.abs(m32) < 0.99999) {
132
- yRad = Math.atan2(-m31, m33);
133
- zRad = Math.atan2(-m12, m22);
189
+ xRad = Math.asin(Math.max(-1, Math.min(1, -m23))); // limit asin domain to [-1,1]
190
+ if (Math.abs(m23) < 0.99999) {
191
+ yRad = Math.atan2(m13, m33);
192
+ zRad = Math.atan2(m21, m22);
134
193
  }
135
194
  else {
136
195
  yRad = 0;
137
- zRad = Math.atan2(m21, m11);
196
+ zRad = Math.atan2(-m12, m11);
138
197
  }
139
198
  break;
140
199
  }
141
200
  case Geometry_1.AxisOrder.ZYX: {
142
- yRad = -Math.asin(Math.max(-1, Math.min(1, m31)));
143
- if (Math.abs(m31) < 0.99999) {
144
- xRad = Math.atan2(m32, m33);
145
- zRad = Math.atan2(m21, m11);
201
+ yRad = Math.asin(Math.max(-1, Math.min(1, m13))); // limit asin domain to [-1,1]
202
+ if (Math.abs(m13) < 0.99999) {
203
+ xRad = Math.atan2(-m23, m33);
204
+ zRad = Math.atan2(-m12, m11);
146
205
  }
147
206
  else {
148
207
  xRad = 0;
149
- zRad = Math.atan2(-m12, m22);
208
+ zRad = Math.atan2(m21, m22);
150
209
  }
151
210
  break;
152
211
  }
153
212
  case Geometry_1.AxisOrder.YZX: {
154
- zRad = Math.asin(Math.max(-1, Math.min(1, m21)));
155
- if (Math.abs(m21) < 0.99999) {
156
- xRad = Math.atan2(-m23, m22);
157
- yRad = Math.atan2(-m31, m11);
213
+ zRad = Math.asin(Math.max(-1, Math.min(1, -m12))); // limit asin domain to [-1,1]
214
+ if (Math.abs(m12) < 0.99999) {
215
+ xRad = Math.atan2(m32, m22);
216
+ yRad = Math.atan2(m13, m11);
158
217
  }
159
218
  else {
160
219
  xRad = 0;
161
- yRad = Math.atan2(m13, m33);
220
+ yRad = Math.atan2(-m31, m33);
162
221
  }
163
222
  break;
164
223
  }
165
224
  case Geometry_1.AxisOrder.XZY: {
166
- zRad = -Math.asin(Math.max(-1, Math.min(1, m12)));
167
- if (Math.abs(m12) < 0.99999) {
168
- xRad = Math.atan2(m32, m22);
169
- yRad = Math.atan2(m13, m11);
225
+ zRad = Math.asin(Math.max(-1, Math.min(1, m21))); // limit asin domain to [-1,1]
226
+ if (Math.abs(m21) < 0.99999) {
227
+ xRad = Math.atan2(-m23, m22);
228
+ yRad = Math.atan2(-m31, m11);
170
229
  }
171
230
  else {
172
- xRad = Math.atan2(-m23, m33);
231
+ xRad = Math.atan2(m32, m33);
173
232
  yRad = 0;
174
233
  }
175
234
  break;
@@ -178,55 +237,51 @@ class OrderedRotationAngles {
178
237
  xRad = yRad = zRad = 0;
179
238
  }
180
239
  }
181
- if (OrderedRotationAngles.treatVectorsAsColumns)
182
- return OrderedRotationAngles.createRadians(-xRad, -yRad, -zRad, order, result);
183
240
  return OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, result);
184
241
  }
185
- /** Create a 3x3 rotational matrix from this OrderedRotationAngles. */
242
+ /**
243
+ * Create a 3x3 rotational matrix from this OrderedRotationAngles.
244
+ ** math details can be found at docs/learning/geometry/Angle.md
245
+ **/
186
246
  toMatrix3d(result) {
187
- const rot = result !== undefined ? result : new Matrix3d_1.Matrix3d();
247
+ const rot = (result !== undefined) ? result : new Matrix3d_1.Matrix3d();
188
248
  const axisOrder = this.order;
189
249
  const x = this.xAngle, y = this.yAngle, z = this.zAngle;
190
- const a = x.cos();
191
- let b = x.sin();
192
- const c = y.cos();
193
- let d = y.sin();
194
- const e = z.cos();
195
- let f = z.sin();
196
- if (OrderedRotationAngles.treatVectorsAsColumns) {
197
- b = -b;
198
- d = -d;
199
- f = -f;
200
- }
250
+ const cx = x.cos(), sx = x.sin();
251
+ const cy = y.cos(), sy = y.sin();
252
+ const cz = z.cos(), sz = z.sin();
253
+ const cxcz = cx * cz, cxsz = cx * sz, cxcy = cx * cy, cxsy = cx * sy;
254
+ const sxcz = sx * cz, sxsz = sx * sz, sxcy = sx * cy, sxsy = sx * sy;
255
+ const cycz = cy * cz, cysz = cy * sz, sycz = sy * cz, sysz = sy * sz;
256
+ // the rotation matrix we build below is created using column-based base rotation matrixes
201
257
  if (axisOrder === Geometry_1.AxisOrder.XYZ) {
202
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
203
- rot.setRowValues(c * e, af + be * d, bf - ae * d, -c * f, ae - bf * d, be + af * d, d, -b * c, a * c);
258
+ rot.setRowValues(cy * cz, sxcz * sy - cxsz, cxcz * sy + sxsz, cy * sz, cxcz + sxsz * sy, cxsz * sy - sxcz, -sy, sx * cy, cx * cy);
204
259
  }
205
260
  else if (axisOrder === Geometry_1.AxisOrder.YXZ) {
206
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
207
- rot.setRowValues(ce + df * b, a * f, cf * b - de, de * b - cf, a * e, df + ce * b, a * d, -b, a * c);
261
+ rot.setRowValues(cycz - sysz * sx, -cx * sz, cysz * sx + sycz, sycz * sx + cysz, cx * cz, sysz - cycz * sx, -cx * sy, sx, cx * cy);
208
262
  }
209
263
  else if (axisOrder === Geometry_1.AxisOrder.ZXY) {
210
- const ce = c * e, cf = c * f, de = d * e, df = d * f;
211
- rot.setRowValues(ce - df * b, cf + de * b, -a * d, -a * f, a * e, b, de + cf * b, df - ce * b, a * c);
264
+ rot.setRowValues(cycz + sysz * sx, sycz * sx - cysz, cx * sy, cx * sz, cx * cz, -sx, cysz * sx - sycz, cycz * sx + sysz, cx * cy);
212
265
  }
213
266
  else if (axisOrder === Geometry_1.AxisOrder.ZYX) {
214
- const ae = a * e, af = a * f, be = b * e, bf = b * f;
215
- rot.setRowValues(c * e, c * f, -d, be * d - af, bf * d + ae, b * c, ae * d + bf, af * d - be, a * c);
267
+ rot.setRowValues(cy * cz, -cy * sz, sy, sxcz * sy + cxsz, cxcz - sxsz * sy, -sx * cy, sxsz - cxcz * sy, sxcz + cxsz * sy, cx * cy);
216
268
  }
217
269
  else if (axisOrder === Geometry_1.AxisOrder.YZX) {
218
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
219
- rot.setRowValues(c * e, f, -d * e, bd - ac * f, a * e, ad * f + bc, bc * f + ad, -b * e, ac - bd * f);
270
+ rot.setRowValues(cy * cz, -sz, sy * cz, sxsy + cxcy * sz, cx * cz, cxsy * sz - sxcy, sxcy * sz - cxsy, sx * cz, cxcy + sxsy * sz);
220
271
  }
221
272
  else if (axisOrder === Geometry_1.AxisOrder.XZY) {
222
- const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
223
- rot.setRowValues(c * e, ac * f + bd, bc * f - ad, -f, a * e, b * e, d * e, ad * f - bc, bd * f + ac);
273
+ rot.setRowValues(cy * cz, sxsy - cxcy * sz, cxsy + sxcy * sz, sz, cx * cz, -sx * cz, -sy * cz, sxcy + cxsy * sz, cxcy - sxsy * sz);
274
+ }
275
+ else {
276
+ rot.setIdentity();
224
277
  }
225
- if (OrderedRotationAngles.treatVectorsAsColumns)
278
+ // if we need row-based rotation matrix, we transpose the rotation matrix
279
+ if (!OrderedRotationAngles.treatVectorsAsColumns)
226
280
  rot.transposeInPlace();
227
281
  return rot;
228
282
  }
229
283
  }
230
284
  exports.OrderedRotationAngles = OrderedRotationAngles;
285
+ /** treat vectors as matrix columns */
231
286
  OrderedRotationAngles._sTreatVectorsAsColumns = false;
232
287
  //# 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,0CAAwC;AACxC,mCAAgC;AAChC,yCAAsC;AAEtC;;;;;;;GAOG;AACH,MAAa,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,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AAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CACjC,CAAC;SACH;aAAM,IAAI,SAAS,KAAK,oBAAS,CAAC,GAAG,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;;AA5OH,sDA6OC;AAxOgB,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,0CAAwC;AACxC,mCAAgC;AAChC,yCAAsC;AAEtC,wFAAwF;AAExF;;;;;;;;GAQG;AACH,MAAa,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,MAA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BAAqB,CAAC,qBAAqB;YAC9C,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAEzB,OAAO,GAAG,CAAC;IACb,CAAC;;AA5SH,sDA6SC;AApSC,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,Q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AC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,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"}
@@ -367,6 +367,7 @@ class Vector2d extends XY {
367
367
  /**
368
368
  * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines
369
369
  * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)
370
+ * * math details can be found at docs/learning/geometry/PointVector.md
370
371
  * @param unitPerpA unit perpendicular to incoming direction
371
372
  * @param unitPerpB unit perpendicular to outgoing direction
372
373
  * @param offset offset distance