@itwin/core-geometry 3.6.0-dev.8 → 4.0.0-dev.1

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 (99) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Geometry.d.ts +25 -14
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +25 -14
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +10 -6
  8. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  9. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +10 -19
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  11. package/lib/cjs/geometry3d/Angle.d.ts +1 -0
  12. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  13. package/lib/cjs/geometry3d/Angle.js +1 -0
  14. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  15. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -0
  16. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  17. package/lib/cjs/geometry3d/AngleSweep.js +1 -0
  18. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  19. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  20. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  21. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  22. package/lib/cjs/geometry3d/Matrix3d.d.ts +221 -159
  23. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  24. package/lib/cjs/geometry3d/Matrix3d.js +365 -249
  25. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  26. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts +71 -14
  27. package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  28. package/lib/cjs/geometry3d/OrderedRotationAngles.js +204 -114
  29. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  30. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +1 -0
  31. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  32. package/lib/cjs/geometry3d/Point2dVector2d.js +1 -0
  33. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  34. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -3
  35. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  36. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
  37. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  38. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts +49 -25
  39. package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  40. package/lib/cjs/geometry3d/YawPitchRollAngles.js +146 -50
  41. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  42. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +4 -4
  43. package/lib/cjs/polyface/PolyfaceBuilder.js +4 -4
  44. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  45. package/lib/cjs/polyface/PolyfaceQuery.d.ts +28 -0
  46. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  47. package/lib/cjs/polyface/PolyfaceQuery.js +79 -0
  48. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  49. package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
  50. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  51. package/lib/esm/Geometry.d.ts +25 -14
  52. package/lib/esm/Geometry.d.ts.map +1 -1
  53. package/lib/esm/Geometry.js +25 -14
  54. package/lib/esm/Geometry.js.map +1 -1
  55. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +10 -6
  56. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  57. package/lib/esm/curve/CurveChainWithDistanceIndex.js +10 -19
  58. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  59. package/lib/esm/geometry3d/Angle.d.ts +1 -0
  60. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  61. package/lib/esm/geometry3d/Angle.js +1 -0
  62. package/lib/esm/geometry3d/Angle.js.map +1 -1
  63. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -0
  64. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  65. package/lib/esm/geometry3d/AngleSweep.js +1 -0
  66. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  67. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  68. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  69. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  70. package/lib/esm/geometry3d/Matrix3d.d.ts +221 -159
  71. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  72. package/lib/esm/geometry3d/Matrix3d.js +365 -249
  73. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  74. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts +71 -14
  75. package/lib/esm/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
  76. package/lib/esm/geometry3d/OrderedRotationAngles.js +205 -115
  77. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  78. package/lib/esm/geometry3d/Point2dVector2d.d.ts +1 -0
  79. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  80. package/lib/esm/geometry3d/Point2dVector2d.js +1 -0
  81. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  82. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -3
  83. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  84. package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
  85. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  86. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts +49 -25
  87. package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
  88. package/lib/esm/geometry3d/YawPitchRollAngles.js +146 -50
  89. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  90. package/lib/esm/polyface/PolyfaceBuilder.d.ts +4 -4
  91. package/lib/esm/polyface/PolyfaceBuilder.js +4 -4
  92. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  93. package/lib/esm/polyface/PolyfaceQuery.d.ts +28 -0
  94. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  95. package/lib/esm/polyface/PolyfaceQuery.js +79 -0
  96. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  97. package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
  98. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  99. package/package.json +4 -4
@@ -5,19 +5,28 @@ 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 order in which to apply them.
9
+ * * This class accommodates application-specific interpretation of "multiplying 3 rotation matrices" with regard to
10
10
  * * Whether a "vector" is a "row" or a "column"
11
- * * The order in which the X,Y, Z rotations are applied.
11
+ * * The order in which the X,Y,Z rotations are applied.
12
+ * * This class bakes in angle rotation directions via create functions (i.e., createRadians, createDegrees, and
13
+ * createAngles) so you can define each of the 3 rotations to be clockwise or counterclockwise. The default
14
+ * rotation is counterclockwise.
12
15
  * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.
13
16
  * @alpha
14
17
  */
