x_ite 8.6.0 → 8.6.2
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/.vscode/settings.json +7 -7
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +25 -25
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +18 -18
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +27 -27
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +24 -24
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +23 -23
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +19 -19
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +18 -18
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +28 -28
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +39 -48
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +32 -32
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +19 -19
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +690 -936
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_includes/scripts.html +2 -2
- package/docs/_posts/components/CADGeometry/IndexedQuadSet.md +1 -1
- package/docs/_posts/components/CADGeometry/QuadSet.md +1 -1
- package/docs/_posts/components/Geometry3D/ElevationGrid.md +1 -1
- package/docs/_posts/components/Geometry3D/Extrusion.md +1 -1
- package/docs/_posts/components/Geometry3D/IndexedFaceSet.md +1 -1
- package/docs/_posts/components/Geospatial/GeoElevationGrid.md +1 -1
- package/docs/_posts/components/NURBS/NurbsSweptSurface.md +1 -1
- package/docs/_posts/components/NURBS/NurbsSwungSurface.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleFanSet.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleSet.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleStripSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleFanSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleStripSet.md +1 -1
- package/docs/_posts/components/Shape/Material.md +1 -1
- package/docs/_posts/getting-started.md +1 -1
- package/docs/_posts/laboratory/x3d-file-converter.md +178 -0
- package/docs/_tabs/playground.html +80 -133
- package/docs/assets/css/style.scss +2 -42
- package/docs/laboratory/3d-l-system-generator.html +1 -1
- package/docs/laboratory/gltf-sample-viewer.html +1 -1
- package/docs/laboratory/online-dicom-and-nrrd-file-viewer.html +1 -1
- package/docs/laboratory/real-time-earth-quake-information.html +1 -1
- package/docs/laboratory/x3d-visual-blend-mode-editor.html +1 -1
- package/package.json +1 -1
- package/src/standard/Math/Algorithms/Bezier.js +133 -182
- package/src/standard/Math/Geometry/Box2.js +0 -1
- package/src/standard/Math/Geometry/Box3.js +0 -1
- package/src/standard/Math/Geometry/Cylinder3.js +1 -1
- package/src/standard/Math/Geometry/Line2.js +2 -4
- package/src/standard/Math/Geometry/Line3.js +2 -4
- package/src/standard/Math/Geometry/Plane3.js +1 -3
- package/src/standard/Math/Geometry/Sphere3.js +8 -12
- package/src/standard/Math/Geometry/Triangle3.js +8 -0
- package/src/standard/Math/Geometry/ViewVolume.js +17 -27
- package/src/standard/Math/Numbers/Color3.js +4 -7
- package/src/standard/Math/Numbers/Complex.js +8 -9
- package/src/standard/Math/Numbers/Matrix2.js +31 -42
- package/src/standard/Math/Numbers/Matrix3.js +54 -97
- package/src/standard/Math/Numbers/Matrix4.js +49 -160
- package/src/standard/Math/Numbers/Quaternion.js +20 -24
- package/src/standard/Math/Numbers/Rotation4.js +1 -2
- package/src/standard/Math/Numbers/Vector2.js +4 -12
- package/src/standard/Math/Numbers/Vector3.js +6 -18
- package/src/standard/Math/Numbers/Vector4.js +4 -20
- package/src/standard/Time/StopWatch.js +9 -14
- package/src/tests.js +11 -0
- package/src/x_ite/Browser/Core/BrowserTimings.js +10 -10
- package/src/x_ite/Browser/Core/X3DCoreContext.js +4 -6
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +94 -88
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +2 -3
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +17 -14
- package/src/x_ite/Browser/Text/PolygonText.js +15 -24
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Components/Core/X3DNode.js +12 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +18 -0
- package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +8 -7
- package/src/x_ite/Configuration/UnitInfo.js +2 -0
- package/src/x_ite/Execution/X3DExportedNode.js +4 -0
- package/src/x_ite/Execution/X3DImportedNode.js +14 -0
- package/src/x_ite/Execution/X3DScene.js +4 -0
- package/src/x_ite/Fields/SFString.js +4 -6
- package/src/x_ite/InputOutput/FileLoader.js +1 -1
- package/src/x_ite/InputOutput/Generator.js +35 -55
- package/src/x_ite/Parser/GLTF2Parser.js +4 -4
- package/src/x_ite/Parser/SVGParser.js +24 -47
- package/src/x_ite/Parser/X3DParser.js +1 -1
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +4 -0
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +4 -0
- package/src/x_ite/Routing/X3DRoute.js +8 -0
|
@@ -128,17 +128,7 @@ ViewVolume .prototype =
|
|
|
128
128
|
this .viewport .assign (viewport);
|
|
129
129
|
this .scissor .assign (scissor);
|
|
130
130
|
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
p0 = points [0],
|
|
135
|
-
p1 = points [1],
|
|
136
|
-
p2 = points [2],
|
|
137
|
-
p3 = points [3],
|
|
138
|
-
p4 = points [4],
|
|
139
|
-
p5 = points [5],
|
|
140
|
-
p6 = points [6],
|
|
141
|
-
p7 = points [7];
|
|
131
|
+
const [p0, p1 ,p2, p3, p4, p5, p6, p7] = this .points;
|
|
142
132
|
|
|
143
133
|
const
|
|
144
134
|
x1 = scissor [0],
|
|
@@ -196,17 +186,17 @@ ViewVolume .prototype =
|
|
|
196
186
|
|
|
197
187
|
if (edges .tainted)
|
|
198
188
|
{
|
|
199
|
-
const
|
|
189
|
+
const [p0, p1 ,p2, p3, p4, p5, p6, p7] = this .points;
|
|
200
190
|
|
|
201
|
-
edges [0] .assign (
|
|
202
|
-
edges [1] .assign (
|
|
203
|
-
edges [2] .assign (
|
|
204
|
-
edges [3] .assign (
|
|
191
|
+
edges [0] .assign (p0) .subtract (p1);
|
|
192
|
+
edges [1] .assign (p1) .subtract (p2);
|
|
193
|
+
edges [2] .assign (p2) .subtract (p3);
|
|
194
|
+
edges [3] .assign (p3) .subtract (p0);
|
|
205
195
|
|
|
206
|
-
edges [4] .assign (
|
|
207
|
-
edges [5] .assign (
|
|
208
|
-
edges [6] .assign (
|
|
209
|
-
edges [7] .assign (
|
|
196
|
+
edges [4] .assign (p0) .subtract (p4);
|
|
197
|
+
edges [5] .assign (p1) .subtract (p5);
|
|
198
|
+
edges [6] .assign (p2) .subtract (p6);
|
|
199
|
+
edges [7] .assign (p3) .subtract (p7);
|
|
210
200
|
|
|
211
201
|
// Edges 8 - 11 are equal to edges 0 - 3.
|
|
212
202
|
|
|
@@ -217,24 +207,24 @@ ViewVolume .prototype =
|
|
|
217
207
|
},
|
|
218
208
|
intersectsSphere: function (radius, center)
|
|
219
209
|
{
|
|
220
|
-
const
|
|
210
|
+
const [p0, p1 ,p2, p3, p4, p5, p6, p7] = this .planes;
|
|
221
211
|
|
|
222
|
-
if (
|
|
212
|
+
if (p0 .getDistanceToPoint (center) > radius)
|
|
223
213
|
return false;
|
|
224
214
|
|
|
225
|
-
if (
|
|
215
|
+
if (p1 .getDistanceToPoint (center) > radius)
|
|
226
216
|
return false;
|
|
227
217
|
|
|
228
|
-
if (
|
|
218
|
+
if (p2 .getDistanceToPoint (center) > radius)
|
|
229
219
|
return false;
|
|
230
220
|
|
|
231
|
-
if (
|
|
221
|
+
if (p3 .getDistanceToPoint (center) > radius)
|
|
232
222
|
return false;
|
|
233
223
|
|
|
234
|
-
if (
|
|
224
|
+
if (p4 .getDistanceToPoint (center) > radius)
|
|
235
225
|
return false;
|
|
236
226
|
|
|
237
|
-
if (
|
|
227
|
+
if (p5 .getDistanceToPoint (center) > radius)
|
|
238
228
|
return false;
|
|
239
229
|
|
|
240
230
|
return true;
|
|
@@ -175,7 +175,7 @@ Color3 .prototype =
|
|
|
175
175
|
default: this [_r] = v; this [_g] = p; this [_b] = q; break;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
|
|
179
179
|
return this;
|
|
180
180
|
},
|
|
181
181
|
toString: function ()
|
|
@@ -231,15 +231,12 @@ Object .assign (Color3,
|
|
|
231
231
|
},
|
|
232
232
|
lerp: function (a, b, t, r)
|
|
233
233
|
{
|
|
234
|
-
//
|
|
234
|
+
// Linearly interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.
|
|
235
235
|
// Source and destination color must be in HSV space. The resulting HSV color is stored in @a r.
|
|
236
236
|
|
|
237
237
|
let
|
|
238
|
-
ha
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
sa = a [1], sb = b [1],
|
|
242
|
-
va = a [2], vb = b [2];
|
|
238
|
+
[ha, sa, va] = a,
|
|
239
|
+
[hb, sb, vb] = b;
|
|
243
240
|
|
|
244
241
|
if (sa === 0)
|
|
245
242
|
ha = hb;
|
|
@@ -120,14 +120,14 @@ Complex .prototype =
|
|
|
120
120
|
this .imag *= value;
|
|
121
121
|
return this;
|
|
122
122
|
},
|
|
123
|
-
multComp: function ()
|
|
123
|
+
multComp: function (value)
|
|
124
124
|
{
|
|
125
125
|
const
|
|
126
|
-
real = this
|
|
127
|
-
imag =
|
|
126
|
+
{ real: ar, imag: ai } = this,
|
|
127
|
+
{ real: br, imag: bi } = value;
|
|
128
128
|
|
|
129
|
-
this .real =
|
|
130
|
-
this .imag =
|
|
129
|
+
this .real = ar * br - ai * bi;
|
|
130
|
+
this .imag = ar * bi + ai * br;
|
|
131
131
|
return this;
|
|
132
132
|
},
|
|
133
133
|
//divide: function (value)
|
|
@@ -137,10 +137,9 @@ Complex .prototype =
|
|
|
137
137
|
divComp: function (value)
|
|
138
138
|
{
|
|
139
139
|
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const d = br * br + bi * bi;
|
|
140
|
+
{ real: ar, imag: ai } = this,
|
|
141
|
+
{ real: br, imag: bi } = value,
|
|
142
|
+
d = br * br + bi * bi;
|
|
144
143
|
|
|
145
144
|
this .real = (ar * br + ai * bi) / d;
|
|
146
145
|
this .imag = (ai * br - ar * bi) / d;
|
|
@@ -52,10 +52,8 @@ function Matrix2 ()
|
|
|
52
52
|
{
|
|
53
53
|
if (arguments .length)
|
|
54
54
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this [2] = arguments [2];
|
|
58
|
-
this [3] = arguments [3];
|
|
55
|
+
for (let i = 0; i < 4; ++ i)
|
|
56
|
+
this [i] = arguments [i];
|
|
59
57
|
}
|
|
60
58
|
else
|
|
61
59
|
{
|
|
@@ -78,18 +76,17 @@ Matrix2 .prototype =
|
|
|
78
76
|
copy: function ()
|
|
79
77
|
{
|
|
80
78
|
const copy = Object .create (Matrix2 .prototype);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
|
|
80
|
+
for (let i = 0; i < 4; ++ i)
|
|
81
|
+
copy [i] = this [i];
|
|
82
|
+
|
|
85
83
|
return copy;
|
|
86
84
|
},
|
|
87
85
|
assign: function (matrix)
|
|
88
86
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this [3] = matrix [3];
|
|
87
|
+
for (let i = 0; i < 4; ++ i)
|
|
88
|
+
this [i] = matrix [i];
|
|
89
|
+
|
|
93
90
|
return this;
|
|
94
91
|
},
|
|
95
92
|
equals: function (matrix)
|
|
@@ -118,10 +115,9 @@ Matrix2 .prototype =
|
|
|
118
115
|
}
|
|
119
116
|
case 4:
|
|
120
117
|
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this [3] = arguments [3];
|
|
118
|
+
for (let i = 0; i < 4; ++ i)
|
|
119
|
+
this [i] = arguments [i];
|
|
120
|
+
|
|
125
121
|
break;
|
|
126
122
|
}
|
|
127
123
|
}
|
|
@@ -149,10 +145,7 @@ Matrix2 .prototype =
|
|
|
149
145
|
inverse: function ()
|
|
150
146
|
{
|
|
151
147
|
const
|
|
152
|
-
A = this [
|
|
153
|
-
B = this [1],
|
|
154
|
-
C = this [2],
|
|
155
|
-
D = this [3],
|
|
148
|
+
{ 0: A, 1: B, 2: C, 3: D } = this [3],
|
|
156
149
|
d = A * D - B * C;
|
|
157
150
|
|
|
158
151
|
// if (d === 0) ... determinant is zero.
|
|
@@ -167,10 +160,8 @@ Matrix2 .prototype =
|
|
|
167
160
|
multLeft: function (matrix)
|
|
168
161
|
{
|
|
169
162
|
const
|
|
170
|
-
a0
|
|
171
|
-
|
|
172
|
-
b0 = matrix [0], b1 = matrix [1],
|
|
173
|
-
b2 = matrix [2], b3 = matrix [3];
|
|
163
|
+
{ 0: a0, 1: a1, 2: a2, 3: a3 } = this,
|
|
164
|
+
{ 0: b0, 1: b1, 2: b2, 3: b3 } = matrix;
|
|
174
165
|
|
|
175
166
|
this [0] = a0 * b0 + a2 * b1;
|
|
176
167
|
this [1] = a1 * b0 + a3 * b1;
|
|
@@ -182,10 +173,8 @@ Matrix2 .prototype =
|
|
|
182
173
|
multRight: function (matrix)
|
|
183
174
|
{
|
|
184
175
|
const
|
|
185
|
-
a0
|
|
186
|
-
|
|
187
|
-
b0 = matrix [0], b1 = matrix [1],
|
|
188
|
-
b2 = matrix [2], b3 = matrix [3];
|
|
176
|
+
{ 0: a0, 1: a1, 2: a2, 3: a3 } = this,
|
|
177
|
+
{ 0: b0, 1: b1, 2: b2, 3: b3 } = matrix;
|
|
189
178
|
|
|
190
179
|
this [0] = b0 * a0 + b2 * a1;
|
|
191
180
|
this [1] = b1 * a0 + b3 * a1;
|
|
@@ -204,15 +193,15 @@ Matrix2 .prototype =
|
|
|
204
193
|
|
|
205
194
|
return (x * this [0] + this [1]) / w;
|
|
206
195
|
}
|
|
196
|
+
else
|
|
197
|
+
{
|
|
198
|
+
const { x, y } = vector;
|
|
207
199
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
y = vector .y;
|
|
211
|
-
|
|
212
|
-
vector .x = x * this [0] + y * this [2];
|
|
213
|
-
vector .y = x * this [1] + y * this [3];
|
|
200
|
+
vector .x = x * this [0] + y * this [2];
|
|
201
|
+
vector .y = x * this [1] + y * this [3];
|
|
214
202
|
|
|
215
|
-
|
|
203
|
+
return vector;
|
|
204
|
+
}
|
|
216
205
|
},
|
|
217
206
|
multMatrixVec: function (vector)
|
|
218
207
|
{
|
|
@@ -224,15 +213,15 @@ Matrix2 .prototype =
|
|
|
224
213
|
|
|
225
214
|
return (x * this [0] + this [1]) / w;
|
|
226
215
|
}
|
|
216
|
+
else
|
|
217
|
+
{
|
|
218
|
+
const { x, y } = vector;
|
|
227
219
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
y = vector .y;
|
|
231
|
-
|
|
232
|
-
vector .x = x * this [0] + y * this [1];
|
|
233
|
-
vector .y = x * this [2] + y * this [3];
|
|
220
|
+
vector .x = x * this [0] + y * this [1];
|
|
221
|
+
vector .y = x * this [2] + y * this [3];
|
|
234
222
|
|
|
235
|
-
|
|
223
|
+
return vector;
|
|
224
|
+
}
|
|
236
225
|
},
|
|
237
226
|
identity: function ()
|
|
238
227
|
{
|
|
@@ -54,15 +54,8 @@ function Matrix3 ()
|
|
|
54
54
|
{
|
|
55
55
|
if (arguments .length)
|
|
56
56
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this [2] = arguments [2];
|
|
60
|
-
this [3] = arguments [3];
|
|
61
|
-
this [4] = arguments [4];
|
|
62
|
-
this [5] = arguments [5];
|
|
63
|
-
this [6] = arguments [6];
|
|
64
|
-
this [7] = arguments [7];
|
|
65
|
-
this [8] = arguments [8];
|
|
57
|
+
for (let i = 0; i < 9; ++ i)
|
|
58
|
+
this [i] = arguments [i];
|
|
66
59
|
}
|
|
67
60
|
else
|
|
68
61
|
{
|
|
@@ -85,28 +78,17 @@ Matrix3 .prototype =
|
|
|
85
78
|
copy: function ()
|
|
86
79
|
{
|
|
87
80
|
const copy = Object .create (Matrix3 .prototype);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
copy [4] = this [4];
|
|
93
|
-
copy [5] = this [5];
|
|
94
|
-
copy [6] = this [6];
|
|
95
|
-
copy [7] = this [7];
|
|
96
|
-
copy [8] = this [8];
|
|
81
|
+
|
|
82
|
+
for (let i = 0; i < 9; ++ i)
|
|
83
|
+
copy [i] = this [i];
|
|
84
|
+
|
|
97
85
|
return copy;
|
|
98
86
|
},
|
|
99
87
|
assign: function (matrix)
|
|
100
88
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this [3] = matrix [3];
|
|
105
|
-
this [4] = matrix [4];
|
|
106
|
-
this [5] = matrix [5];
|
|
107
|
-
this [6] = matrix [6];
|
|
108
|
-
this [7] = matrix [7];
|
|
109
|
-
this [8] = matrix [8];
|
|
89
|
+
for (let i = 0; i < 9; ++ i)
|
|
90
|
+
this [i] = matrix [i];
|
|
91
|
+
|
|
110
92
|
return this;
|
|
111
93
|
},
|
|
112
94
|
equals: function (matrix)
|
|
@@ -254,15 +236,9 @@ Matrix3 .prototype =
|
|
|
254
236
|
}
|
|
255
237
|
case 9:
|
|
256
238
|
{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this [3] = arguments [3];
|
|
261
|
-
this [4] = arguments [4];
|
|
262
|
-
this [5] = arguments [5];
|
|
263
|
-
this [6] = arguments [6];
|
|
264
|
-
this [7] = arguments [7];
|
|
265
|
-
this [8] = arguments [8];
|
|
239
|
+
for (let i = 0; i < 9; ++ i)
|
|
240
|
+
this [i] = arguments [i];
|
|
241
|
+
|
|
266
242
|
break;
|
|
267
243
|
}
|
|
268
244
|
}
|
|
@@ -388,10 +364,7 @@ Matrix3 .prototype =
|
|
|
388
364
|
},
|
|
389
365
|
determinant: function ()
|
|
390
366
|
{
|
|
391
|
-
const
|
|
392
|
-
m0 = this [0], m1 = this [1], m2 = this [2],
|
|
393
|
-
m3 = this [3], m4 = this [4], m5 = this [5],
|
|
394
|
-
m6 = this [6], m7 = this [7], m8 = this [8];
|
|
367
|
+
const { 0: m0, 1: m1, 2: m2, 3: m3, 4: m4, 5: m5, 6: m6, 7: m7, 8: m8 } = this;
|
|
395
368
|
|
|
396
369
|
return m0 * (m4 * m8 - m5 * m7) -
|
|
397
370
|
m1 * (m3 * m8 - m5 * m6) +
|
|
@@ -410,15 +383,7 @@ Matrix3 .prototype =
|
|
|
410
383
|
inverse: function ()
|
|
411
384
|
{
|
|
412
385
|
const
|
|
413
|
-
m0
|
|
414
|
-
m1 = this [1],
|
|
415
|
-
m2 = this [2],
|
|
416
|
-
m3 = this [3],
|
|
417
|
-
m4 = this [4],
|
|
418
|
-
m5 = this [5],
|
|
419
|
-
m6 = this [6],
|
|
420
|
-
m7 = this [7],
|
|
421
|
-
m8 = this [8],
|
|
386
|
+
{ 0: m0, 1: m1, 2: m2, 3: m3, 4: m4, 5: m5, 6: m6, 7: m7, 8: m8 } = this,
|
|
422
387
|
t4 = m0 * m4,
|
|
423
388
|
t6 = m0 * m7,
|
|
424
389
|
t8 = m3 * m1,
|
|
@@ -455,12 +420,8 @@ Matrix3 .prototype =
|
|
|
455
420
|
multLeft: function (matrix)
|
|
456
421
|
{
|
|
457
422
|
const
|
|
458
|
-
a0
|
|
459
|
-
|
|
460
|
-
a6 = this [6], a7 = this [7], a8 = this [8],
|
|
461
|
-
b0 = matrix [0], b1 = matrix [1], b2 = matrix [2],
|
|
462
|
-
b3 = matrix [3], b4 = matrix [4], b5 = matrix [5],
|
|
463
|
-
b6 = matrix [6], b7 = matrix [7], b8 = matrix [8];
|
|
423
|
+
{ 0: a0, 1: a1, 2: a2, 3: a3, 4: a4, 5: a5, 6: a6, 7: a7, 8: a8 } = this,
|
|
424
|
+
{ 0: b0, 1: b1, 2: b2, 3: b3, 4: b4, 5: b5, 6: b6, 7: b7, 8: b8 } = matrix;
|
|
464
425
|
|
|
465
426
|
this [0] = a0 * b0 + a3 * b1 + a6 * b2;
|
|
466
427
|
this [1] = a1 * b0 + a4 * b1 + a7 * b2;
|
|
@@ -477,12 +438,8 @@ Matrix3 .prototype =
|
|
|
477
438
|
multRight: function (matrix)
|
|
478
439
|
{
|
|
479
440
|
const
|
|
480
|
-
a0
|
|
481
|
-
|
|
482
|
-
a6 = this [6], a7 = this [7], a8 = this [8],
|
|
483
|
-
b0 = matrix [0], b1 = matrix [1], b2 = matrix [2],
|
|
484
|
-
b3 = matrix [3], b4 = matrix [4], b5 = matrix [5],
|
|
485
|
-
b6 = matrix [6], b7 = matrix [7], b8 = matrix [8];
|
|
441
|
+
{ 0: a0, 1: a1, 2: a2, 3: a3, 4: a4, 5: a5, 6: a6, 7: a7, 8: a8 } = this,
|
|
442
|
+
{ 0: b0, 1: b1, 2: b2, 3: b3, 4: b4, 5: b5, 6: b6, 7: b7, 8: b8 } = matrix;
|
|
486
443
|
|
|
487
444
|
this [0] = a0 * b0 + a1 * b3 + a2 * b6;
|
|
488
445
|
this [1] = a0 * b1 + a1 * b4 + a2 * b7;
|
|
@@ -501,8 +458,7 @@ Matrix3 .prototype =
|
|
|
501
458
|
if (vector .length === 2)
|
|
502
459
|
{
|
|
503
460
|
const
|
|
504
|
-
x = vector
|
|
505
|
-
y = vector .y,
|
|
461
|
+
{ x, y } = vector,
|
|
506
462
|
w = x * this [2] + y * this [5] + this [8];
|
|
507
463
|
|
|
508
464
|
vector .x = (x * this [0] + y * this [3] + this [6]) / w;
|
|
@@ -510,25 +466,23 @@ Matrix3 .prototype =
|
|
|
510
466
|
|
|
511
467
|
return vector;
|
|
512
468
|
}
|
|
469
|
+
else
|
|
470
|
+
{
|
|
471
|
+
const { x, y, z } = vector;
|
|
513
472
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
z = vector .z;
|
|
518
|
-
|
|
519
|
-
vector .x = x * this [0] + y * this [3] + z * this [6];
|
|
520
|
-
vector .y = x * this [1] + y * this [4] + z * this [7];
|
|
521
|
-
vector .z = x * this [2] + y * this [5] + z * this [8];
|
|
473
|
+
vector .x = x * this [0] + y * this [3] + z * this [6];
|
|
474
|
+
vector .y = x * this [1] + y * this [4] + z * this [7];
|
|
475
|
+
vector .z = x * this [2] + y * this [5] + z * this [8];
|
|
522
476
|
|
|
523
|
-
|
|
477
|
+
return vector;
|
|
478
|
+
}
|
|
524
479
|
},
|
|
525
480
|
multMatrixVec: function (vector)
|
|
526
481
|
{
|
|
527
482
|
if (vector .length === 2)
|
|
528
483
|
{
|
|
529
484
|
const
|
|
530
|
-
x = vector
|
|
531
|
-
y = vector .y,
|
|
485
|
+
{ x, y } = vector,
|
|
532
486
|
w = x * this [6] + y * this [7] + this [8];
|
|
533
487
|
|
|
534
488
|
vector .x = (x * this [0] + y * this [1] + this [2]) / w;
|
|
@@ -536,23 +490,20 @@ Matrix3 .prototype =
|
|
|
536
490
|
|
|
537
491
|
return vector;
|
|
538
492
|
}
|
|
493
|
+
else
|
|
494
|
+
{
|
|
495
|
+
const { x, y, z } = vector;
|
|
539
496
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
z = vector .z;
|
|
544
|
-
|
|
545
|
-
vector .x = x * this [0] + y * this [1] + z * this [2];
|
|
546
|
-
vector .y = x * this [3] + y * this [4] + z * this [5];
|
|
547
|
-
vector .z = x * this [6] + y * this [7] + z * this [8];
|
|
497
|
+
vector .x = x * this [0] + y * this [1] + z * this [2];
|
|
498
|
+
vector .y = x * this [3] + y * this [4] + z * this [5];
|
|
499
|
+
vector .z = x * this [6] + y * this [7] + z * this [8];
|
|
548
500
|
|
|
549
|
-
|
|
501
|
+
return vector;
|
|
502
|
+
}
|
|
550
503
|
},
|
|
551
504
|
multDirMatrix: function (vector)
|
|
552
505
|
{
|
|
553
|
-
const
|
|
554
|
-
x = vector .x,
|
|
555
|
-
y = vector .y;
|
|
506
|
+
const { x, y } = vector;
|
|
556
507
|
|
|
557
508
|
vector .x = x * this [0] + y * this [3];
|
|
558
509
|
vector .y = x * this [1] + y * this [4];
|
|
@@ -561,9 +512,7 @@ Matrix3 .prototype =
|
|
|
561
512
|
},
|
|
562
513
|
multMatrixDir: function (vector)
|
|
563
514
|
{
|
|
564
|
-
const
|
|
565
|
-
x = vector .x,
|
|
566
|
-
y = vector .y;
|
|
515
|
+
const { x, y } = vector;
|
|
567
516
|
|
|
568
517
|
vector .x = x * this [0] + y * this [1];
|
|
569
518
|
vector .y = x * this [3] + y * this [4];
|
|
@@ -580,9 +529,7 @@ Matrix3 .prototype =
|
|
|
580
529
|
},
|
|
581
530
|
translate: function (translation)
|
|
582
531
|
{
|
|
583
|
-
const
|
|
584
|
-
x = translation .x,
|
|
585
|
-
y = translation .y;
|
|
532
|
+
const { x, y } = translation;
|
|
586
533
|
|
|
587
534
|
this [6] += this [0] * x + this [3] * y;
|
|
588
535
|
this [7] += this [1] * x + this [4] * y;
|
|
@@ -595,9 +542,7 @@ Matrix3 .prototype =
|
|
|
595
542
|
},
|
|
596
543
|
scale: function (scale)
|
|
597
544
|
{
|
|
598
|
-
const
|
|
599
|
-
x = scale .x,
|
|
600
|
-
y = scale .y;
|
|
545
|
+
const { x, y } = scale;
|
|
601
546
|
|
|
602
547
|
this [0] *= x;
|
|
603
548
|
this [3] *= y;
|
|
@@ -609,11 +554,23 @@ Matrix3 .prototype =
|
|
|
609
554
|
},
|
|
610
555
|
skewX: function (angle)
|
|
611
556
|
{
|
|
612
|
-
|
|
557
|
+
const a = Math .tan (angle);
|
|
558
|
+
|
|
559
|
+
this [3] += this [0] * a;
|
|
560
|
+
this [4] += this [1] * a;
|
|
561
|
+
this [5] += this [2] * a;
|
|
562
|
+
|
|
563
|
+
return this;
|
|
613
564
|
},
|
|
614
565
|
skewY: function (angle)
|
|
615
566
|
{
|
|
616
|
-
|
|
567
|
+
const a = Math .tan (angle);
|
|
568
|
+
|
|
569
|
+
this [0] += this [3] * a;
|
|
570
|
+
this [1] += this [4] * a;
|
|
571
|
+
this [2] += this [5] * a;
|
|
572
|
+
|
|
573
|
+
return this;
|
|
617
574
|
},
|
|
618
575
|
toString: function ()
|
|
619
576
|
{
|