@mlightcad/geometry-engine 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/geometry-engine.js +10186 -0
- package/dist/geometry-engine.umd.cjs +4 -0
- package/lib/geometry/AcGeArea2d.d.ts +61 -0
- package/lib/geometry/AcGeArea2d.d.ts.map +1 -0
- package/lib/geometry/AcGeArea2d.js +174 -0
- package/lib/geometry/AcGeArea2d.js.map +1 -0
- package/lib/geometry/AcGeCircArc2d.d.ts +108 -0
- package/lib/geometry/AcGeCircArc2d.d.ts.map +1 -0
- package/lib/geometry/AcGeCircArc2d.js +412 -0
- package/lib/geometry/AcGeCircArc2d.js.map +1 -0
- package/lib/geometry/AcGeCircArc3d.d.ts +138 -0
- package/lib/geometry/AcGeCircArc3d.d.ts.map +1 -0
- package/lib/geometry/AcGeCircArc3d.js +447 -0
- package/lib/geometry/AcGeCircArc3d.js.map +1 -0
- package/lib/geometry/AcGeCurve2d.d.ts +85 -0
- package/lib/geometry/AcGeCurve2d.d.ts.map +1 -0
- package/lib/geometry/AcGeCurve2d.js +213 -0
- package/lib/geometry/AcGeCurve2d.js.map +1 -0
- package/lib/geometry/AcGeCurve3d.d.ts +27 -0
- package/lib/geometry/AcGeCurve3d.d.ts.map +1 -0
- package/lib/geometry/AcGeCurve3d.js +29 -0
- package/lib/geometry/AcGeCurve3d.js.map +1 -0
- package/lib/geometry/AcGeEllipseArc2d.d.ts +105 -0
- package/lib/geometry/AcGeEllipseArc2d.d.ts.map +1 -0
- package/lib/geometry/AcGeEllipseArc2d.js +292 -0
- package/lib/geometry/AcGeEllipseArc2d.js.map +1 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts +141 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -0
- package/lib/geometry/AcGeEllipseArc3d.js +442 -0
- package/lib/geometry/AcGeEllipseArc3d.js.map +1 -0
- package/lib/geometry/AcGeLine2d.d.ts +56 -0
- package/lib/geometry/AcGeLine2d.d.ts.map +1 -0
- package/lib/geometry/AcGeLine2d.js +125 -0
- package/lib/geometry/AcGeLine2d.js.map +1 -0
- package/lib/geometry/AcGeLine3d.d.ts +134 -0
- package/lib/geometry/AcGeLine3d.d.ts.map +1 -0
- package/lib/geometry/AcGeLine3d.js +291 -0
- package/lib/geometry/AcGeLine3d.js.map +1 -0
- package/lib/geometry/AcGeLoop2d.d.ts +59 -0
- package/lib/geometry/AcGeLoop2d.d.ts.map +1 -0
- package/lib/geometry/AcGeLoop2d.js +141 -0
- package/lib/geometry/AcGeLoop2d.js.map +1 -0
- package/lib/geometry/AcGePolyline2d.d.ts +90 -0
- package/lib/geometry/AcGePolyline2d.d.ts.map +1 -0
- package/lib/geometry/AcGePolyline2d.js +224 -0
- package/lib/geometry/AcGePolyline2d.js.map +1 -0
- package/lib/geometry/AcGeShape.d.ts +12 -0
- package/lib/geometry/AcGeShape.d.ts.map +1 -0
- package/lib/geometry/AcGeShape.js +22 -0
- package/lib/geometry/AcGeShape.js.map +1 -0
- package/lib/geometry/AcGeShape2d.d.ts +31 -0
- package/lib/geometry/AcGeShape2d.d.ts.map +1 -0
- package/lib/geometry/AcGeShape2d.js +51 -0
- package/lib/geometry/AcGeShape2d.js.map +1 -0
- package/lib/geometry/AcGeShape3d.d.ts +33 -0
- package/lib/geometry/AcGeShape3d.d.ts.map +1 -0
- package/lib/geometry/AcGeShape3d.js +52 -0
- package/lib/geometry/AcGeShape3d.js.map +1 -0
- package/lib/geometry/AcGeSpline3d.d.ts +77 -0
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -0
- package/lib/geometry/AcGeSpline3d.js +221 -0
- package/lib/geometry/AcGeSpline3d.js.map +1 -0
- package/lib/geometry/index.d.ts +13 -0
- package/lib/geometry/index.d.ts.map +1 -0
- package/lib/geometry/index.js +13 -0
- package/lib/geometry/index.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -0
- package/lib/math/AcGeBox2d.d.ts +173 -0
- package/lib/math/AcGeBox2d.d.ts.map +1 -0
- package/lib/math/AcGeBox2d.js +289 -0
- package/lib/math/AcGeBox2d.js.map +1 -0
- package/lib/math/AcGeBox3d.d.ts +195 -0
- package/lib/math/AcGeBox3d.d.ts.map +1 -0
- package/lib/math/AcGeBox3d.js +378 -0
- package/lib/math/AcGeBox3d.js.map +1 -0
- package/lib/math/AcGeEuler.d.ts +133 -0
- package/lib/math/AcGeEuler.d.ts.map +1 -0
- package/lib/math/AcGeEuler.js +358 -0
- package/lib/math/AcGeEuler.js.map +1 -0
- package/lib/math/AcGeMatrix2d.d.ts +203 -0
- package/lib/math/AcGeMatrix2d.d.ts.map +1 -0
- package/lib/math/AcGeMatrix2d.js +393 -0
- package/lib/math/AcGeMatrix2d.js.map +1 -0
- package/lib/math/AcGeMatrix3d.d.ts +279 -0
- package/lib/math/AcGeMatrix3d.d.ts.map +1 -0
- package/lib/math/AcGeMatrix3d.js +1037 -0
- package/lib/math/AcGeMatrix3d.js.map +1 -0
- package/lib/math/AcGePlane.d.ts +131 -0
- package/lib/math/AcGePlane.d.ts.map +1 -0
- package/lib/math/AcGePlane.js +218 -0
- package/lib/math/AcGePlane.js.map +1 -0
- package/lib/math/AcGePoint.d.ts +4 -0
- package/lib/math/AcGePoint.d.ts.map +1 -0
- package/lib/math/AcGePoint.js +2 -0
- package/lib/math/AcGePoint.js.map +1 -0
- package/lib/math/AcGePoint2d.d.ts +17 -0
- package/lib/math/AcGePoint2d.d.ts.map +1 -0
- package/lib/math/AcGePoint2d.js +40 -0
- package/lib/math/AcGePoint2d.js.map +1 -0
- package/lib/math/AcGePoint3d.d.ts +18 -0
- package/lib/math/AcGePoint3d.d.ts.map +1 -0
- package/lib/math/AcGePoint3d.js +43 -0
- package/lib/math/AcGePoint3d.js.map +1 -0
- package/lib/math/AcGeQuaternion.d.ts +230 -0
- package/lib/math/AcGeQuaternion.d.ts.map +1 -0
- package/lib/math/AcGeQuaternion.js +666 -0
- package/lib/math/AcGeQuaternion.js.map +1 -0
- package/lib/math/AcGeVector.d.ts +9 -0
- package/lib/math/AcGeVector.d.ts.map +1 -0
- package/lib/math/AcGeVector.js +2 -0
- package/lib/math/AcGeVector.js.map +1 -0
- package/lib/math/AcGeVector2d.d.ts +361 -0
- package/lib/math/AcGeVector2d.d.ts.map +1 -0
- package/lib/math/AcGeVector2d.js +622 -0
- package/lib/math/AcGeVector2d.js.map +1 -0
- package/lib/math/AcGeVector3d.d.ts +493 -0
- package/lib/math/AcGeVector3d.d.ts.map +1 -0
- package/lib/math/AcGeVector3d.js +868 -0
- package/lib/math/AcGeVector3d.js.map +1 -0
- package/lib/math/index.d.ts +14 -0
- package/lib/math/index.d.ts.map +1 -0
- package/lib/math/index.js +14 -0
- package/lib/math/index.js.map +1 -0
- package/lib/util/AcGeConstants.d.ts +19 -0
- package/lib/util/AcGeConstants.d.ts.map +1 -0
- package/lib/util/AcGeConstants.js +25 -0
- package/lib/util/AcGeConstants.js.map +1 -0
- package/lib/util/AcGeGeometryUtil.d.ts +16 -0
- package/lib/util/AcGeGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcGeGeometryUtil.js +56 -0
- package/lib/util/AcGeGeometryUtil.js.map +1 -0
- package/lib/util/AcGeMathUtil.d.ts +203 -0
- package/lib/util/AcGeMathUtil.d.ts.map +1 -0
- package/lib/util/AcGeMathUtil.js +585 -0
- package/lib/util/AcGeMathUtil.js.map +1 -0
- package/lib/util/AcGeTol.d.ts +91 -0
- package/lib/util/AcGeTol.d.ts.map +1 -0
- package/lib/util/AcGeTol.js +83 -0
- package/lib/util/AcGeTol.js.map +1 -0
- package/lib/util/index.d.ts +5 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +5 -0
- package/lib/util/index.js.map +1 -0
- package/package.json +42 -0
@@ -0,0 +1,358 @@
|
|
1
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
2
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
3
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
4
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
5
|
+
function step(op) {
|
6
|
+
if (f) throw new TypeError("Generator is already executing.");
|
7
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
8
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
9
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
10
|
+
switch (op[0]) {
|
11
|
+
case 0: case 1: t = op; break;
|
12
|
+
case 4: _.label++; return { value: op[1], done: false };
|
13
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
14
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
15
|
+
default:
|
16
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
17
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
18
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
19
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
20
|
+
if (t[2]) _.ops.pop();
|
21
|
+
_.trys.pop(); continue;
|
22
|
+
}
|
23
|
+
op = body.call(thisArg, _);
|
24
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
25
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
26
|
+
}
|
27
|
+
};
|
28
|
+
import { clamp } from '../util';
|
29
|
+
import { AcGeMatrix3d } from './AcGeMatrix3d';
|
30
|
+
import { AcGeQuaternion } from './AcGeQuaternion';
|
31
|
+
var _matrix = /*@__PURE__*/ new AcGeMatrix3d();
|
32
|
+
var _quaternion = /*@__PURE__*/ new AcGeQuaternion();
|
33
|
+
var AcGeEuler = /** @class */ (function () {
|
34
|
+
/**
|
35
|
+
* Create one instance of this class
|
36
|
+
* @param x (optional) the angle of the x axis in radians. Default is 0.
|
37
|
+
* @param y (optional) the angle of the y axis in radians. Default is 0.
|
38
|
+
* @param z (optional) the angle of the z axis in radians. Default is 0.
|
39
|
+
* @param order (optional) a string representing the order that the rotations are applied,
|
40
|
+
* defaults to 'XYZ' (must be upper case).
|
41
|
+
*/
|
42
|
+
function AcGeEuler(x, y, z, order) {
|
43
|
+
if (x === void 0) { x = 0; }
|
44
|
+
if (y === void 0) { y = 0; }
|
45
|
+
if (z === void 0) { z = 0; }
|
46
|
+
if (order === void 0) { order = AcGeEuler.DEFAULT_ORDER; }
|
47
|
+
this._x = x;
|
48
|
+
this._y = y;
|
49
|
+
this._z = z;
|
50
|
+
this._order = order;
|
51
|
+
}
|
52
|
+
Object.defineProperty(AcGeEuler.prototype, "x", {
|
53
|
+
/**
|
54
|
+
* The current value of the x component.
|
55
|
+
*/
|
56
|
+
get: function () {
|
57
|
+
return this._x;
|
58
|
+
},
|
59
|
+
set: function (value) {
|
60
|
+
this._x = value;
|
61
|
+
this._onChangeCallback();
|
62
|
+
},
|
63
|
+
enumerable: false,
|
64
|
+
configurable: true
|
65
|
+
});
|
66
|
+
Object.defineProperty(AcGeEuler.prototype, "y", {
|
67
|
+
/**
|
68
|
+
* The current value of the y component.
|
69
|
+
*/
|
70
|
+
get: function () {
|
71
|
+
return this._y;
|
72
|
+
},
|
73
|
+
set: function (value) {
|
74
|
+
this._y = value;
|
75
|
+
this._onChangeCallback();
|
76
|
+
},
|
77
|
+
enumerable: false,
|
78
|
+
configurable: true
|
79
|
+
});
|
80
|
+
Object.defineProperty(AcGeEuler.prototype, "z", {
|
81
|
+
/**
|
82
|
+
* The current value of the z component.
|
83
|
+
*/
|
84
|
+
get: function () {
|
85
|
+
return this._z;
|
86
|
+
},
|
87
|
+
set: function (value) {
|
88
|
+
this._z = value;
|
89
|
+
this._onChangeCallback();
|
90
|
+
},
|
91
|
+
enumerable: false,
|
92
|
+
configurable: true
|
93
|
+
});
|
94
|
+
Object.defineProperty(AcGeEuler.prototype, "order", {
|
95
|
+
/**
|
96
|
+
* The order in which to apply rotations. Default is 'XYZ', which means that the object will first be
|
97
|
+
* rotated around its X axis, then its Y axis and finally its Z axis. Other possibilities are: 'YZX',
|
98
|
+
* 'ZXY', 'XZY', 'YXZ' and 'ZYX'. These must be in upper case.
|
99
|
+
*
|
100
|
+
* It uses intrinsic Tait-Bryan angles. This means that rotations are performed with respect to the
|
101
|
+
* local coordinate system. That is, for order 'XYZ', the rotation is first around the local-X axis
|
102
|
+
* (which is the same as the world-X axis), then around local-Y (which may now be different from the
|
103
|
+
* world Y-axis), then local-Z (which may be different from the world Z-axis).
|
104
|
+
*/
|
105
|
+
get: function () {
|
106
|
+
return this._order;
|
107
|
+
},
|
108
|
+
set: function (value) {
|
109
|
+
this._order = value;
|
110
|
+
this._onChangeCallback();
|
111
|
+
},
|
112
|
+
enumerable: false,
|
113
|
+
configurable: true
|
114
|
+
});
|
115
|
+
/**
|
116
|
+
* Set the angles of this euler transform and optionally the order.
|
117
|
+
* @param x (optional) the angle of the x axis in radians. Default is 0.
|
118
|
+
* @param y (optional) the angle of the y axis in radians. Default is 0.
|
119
|
+
* @param z (optional) the angle of the z axis in radians. Default is 0.
|
120
|
+
* @param order (optional) a string representing the order that the rotations are applied,
|
121
|
+
* defaults to 'XYZ' (must be upper case).
|
122
|
+
* @returns Return this euler
|
123
|
+
*/
|
124
|
+
AcGeEuler.prototype.set = function (x, y, z, order) {
|
125
|
+
if (order === void 0) { order = this._order; }
|
126
|
+
this._x = x;
|
127
|
+
this._y = y;
|
128
|
+
this._z = z;
|
129
|
+
this._order = order;
|
130
|
+
this._onChangeCallback();
|
131
|
+
return this;
|
132
|
+
};
|
133
|
+
/**
|
134
|
+
* Return a new Euler with the same parameters as this one.
|
135
|
+
* @returns Return a new Euler with the same parameters as this one.
|
136
|
+
*/
|
137
|
+
AcGeEuler.prototype.clone = function () {
|
138
|
+
return new AcGeEuler(this._x, this._y, this._z, this._order);
|
139
|
+
};
|
140
|
+
/**
|
141
|
+
* Copy value of euler to this euler.
|
142
|
+
* @param euler Input the eurler copied from
|
143
|
+
* @returns Return this euler
|
144
|
+
*/
|
145
|
+
AcGeEuler.prototype.copy = function (euler) {
|
146
|
+
this._x = euler._x;
|
147
|
+
this._y = euler._y;
|
148
|
+
this._z = euler._z;
|
149
|
+
this._order = euler._order;
|
150
|
+
this._onChangeCallback();
|
151
|
+
return this;
|
152
|
+
};
|
153
|
+
/**
|
154
|
+
* Set this euler by exatracting rotation information from the specified matrix.
|
155
|
+
* @param m Input a Matrix4 of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).
|
156
|
+
* @param order (optional) a string representing the order that the rotations are applied. Sets the
|
157
|
+
* angles of this euler transform from a pure rotation matrix based on the orientation specified by
|
158
|
+
* order.
|
159
|
+
* @param update Input one flag to indicate whether to trigger change callback function
|
160
|
+
* @returns Return this euler
|
161
|
+
*/
|
162
|
+
AcGeEuler.prototype.setFromRotationMatrix = function (m, order, update) {
|
163
|
+
if (order === void 0) { order = this._order; }
|
164
|
+
if (update === void 0) { update = true; }
|
165
|
+
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
166
|
+
var te = m.elements;
|
167
|
+
var m11 = te[0], m12 = te[4], m13 = te[8];
|
168
|
+
var m21 = te[1], m22 = te[5], m23 = te[9];
|
169
|
+
var m31 = te[2], m32 = te[6], m33 = te[10];
|
170
|
+
switch (order) {
|
171
|
+
case 'XYZ':
|
172
|
+
this._y = Math.asin(clamp(m13, -1, 1));
|
173
|
+
if (Math.abs(m13) < 0.9999999) {
|
174
|
+
this._x = Math.atan2(-m23, m33);
|
175
|
+
this._z = Math.atan2(-m12, m11);
|
176
|
+
}
|
177
|
+
else {
|
178
|
+
this._x = Math.atan2(m32, m22);
|
179
|
+
this._z = 0;
|
180
|
+
}
|
181
|
+
break;
|
182
|
+
case 'YXZ':
|
183
|
+
this._x = Math.asin(-clamp(m23, -1, 1));
|
184
|
+
if (Math.abs(m23) < 0.9999999) {
|
185
|
+
this._y = Math.atan2(m13, m33);
|
186
|
+
this._z = Math.atan2(m21, m22);
|
187
|
+
}
|
188
|
+
else {
|
189
|
+
this._y = Math.atan2(-m31, m11);
|
190
|
+
this._z = 0;
|
191
|
+
}
|
192
|
+
break;
|
193
|
+
case 'ZXY':
|
194
|
+
this._x = Math.asin(clamp(m32, -1, 1));
|
195
|
+
if (Math.abs(m32) < 0.9999999) {
|
196
|
+
this._y = Math.atan2(-m31, m33);
|
197
|
+
this._z = Math.atan2(-m12, m22);
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
this._y = 0;
|
201
|
+
this._z = Math.atan2(m21, m11);
|
202
|
+
}
|
203
|
+
break;
|
204
|
+
case 'ZYX':
|
205
|
+
this._y = Math.asin(-clamp(m31, -1, 1));
|
206
|
+
if (Math.abs(m31) < 0.9999999) {
|
207
|
+
this._x = Math.atan2(m32, m33);
|
208
|
+
this._z = Math.atan2(m21, m11);
|
209
|
+
}
|
210
|
+
else {
|
211
|
+
this._x = 0;
|
212
|
+
this._z = Math.atan2(-m12, m22);
|
213
|
+
}
|
214
|
+
break;
|
215
|
+
case 'YZX':
|
216
|
+
this._z = Math.asin(clamp(m21, -1, 1));
|
217
|
+
if (Math.abs(m21) < 0.9999999) {
|
218
|
+
this._x = Math.atan2(-m23, m22);
|
219
|
+
this._y = Math.atan2(-m31, m11);
|
220
|
+
}
|
221
|
+
else {
|
222
|
+
this._x = 0;
|
223
|
+
this._y = Math.atan2(m13, m33);
|
224
|
+
}
|
225
|
+
break;
|
226
|
+
case 'XZY':
|
227
|
+
this._z = Math.asin(-clamp(m12, -1, 1));
|
228
|
+
if (Math.abs(m12) < 0.9999999) {
|
229
|
+
this._x = Math.atan2(m32, m22);
|
230
|
+
this._y = Math.atan2(m13, m11);
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
this._x = Math.atan2(-m23, m33);
|
234
|
+
this._y = 0;
|
235
|
+
}
|
236
|
+
break;
|
237
|
+
default:
|
238
|
+
console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' +
|
239
|
+
order);
|
240
|
+
}
|
241
|
+
this._order = order;
|
242
|
+
if (update === true)
|
243
|
+
this._onChangeCallback();
|
244
|
+
return this;
|
245
|
+
};
|
246
|
+
/**
|
247
|
+
* Set this urler from the specified quaternion.
|
248
|
+
* @param q Input a normalized quaternion.
|
249
|
+
* @param order (optional) a string representing the order that the rotations are applied. Sets the
|
250
|
+
* angles of this euler transform from a pure rotation matrix based on the orientation specified by
|
251
|
+
* order.
|
252
|
+
* @param update Input one flag to indicate whether to trigger change callback function
|
253
|
+
* @returns Return this euler
|
254
|
+
*/
|
255
|
+
AcGeEuler.prototype.setFromQuaternion = function (q, order, update) {
|
256
|
+
if (update === void 0) { update = true; }
|
257
|
+
_matrix.makeRotationFromQuaternion(q);
|
258
|
+
return this.setFromRotationMatrix(_matrix, order, update);
|
259
|
+
};
|
260
|
+
/**
|
261
|
+
* Set the x, y and z, and optionally update the order.
|
262
|
+
* @param v Input one 3d vector
|
263
|
+
* @param order Input a optional string representing the order that the rotations are applied.
|
264
|
+
* @returns Return this euler
|
265
|
+
*/
|
266
|
+
AcGeEuler.prototype.setFromVector3 = function (v, order) {
|
267
|
+
if (order === void 0) { order = this._order; }
|
268
|
+
return this.set(v.x, v.y, v.z, order);
|
269
|
+
};
|
270
|
+
/**
|
271
|
+
* Resets the euler angle with a new order by creating a quaternion from this euler angle and then
|
272
|
+
* setting this euler angle with the quaternion and the new order.
|
273
|
+
* @param newOrder Input the new order that the rotations are applied.
|
274
|
+
* @returns Return this euler
|
275
|
+
*/
|
276
|
+
AcGeEuler.prototype.reorder = function (newOrder) {
|
277
|
+
// WARNING: this discards revolution information -bhouston
|
278
|
+
_quaternion.setFromEuler(this);
|
279
|
+
return this.setFromQuaternion(_quaternion, newOrder);
|
280
|
+
};
|
281
|
+
/**
|
282
|
+
* Check for strict equality of this euler and euler.
|
283
|
+
* @param euler Input the euler to compare
|
284
|
+
* @returns Return true if the specified euler and this euler represent the same rotation.
|
285
|
+
*/
|
286
|
+
AcGeEuler.prototype.equals = function (euler) {
|
287
|
+
return (euler._x === this._x &&
|
288
|
+
euler._y === this._y &&
|
289
|
+
euler._z === this._z &&
|
290
|
+
euler._order === this._order);
|
291
|
+
};
|
292
|
+
/**
|
293
|
+
* Set this euler from the specified array.
|
294
|
+
* @param array Input an array of length 3 or 4. The optional 4th argument corresponds to the order.
|
295
|
+
* - Assign this euler's x angle to array[0].
|
296
|
+
* - Assign this euler's y angle to array[1].
|
297
|
+
* - Assign this euler's z angle to array[2].
|
298
|
+
* - Optionally assign this euler's order to array[3].
|
299
|
+
* @returns
|
300
|
+
*/
|
301
|
+
AcGeEuler.prototype.fromArray = function (array) {
|
302
|
+
this._x = array[0];
|
303
|
+
this._y = array[1];
|
304
|
+
this._z = array[2];
|
305
|
+
if (array[3] !== undefined)
|
306
|
+
this._order = array[3];
|
307
|
+
this._onChangeCallback();
|
308
|
+
return this;
|
309
|
+
};
|
310
|
+
/**
|
311
|
+
* Return an array of the form [x, y, z, order ].
|
312
|
+
* @param array Input an optional array to store the euler in.
|
313
|
+
* @param offset Input an optional offset in the array.
|
314
|
+
* @returns Return an array of the form [x, y, z, order].
|
315
|
+
*/
|
316
|
+
AcGeEuler.prototype.toArray = function (array, offset) {
|
317
|
+
if (array === void 0) { array = []; }
|
318
|
+
if (offset === void 0) { offset = 0; }
|
319
|
+
array[offset] = this._x;
|
320
|
+
array[offset + 1] = this._y;
|
321
|
+
array[offset + 2] = this._z;
|
322
|
+
array[offset + 3] = this._order;
|
323
|
+
return array;
|
324
|
+
};
|
325
|
+
/**
|
326
|
+
* Trigger the specified callback function once this euler changes
|
327
|
+
* @param callback
|
328
|
+
* @returns
|
329
|
+
*/
|
330
|
+
AcGeEuler.prototype._onChange = function (callback) {
|
331
|
+
this._onChangeCallback = callback;
|
332
|
+
return this;
|
333
|
+
};
|
334
|
+
AcGeEuler.prototype._onChangeCallback = function () { };
|
335
|
+
AcGeEuler.prototype[Symbol.iterator] = function () {
|
336
|
+
return __generator(this, function (_a) {
|
337
|
+
switch (_a.label) {
|
338
|
+
case 0: return [4 /*yield*/, this._x];
|
339
|
+
case 1:
|
340
|
+
_a.sent();
|
341
|
+
return [4 /*yield*/, this._y];
|
342
|
+
case 2:
|
343
|
+
_a.sent();
|
344
|
+
return [4 /*yield*/, this._z];
|
345
|
+
case 3:
|
346
|
+
_a.sent();
|
347
|
+
return [4 /*yield*/, this._order];
|
348
|
+
case 4:
|
349
|
+
_a.sent();
|
350
|
+
return [2 /*return*/];
|
351
|
+
}
|
352
|
+
});
|
353
|
+
};
|
354
|
+
AcGeEuler.DEFAULT_ORDER = 'XYZ';
|
355
|
+
return AcGeEuler;
|
356
|
+
}());
|
357
|
+
export { AcGeEuler };
|
358
|
+
//# sourceMappingURL=AcGeEuler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeEuler.js","sourceRoot":"","sources":["../../src/math/AcGeEuler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD,IAAM,OAAO,GAAG,aAAa,CAAC,IAAI,YAAY,EAAE,CAAA;AAChD,IAAM,WAAW,GAAG,aAAa,CAAC,IAAI,cAAc,EAAE,CAAA;AAEtD;IAOE;;;;;;;OAOG;IACH,mBAAY,CAAK,EAAE,CAAK,EAAE,CAAK,EAAE,KAA+B;QAApD,kBA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2U9B,gBAAC;CAAA,AA5UD,IA4UC;SA5UY,SAAS"}
|
@@ -0,0 +1,203 @@
|
|
1
|
+
import { AcGeMatrix3d } from './AcGeMatrix3d';
|
2
|
+
import { AcGeVector2d } from './AcGeVector2d';
|
3
|
+
import { AcGeVector3d } from './AcGeVector3d';
|
4
|
+
/**
|
5
|
+
* The class representing a 3x3 matrix.
|
6
|
+
*/
|
7
|
+
export declare class AcGeMatrix2d {
|
8
|
+
/**
|
9
|
+
* Identity matrix.
|
10
|
+
*/
|
11
|
+
static IDENTITY: Readonly<AcGeMatrix2d>;
|
12
|
+
/**
|
13
|
+
* A column-major list of matrix values.
|
14
|
+
*/
|
15
|
+
elements: number[];
|
16
|
+
/**
|
17
|
+
* Create a 3x3 matrix with the given arguments in row-major order. If no arguments are provided,
|
18
|
+
* the constructor initializes the Matrix3 to the 3x3 identity matrix.
|
19
|
+
* @param n11 Input element in the first row and the first column
|
20
|
+
* @param n12 Input element in the first row and the second column
|
21
|
+
* @param n13 Input element in the first row and the third column
|
22
|
+
* @param n21 Input element in the second row and the first column
|
23
|
+
* @param n22 Input element in the second row and the second column
|
24
|
+
* @param n23 Input element in the second row and the third column
|
25
|
+
* @param n31 Input element in the third row and the first column
|
26
|
+
* @param n32 Input element in the third row and the second column
|
27
|
+
* @param n33 Input element in the third row and the third column
|
28
|
+
*/
|
29
|
+
constructor(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number);
|
30
|
+
/**
|
31
|
+
* Set the 3x3 matrix values to the given row-major sequence of values.
|
32
|
+
*
|
33
|
+
* @param n11 Input element in the first row and the first column
|
34
|
+
* @param n12 Input element in the first row and the second column
|
35
|
+
* @param n13 Input element in the first row and the third column
|
36
|
+
* @param n21 Input element in the second row and the first column
|
37
|
+
* @param n22 Input element in the second row and the second column
|
38
|
+
* @param n23 Input element in the second row and the third column
|
39
|
+
* @param n31 Input element in the third row and the first column
|
40
|
+
* @param n32 Input element in the third row and the second column
|
41
|
+
* @param n33 Input element in the third row and the third column
|
42
|
+
* @returns Return this matrix
|
43
|
+
*/
|
44
|
+
set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this;
|
45
|
+
/**
|
46
|
+
* Reset this matrix to the 3x3 identity matrix:
|
47
|
+
* @returns Return this matrix
|
48
|
+
*/
|
49
|
+
identity(): this;
|
50
|
+
/**
|
51
|
+
* Copy the elements of matrix m into this matrix.
|
52
|
+
* @param m Input one matrix copied from
|
53
|
+
* @returns Return this matrix
|
54
|
+
*/
|
55
|
+
copy(m: AcGeMatrix2d): this;
|
56
|
+
/**
|
57
|
+
* Extracts the basis of this matrix into the three axis vectors provided
|
58
|
+
* @param xAxis Input X axis vector
|
59
|
+
* @param yAxis Input Y axis vector
|
60
|
+
* @param zAxis Input Z axis vector
|
61
|
+
* @returns Return this matrix
|
62
|
+
*/
|
63
|
+
extractBasis(xAxis: AcGeVector3d, yAxis: AcGeVector3d, zAxis: AcGeVector3d): this;
|
64
|
+
/**
|
65
|
+
* Set this matrix to the upper 3x3 matrix of the Matrix4 m.
|
66
|
+
* @param m Input one 4x4 matrix
|
67
|
+
* @returns Return this matrix
|
68
|
+
*/
|
69
|
+
setFromMatrix4(m: AcGeMatrix3d): this;
|
70
|
+
/**
|
71
|
+
* Post-multiplies this matrix by m.
|
72
|
+
* @param m Input one 3x3 matrix
|
73
|
+
* @returns Return this matrix
|
74
|
+
*/
|
75
|
+
multiply(m: AcGeMatrix2d): this;
|
76
|
+
/**
|
77
|
+
* Pre-multiplies this matrix by m.
|
78
|
+
* @param m Input one 3x3 matrix
|
79
|
+
* @returns Return this matrix
|
80
|
+
*/
|
81
|
+
premultiply(m: AcGeMatrix2d): this;
|
82
|
+
/**
|
83
|
+
* Set this matrix to a x b.
|
84
|
+
* @param a Input one 3x3 matrix
|
85
|
+
* @param b Input one 3x3 matrix
|
86
|
+
* @returns Return this matrix
|
87
|
+
*/
|
88
|
+
multiplyMatrices(a: AcGeMatrix2d, b: AcGeMatrix2d): this;
|
89
|
+
/**
|
90
|
+
* Multiply every component of the matrix by the scalar value s.
|
91
|
+
* @param s Input one scalar value
|
92
|
+
* @returns Return this matrix
|
93
|
+
*/
|
94
|
+
multiplyScalar(s: number): this;
|
95
|
+
/**
|
96
|
+
* Compute and return the determinant of this matrix.
|
97
|
+
* @returns Return the determinant of this matrix
|
98
|
+
*/
|
99
|
+
determinant(): number;
|
100
|
+
/**
|
101
|
+
* Invert this matrix, using the analytic method. You can not invert with a determinant of zero.
|
102
|
+
* If you attempt this, the method produces a zero matrix instead.
|
103
|
+
* @returns Return this matrix
|
104
|
+
*/
|
105
|
+
invert(): this;
|
106
|
+
/**
|
107
|
+
* Transpose this matrix in place.
|
108
|
+
* @returns Return this matrix
|
109
|
+
*/
|
110
|
+
transpose(): this;
|
111
|
+
/**
|
112
|
+
* Sets this matrix as the upper left 3x3 of the normal matrix of the passed matrix4. The normal
|
113
|
+
* matrix is the inverse transpose of the matrix m.
|
114
|
+
* @param matrix4 Input one 4x4 matrix
|
115
|
+
* @returns Return this matrix
|
116
|
+
*/
|
117
|
+
getNormalMatrix(matrix4: AcGeMatrix3d): this;
|
118
|
+
/**
|
119
|
+
* Set this matrix as the upper left 3x3 of the normal matrix of the passed matrix4. The normal
|
120
|
+
* matrix is the inverse transpose of the matrix m.
|
121
|
+
* @param r Input one 4x4 matrix
|
122
|
+
* @returns Return this matrix
|
123
|
+
*/
|
124
|
+
transposeIntoArray(r: AcGeMatrix3d): this;
|
125
|
+
/**
|
126
|
+
* Set the UV transform matrix from offset, repeat, rotation, and center.
|
127
|
+
* @param tx Input offset x
|
128
|
+
* @param ty Input offset y
|
129
|
+
* @param sx Input repeat x
|
130
|
+
* @param sy Input repeat y
|
131
|
+
* @param rotation Input rotation, in radians. Positive values rotate counterclockwise
|
132
|
+
* @param cx Input center x of rotation
|
133
|
+
* @param cy Input center y of rotation
|
134
|
+
* @returns Return this matrix
|
135
|
+
*/
|
136
|
+
setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): this;
|
137
|
+
/**
|
138
|
+
* Scale this matrix with the given scalar values.
|
139
|
+
* @param sx Input one scalar value
|
140
|
+
* @param sy Input one scalar value
|
141
|
+
* @returns Return this matrix
|
142
|
+
*/
|
143
|
+
scale(sx: number, sy: number): this;
|
144
|
+
/**
|
145
|
+
* Rotate this matrix by the given angle (in radians).
|
146
|
+
* @param theta Input one angle in radians
|
147
|
+
* @returns Return this matrix
|
148
|
+
*/
|
149
|
+
rotate(theta: number): this;
|
150
|
+
/**
|
151
|
+
* Translate this matrix by the given scalar values.
|
152
|
+
* @param tx Input one scalar value
|
153
|
+
* @param ty Input one scalar value
|
154
|
+
* @returns Return this matrix
|
155
|
+
*/
|
156
|
+
translate(tx: number, ty: number): this;
|
157
|
+
/**
|
158
|
+
* Set this matrix as a 2D translation transform:
|
159
|
+
* @param x Input one 2d vector or one number
|
160
|
+
* @param y Input one number
|
161
|
+
* @returns Return this matrix
|
162
|
+
*/
|
163
|
+
makeTranslation(x: number | AcGeVector2d, y: number): this;
|
164
|
+
/**
|
165
|
+
* Set this matrix as a 2D rotational transformation by theta radians
|
166
|
+
* @param theta Input rotation angle in radians. Positive values rotate counterclockwise.
|
167
|
+
* @returns Return this matrix
|
168
|
+
*/
|
169
|
+
makeRotation(theta: number): this;
|
170
|
+
/**
|
171
|
+
* Set this matrix as a 2D scale transform
|
172
|
+
* @param x Input the amount to scale in the X axis.
|
173
|
+
* @param y Input the amount to scale in the Y axis.
|
174
|
+
* @returns Return this matrix
|
175
|
+
*/
|
176
|
+
makeScale(x: number, y: number): this;
|
177
|
+
/**
|
178
|
+
* Return true if this matrix and m are equal.
|
179
|
+
* @param matrix Input one matrix to compare
|
180
|
+
* @returns Return true if this matrix and m are equal.
|
181
|
+
*/
|
182
|
+
equals(matrix: AcGeMatrix2d): boolean;
|
183
|
+
/**
|
184
|
+
* Set the elements of this matrix based on an array in column-major format.
|
185
|
+
* @param array Input the array to read the elements from.
|
186
|
+
* @param offset Input (optional) index of first element in the array. Default is 0.
|
187
|
+
* @returns Return this matrix
|
188
|
+
*/
|
189
|
+
fromArray(array: number[], offset?: number): this;
|
190
|
+
/**
|
191
|
+
* Write the elements of this matrix to an array in column-major format.
|
192
|
+
* @param array Input (optional) array to store the resulting vector in. If not given a new array will be created.
|
193
|
+
* @param offset Input (optional) offset in the array at which to put the result.
|
194
|
+
* @returns Return this matrix
|
195
|
+
*/
|
196
|
+
toArray(array?: number[], offset?: number): number[];
|
197
|
+
/**
|
198
|
+
* Creates a new 3x3 matrix and with identical elements to this one.
|
199
|
+
* @returns Return the cloned matrix
|
200
|
+
*/
|
201
|
+
clone(): AcGeMatrix2d;
|
202
|
+
}
|
203
|
+
//# sourceMappingURL=AcGeMatrix2d.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AcGeMatrix2d.d.ts","sourceRoot":"","sources":["../../src/math/AcGeMatrix2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;GAEG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,QAAQ,yBAAoC;IACnD;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAElB;;;;;;;;;;;;OAYG;gBAED,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM;IAmBd;;;;;;;;;;;;;OAaG;IACH,GA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