15
18
  export declare class OrderedRotationAngles {
19
+ /** rotation around x */
16
20
  private _x;
21
+ /** rotation around y */
17
22
  private _y;
23
+ /** rotation around z */
18
24
  private _z;
25
+ /** rotation order. For example XYZ means to rotate around x axis first, then y axis, and finally Z axis */
19
26
  private _order;
27
+ /** treat vectors as matrix columns */
20
28
  private static _sTreatVectorsAsColumns;
29
+ /** constructor */
21
30
  private constructor();
22
31
  /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */
23
32
  get order(): AxisOrder;
@@ -39,23 +48,71 @@ export declare class OrderedRotationAngles {
39
48
  get zDegrees(): number;
40
49
  /** (Property accessor) Return the angle of rotation around z, in radians */
41
50
  get zRadians(): number;
42
- /** Flag controlling whether vectors are treated as rows or as columns */
51
+ /** the flag controlling whether vectors are treated as rows or as columns */
43
52
  static get treatVectorsAsColumns(): boolean;
44
53
  static set treatVectorsAsColumns(value: boolean);
45
- /** Create an OrderedRotationAngles from three angles and an ordering in which to apply them when rotating.
54
+ /**
55
+ * Create an OrderedRotationAngles from three angles (in radians), an ordering in which to apply them when
56
+ * rotating, and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.
57
+ * @param xRadians rotation around x
58
+ * @param yRadians rotation around y
59
+ * @param zRadians rotation around z
60
+ * @param order left to right order of axis names identifies the order that rotations are applied.
61
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
62
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
63
+ * matrix multiplication would be zRot*yRot*xRot
64
+ * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
65
+ * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
66
+ * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
67
+ * @param result caller-allocated OrderedRotationAngles
68
+ */
69
+ static createRadians(xRadians: number, yRadians: number, zRadians: number, order: AxisOrder, xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles;
70
+ /**
71
+ * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply
72
+ * them when rotating.
73
+ * @param xDegrees rotation around x
74
+ * @param yDegrees rotation around y
75
+ * @param zDegrees rotation around z
76
+ * @param order left to right order of axis names identifies the order that rotations are applied.
77
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
78
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
79
+ * matrix multiplication would be zRot*yRot*xRot
80
+ * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
81
+ * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
82
+ * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
83
+ * @param result caller-allocated OrderedRotationAngles
84
+ */
85
+ static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder, xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles;
86
+ /**
87
+ * Create an OrderedRotationAngles from three angles, an ordering in which to apply them when rotating,
88
+ * and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.
46
89
  * @param xRotation rotation around x
47
90
  * @param yRotation rotation around y
48
91
  * @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.
92
+ * @param order left to right order of axis names identifies the order that rotations are applied
93
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
94
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
95
+ * matrix multiplication would be zRot*yRot*xRot
96
+ * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
97
+ * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
98
+ * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
99
+ * @param result caller-allocated OrderedRotationAngles
50
100
  */
51
- 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. */
53
- 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. */
55
- static createDegrees(xDegrees: number, yDegrees: number, zDegrees: number, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles;
56
- /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */
57
- static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles;
58
- /** Create a 3x3 rotational matrix from this OrderedRotationAngles. */
101
+ static createAngles(xRotation: Angle, yRotation: Angle, zRotation: Angle, order: AxisOrder, xyzRotationIsClockwise?: [boolean, boolean, boolean], result?: OrderedRotationAngles): OrderedRotationAngles;
102
+ /**
103
+ * Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations
104
+ * that the matrix derives from.
105
+ * * This function creates an OrderedRotationAngles with default angle rotation directions, i.e.,
106
+ * it assumes all x, y, and z rotations are counterclockwise.
107
+ * * In the failure case the method's return value is `undefined`.
108
+ * * In the failure case, if the optional result was supplied, that result will nonetheless be filled with
109
+ * a set of angles.
110
+ * */
111
+ static createFromMatrix3d(matrix: Matrix3d, order: AxisOrder, result?: OrderedRotationAngles): OrderedRotationAngles | undefined;
112
+ /**
113
+ * Create a 3x3 rotational matrix from this OrderedRotationAngles.
114
+ ** math details can be found at docs/learning/geometry/Angle.md
115
+ **/
59
116
  toMatrix3d(result?: Matrix3d): Matrix3d;
60
117
  }
61
118
  //# 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;;;;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nC;;;QAGI;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;CA2D/C"}
@@ -11,15 +11,20 @@ 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 order in which to apply them.
17
+ * * This class accommodates application-specific interpretation of "multiplying 3 rotation matrices" with regard to
17
18
  * * Whether a "vector" is a "row" or a "column"
18
- * * The order in which the X,Y, Z rotations are applied.
19
+ * * The order in which the X,Y,Z rotations are applied.
20
+ * * This class bakes in angle rotation directions via create functions (i.e., createRadians, createDegrees, and
21
+ * createAngles) so you can define each of the 3 rotations to be clockwise or counterclockwise. The default
22
+ * rotation is counterclockwise.
19
23
  * * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.
20
24
  * @alpha
21
25
  */
22
26
  class OrderedRotationAngles {
27
+ /** constructor */
23
28
  constructor(x, y, z, axisOrder) {
24
29
  this._x = x;
25
30
  this._y = y;
@@ -27,149 +32,224 @@ class OrderedRotationAngles {
27
32
  this._order = axisOrder;
28
33
  }
29
34
  /** (Property accessor) Return the `AxisOrder` controlling matrix multiplication order. */
30
- get order() { return this._order; }
35
+ get order() {
36
+ return this._order;
37
+ }
31
38
  /** (Property accessor) Return the strongly typed angle of rotation around x. */
32
- get xAngle() { return this._x.clone(); }
39
+ get xAngle() {
40
+ return this._x.clone();
41
+ }
33
42
  /** (Property accessor) Return the strongly typed angle of rotation around y. */
34
- get yAngle() { return this._y.clone(); }
43
+ get yAngle() {
44
+ return this._y.clone();
45
+ }
35
46
  /** (Property accessor) Return the strongly typed angle of rotation around z. */
36
- get zAngle() { return this._z.clone(); }
47
+ get zAngle() {
48
+ return this._z.clone();
49
+ }
37
50
  /** (Property accessor) Return the angle of rotation around x, in degrees */
38
- get xDegrees() { return this._x.degrees; }
51
+ get xDegrees() {
52
+ return this._x.degrees;
53
+ }
39
54
  /** (Property accessor) Return the angle of rotation around y, in degrees */
40
- get xRadians() { return this._x.radians; }
55
+ get xRadians() {
56
+ return this._x.radians;
57
+ }
41
58
  /** (Property accessor) Return the angle of rotation around z, in degrees */
42
- get yDegrees() { return this._y.degrees; }
59
+ get yDegrees() {
60
+ return this._y.degrees;
61
+ }
43
62
  /** (Property accessor) Return the angle of rotation around x, in radians */
44
- get yRadians() { return this._y.radians; }
63
+ get yRadians() {
64
+ return this._y.radians;
65
+ }
45
66
  /** (Property accessor) Return the angle of rotation around y, in radians */
46
- get zDegrees() { return this._z.degrees; }
67
+ get zDegrees() {
68
+ return this._z.degrees;
69
+ }
47
70
  /** (Property accessor) Return the angle of rotation around z, in radians */
48
- get zRadians() { return this._z.radians; }
49
- /** 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.
53
- * @param xRotation rotation around x
54
- * @param yRotation rotation around y
55
- * @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.
71
+ get zRadians() {
72
+ return this._z.radians;
73
+ }
74
+ /** the flag controlling whether vectors are treated as rows or as columns */
75
+ static get treatVectorsAsColumns() {
76
+ return OrderedRotationAngles._sTreatVectorsAsColumns;
77
+ }
78
+ static set treatVectorsAsColumns(value) {
79
+ OrderedRotationAngles._sTreatVectorsAsColumns = value;
80
+ }
81
+ /**
82
+ * Create an OrderedRotationAngles from three angles (in radians), an ordering in which to apply them when
83
+ * rotating, and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.
84
+ * @param xRadians rotation around x
85
+ * @param yRadians rotation around y
86
+ * @param zRadians rotation around z
87
+ * @param order left to right order of axis names identifies the order that rotations are applied.
88
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
89
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
90
+ * matrix multiplication would be zRot*yRot*xRot
91
+ * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
92
+ * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
93
+ * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
94
+ * @param result caller-allocated OrderedRotationAngles
57
95
  */
58
- static createAngles(xRotation, yRotation, zRotation, order, result) {
59
- if (result) {
60
- result._x.setFrom(xRotation);
61
- result._y.setFrom(yRotation);
62
- result._z.setFrom(zRotation);
63
- result._order = order;
64
- return result;
96
+ static createRadians(xRadians, yRadians, zRadians, order, xyzRotationIsClockwise, result) {
97
+ if (!xyzRotationIsClockwise) {
98
+ xyzRotationIsClockwise = [false, false, false];
65
99
  }
66
- return new OrderedRotationAngles(xRotation.clone(), yRotation.clone(), zRotation.clone(), order);
67
- }
68
- /** Create an OrderedRotationAngles from three angles (in radians) and an ordering in which to apply them when rotating. */
69
- static createRadians(xRadians, yRadians, zRadians, order, result) {
100
+ const xRadian = xyzRotationIsClockwise[0] ? -xRadians : xRadians;
101
+ const yRadian = xyzRotationIsClockwise[1] ? -yRadians : yRadians;
102
+ const zRadian = xyzRotationIsClockwise[2] ? -zRadians : zRadians;
70
103
  if (result) {
71
- result._x.setRadians(xRadians);
72
- result._y.setRadians(yRadians);
73
- result._z.setRadians(zRadians);
104
+ result._x.setRadians(xRadian);
105
+ result._y.setRadians(yRadian);
106
+ result._z.setRadians(zRadian);
74
107
  result._order = order;
75
108
  return result;
76
109
  }
77
- return new OrderedRotationAngles(Angle_1.Angle.createRadians(xRadians), Angle_1.Angle.createRadians(yRadians), Angle_1.Angle.createRadians(zRadians), order);
110
+ return new OrderedRotationAngles(Angle_1.Angle.createRadians(xRadian), Angle_1.Angle.createRadians(yRadian), Angle_1.Angle.createRadians(zRadian), order);
78
111
  }
79
- /** Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply them when rotating. */
80
- static createDegrees(xDegrees, yDegrees, zDegrees, order, result) {
81
- if (result) {
82
- result._x.setDegrees(xDegrees);
83
- result._y.setDegrees(yDegrees);
84
- result._z.setDegrees(zDegrees);
85
- result._order = order;
86
- return result;
87
- }
88
- return new OrderedRotationAngles(Angle_1.Angle.createDegrees(xDegrees), Angle_1.Angle.createDegrees(yDegrees), Angle_1.Angle.createDegrees(zDegrees), order);
112
+ /**
113
+ * Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply
114
+ * them when rotating.
115
+ * @param xDegrees rotation around x
116
+ * @param yDegrees rotation around y
117
+ * @param zDegrees rotation around z
118
+ * @param order left to right order of axis names identifies the order that rotations are applied.
119
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
120
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
121
+ * matrix multiplication would be zRot*yRot*xRot
122
+ * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
123
+ * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
124
+ * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
125
+ * @param result caller-allocated OrderedRotationAngles
126
+ */
127
+ static createDegrees(xDegrees, yDegrees, zDegrees, order, xyzRotationIsClockwise, result) {
128
+ return OrderedRotationAngles.createRadians(Angle_1.Angle.degreesToRadians(xDegrees), Angle_1.Angle.degreesToRadians(yDegrees), Angle_1.Angle.degreesToRadians(zDegrees), order, xyzRotationIsClockwise, result);
129
+ }
130
+ /**
131
+ * Create an OrderedRotationAngles from three angles, an ordering in which to apply them when rotating,
132
+ * and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.
133
+ * @param xRotation rotation around x
134
+ * @param yRotation rotation around y
135
+ * @param zRotation rotation around z
136
+ * @param order left to right order of axis names identifies the order that rotations are applied
137
+ * For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
138
+ * * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
139
+ * matrix multiplication would be zRot*yRot*xRot
140
+ * @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
141
+ * rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
142
+ * * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
143
+ * @param result caller-allocated OrderedRotationAngles
144
+ */
145
+ static createAngles(xRotation, yRotation, zRotation, order, xyzRotationIsClockwise, result) {
146
+ return OrderedRotationAngles.createRadians(xRotation.radians, yRotation.radians, zRotation.radians, order, xyzRotationIsClockwise, result);
89
147
  }
90
- /** Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations that the matrix derives from. */
148
+ /**
149
+ * Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations
150
+ * that the matrix derives from.
151
+ * * This function creates an OrderedRotationAngles with default angle rotation directions, i.e.,
152
+ * it assumes all x, y, and z rotations are counterclockwise.
153
+ * * In the failure case the method's return value is `undefined`.
154
+ * * In the failure case, if the optional result was supplied, that result will nonetheless be filled with
155
+ * a set of angles.
156
+ * */
91
157
  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];
158
+ // treat vector as columns
159
+ let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];
160
+ let m21 = matrix.coffs[3], m22 = matrix.coffs[4], m23 = matrix.coffs[5];
161
+ let m31 = matrix.coffs[6], m32 = matrix.coffs[7], m33 = matrix.coffs[8];
162
+ // treat vector as rows
163
+ if (!OrderedRotationAngles.treatVectorsAsColumns) {
164
+ m11 = matrix.coffs[0], m12 = matrix.coffs[3], m13 = matrix.coffs[6];
165
+ m21 = matrix.coffs[1], m22 = matrix.coffs[4], m23 = matrix.coffs[7];
166
+ m31 = matrix.coffs[2], m32 = matrix.coffs[5], m33 = matrix.coffs[8];
100
167
  }
101
168
  let xRad;
102
169
  let yRad;
103
170
  let zRad;
104
171
  switch (order) {
105
172
  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);
173
+ yRad = Math.asin(Math.max(-1, Math.min(1, -m31))); // limit asin domain to [-1,1]
174
+ if (Math.abs(m31) < 0.99999) {
175
+ xRad = Math.atan2(m32, m33);
176
+ zRad = Math.atan2(m21, m11);
110
177
  }
111
178
  else {
112
- xRad = Math.atan2(m32, m22);
179
+ /**
180
+ * If Math.abs(m31) = 1 then yRad = +-90 degrees and therefore, we have a gimbal lock.
181
+ * This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.
182
+ * so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).
183
+ * Therefore, rotation matrix becomes
184
+ * Matrix3d.createRowValues(
185
+ * 0, +-sx, +-cx,
186
+ * 0, cx, -sx,
187
+ * -+1, 0, 0
188
+ * );
189
+ * Math details can be found
190
+ * https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles
191
+ */
192
+ xRad = Math.atan2(-m23, m22);
113
193
  zRad = 0;
114
194
  }
115
195
  break;
116
196
  }
117
197
  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);
198
+ xRad = Math.asin(Math.max(-1, Math.min(1, m32))); // limit asin domain to [-1,1]
199
+ if (Math.abs(m32) < 0.99999) {
200
+ yRad = Math.atan2(-m31, m33);
201
+ zRad = Math.atan2(-m12, m22);
122
202
  }
123
203
  else {
124
- yRad = Math.atan2(-m31, m11);
204
+ yRad = Math.atan2(m13, m11);
125
205
  zRad = 0;
126
206
  }
127
207
  break;
128
208
  }
129
209
  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);
210
+ xRad = Math.asin(Math.max(-1, Math.min(1, -m23))); // limit asin domain to [-1,1]
211
+ if (Math.abs(m23) < 0.99999) {
212
+ yRad = Math.atan2(m13, m33);
213
+ zRad = Math.atan2(m21, m22);
134
214
  }
135
215
  else {
136
216
  yRad = 0;
137
- zRad = Math.atan2(m21, m11);
217
+ zRad = Math.atan2(-m12, m11);
138
218
  }
139
219
  break;
140
220
  }
141
221
  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);
222
+ yRad = Math.asin(Math.max(-1, Math.min(1, m13))); // limit asin domain to [-1,1]
223
+ if (Math.abs(m13) < 0.99999) {
224
+ xRad = Math.atan2(-m23, m33);
225
+ zRad = Math.atan2(-m12, m11);
146
226
  }
147
227
  else {
148
228
  xRad = 0;
149
- zRad = Math.atan2(-m12, m22);
229
+ zRad = Math.atan2(m21, m22);
150
230
  }
151
231
  break;
152
232
  }
153
233
  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);
234
+ zRad = Math.asin(Math.max(-1, Math.min(1, -m12))); // limit asin domain to [-1,1]
235
+ if (Math.abs(m12) < 0.99999) {
236
+ xRad = Math.atan2(m32, m22);
237
+ yRad = Math.atan2(m13, m11);
158
238
  }
159
239
  else {
160
240
  xRad = 0;
161
- yRad = Math.atan2(m13, m33);
241
+ yRad = Math.atan2(-m31, m33);
162
242
  }
163
243
  break;
164
244
  }
165
245
  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);
246
+ zRad = Math.asin(Math.max(-1, Math.min(1, m21))); // limit asin domain to [-1,1]
247
+ if (Math.abs(m21) < 0.99999) {
248
+ xRad = Math.atan2(-m23, m22);
249
+ yRad = Math.atan2(-m31, m11);
170
250
  }
171
251
  else {
172
- xRad = Math.atan2(-m23, m33);
252
+ xRad = Math.atan2(m32, m33);
173
253
  yRad = 0;
174
254
  }
175
255
  break;
@@ -178,55 +258,65 @@ class OrderedRotationAngles {
178
258
  xRad = yRad = zRad = 0;
179
259
  }
180
260
  }
181
- if (OrderedRotationAngles.treatVectorsAsColumns)
182
- return OrderedRotationAngles.createRadians(-xRad, -yRad, -zRad, order, result);
183
- return OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, result);
261
+ const xyzRotationIsClockwise = [false, false, false];
262
+ const angles = OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, xyzRotationIsClockwise, result);
263
+ // sanity check
264
+ const matrix1 = angles.toMatrix3d();
265
+ /**
266
+ * Below tolerance loosened to allow sanity check to pass for
267
+ *
268
+ * OrderedRotationAngles.createFromMatrix3d(
269
+ * OrderedRotationAngles.createDegrees(0, 89.999, 0.001, AxisOrder.XYZ).toMatrix3d(),
270
+ * AxisOrder.XYZ
271
+ * );
272
+ *
273
+ * with treatVectorsAsColumns = true.
274
+ */
275
+ return (matrix.maxDiff(matrix1) < 10 * Geometry_1.Geometry.smallFraction) ? angles : undefined;
184
276
  }
185
- /** Create a 3x3 rotational matrix from this OrderedRotationAngles. */
277
+ /**
278
+ * Create a 3x3 rotational matrix from this OrderedRotationAngles.
279
+ ** math details can be found at docs/learning/geometry/Angle.md
280
+ **/
186
281
  toMatrix3d(result) {
187
- const rot = result !== undefined ? result : new Matrix3d_1.Matrix3d();
282
+ const rot = (result !== undefined) ? result : new Matrix3d_1.Matrix3d();
188
283
  const axisOrder = this.order;
189
284
  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
- }
285
+ const cx = x.cos(), sx = x.sin();
286
+ const cy = y.cos(), sy = y.sin();
287
+ const cz = z.cos(), sz = z.sin();
288
+ const cxcz = cx * cz, cxsz = cx * sz, cxcy = cx * cy, cxsy = cx * sy;
289
+ const sxcz = sx * cz, sxsz = sx * sz, sxcy = sx * cy, sxsy = sx * sy;
290
+ const cycz = cy * cz, cysz = cy * sz, sycz = sy * cz, sysz = sy * sz;
291
+ // the rotation matrix we build below is created using column-based base rotation matrixes
201
292
  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);
293
+ rot.setRowValues(cy * cz, sxcz * sy - cxsz, cxcz * sy + sxsz, cy * sz, cxcz + sxsz * sy, cxsz * sy - sxcz, -sy, sx * cy, cx * cy);
204
294
  }
205
295
  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);
296
+ rot.setRowValues(cycz - sysz * sx, -cx * sz, cysz * sx + sycz, sycz * sx + cysz, cx * cz, sysz - cycz * sx, -cx * sy, sx, cx * cy);
208
297
  }
209
298
  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);
299
+ rot.setRowValues(cycz + sysz * sx, sycz * sx - cysz, cx * sy, cx * sz, cx * cz, -sx, cysz * sx - sycz, cycz * sx + sysz, cx * cy);
212
300
  }
213
301
  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);
302
+ rot.setRowValues(cy * cz, -cy * sz, sy, sxcz * sy + cxsz, cxcz - sxsz * sy, -sx * cy, sxsz - cxcz * sy, sxcz + cxsz * sy, cx * cy);
216
303
  }
217
304
  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);
305
+ rot.setRowValues(cy * cz, -sz, sy * cz, sxsy + cxcy * sz, cx * cz, cxsy * sz - sxcy, sxcy * sz - cxsy, sx * cz, cxcy + sxsy * sz);
220
306
  }
221
307
  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);
308
+ rot.setRowValues(cy * cz, sxsy - cxcy * sz, cxsy + sxcy * sz, sz, cx * cz, -sx * cz, -sy * cz, sxcy + cxsy * sz, cxcy - sxsy * sz);
309
+ }
310
+ else {
311
+ rot.setIdentity();
224
312
  }
225
- if (OrderedRotationAngles.treatVectorsAsColumns)
313
+ // if we need row-based rotation matrix, we transpose the rotation matrix
314
+ if (!OrderedRotationAngles.treatVectorsAsColumns)
226
315
  rot.transposeInPlace();
227
316
  return rot;
228
317
  }
229
318
  }
230
319
  exports.OrderedRotationAngles = OrderedRotationAngles;
320
+ /** treat vectors as matrix columns */
231
321
  OrderedRotationAngles._sTreatVectorsAsColumns = false;
232
322
  //# sourceMappingURL=OrderedRotationAngles.js.map