@threepipe/plugin-svg-renderer 0.2.4 → 0.2.6
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/CHANGELOG.md +10 -1
- package/dist/BasicSVGRendererPlugin.d.ts +1 -1
- package/dist/ThreeSVGRendererPlugin.d.ts +1 -1
- package/dist/dependencies.txt +15 -15
- package/dist/index.d.ts +5 -5
- package/dist/index.js +618 -665
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +741 -788
- package/dist/index.mjs.map +1 -1
- package/dist/three-mesh-halfedge/core/Face.d.ts +3 -3
- package/dist/three-mesh-halfedge/core/Halfedge.d.ts +3 -3
- package/dist/three-mesh-halfedge/core/HalfedgeDS.d.ts +4 -4
- package/dist/three-mesh-halfedge/core/Vertex.d.ts +3 -3
- package/dist/three-mesh-halfedge/index.d.ts +4 -4
- package/dist/three-mesh-halfedge/operations/addEdge.d.ts +3 -3
- package/dist/three-mesh-halfedge/operations/addFace.d.ts +3 -3
- package/dist/three-mesh-halfedge/operations/addVertex.d.ts +3 -3
- package/dist/three-mesh-halfedge/operations/cutFace.d.ts +4 -4
- package/dist/three-mesh-halfedge/operations/removeEdge.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/removeFace.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/removeVertex.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/setFromGeometry.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/splitEdge.d.ts +4 -4
- package/dist/three-mesh-halfedge/utils/geometry.d.ts +1 -1
- package/dist/three-svg-renderer/SVGRenderer.d.ts +3 -3
- package/dist/three-svg-renderer/core/SVGMesh.d.ts +5 -5
- package/dist/three-svg-renderer/core/index.d.ts +3 -3
- package/dist/three-svg-renderer/core/svg/SVGDrawHandler.d.ts +3 -3
- package/dist/three-svg-renderer/core/svg/index.d.ts +2 -2
- package/dist/three-svg-renderer/core/svg/passes/ChainPass.d.ts +3 -3
- package/dist/three-svg-renderer/core/svg/passes/DrawPass.d.ts +1 -1
- package/dist/three-svg-renderer/core/svg/passes/FillPass.d.ts +2 -2
- package/dist/three-svg-renderer/core/svg/passes/SingularityPointPass.d.ts +2 -2
- package/dist/three-svg-renderer/core/svg/passes/index.d.ts +4 -4
- package/dist/three-svg-renderer/core/svg/svgutils.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/Chain.d.ts +5 -5
- package/dist/three-svg-renderer/core/viewmap/Polygon.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/ViewEdge.d.ts +4 -4
- package/dist/three-svg-renderer/core/viewmap/ViewVertex.d.ts +3 -3
- package/dist/three-svg-renderer/core/viewmap/Viewmap.d.ts +10 -10
- package/dist/three-svg-renderer/core/viewmap/index.d.ts +5 -5
- package/dist/three-svg-renderer/core/viewmap/operations/assignPolygons.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/operations/computeChainsVisibility.d.ts +3 -3
- package/dist/three-svg-renderer/core/viewmap/operations/computeMeshIntersections.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/operations/computePolygons.d.ts +1 -5
- package/dist/three-svg-renderer/core/viewmap/operations/computePolygons.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/viewmap/operations/createChains.d.ts +4 -4
- package/dist/three-svg-renderer/core/viewmap/operations/createViewVertex.d.ts +3 -3
- package/dist/three-svg-renderer/core/viewmap/operations/find2dSingularities.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/operations/find3dSingularities.d.ts +5 -5
- package/dist/three-svg-renderer/core/viewmap/operations/meshIntersectionCb.d.ts +3 -3
- package/dist/three-svg-renderer/core/viewmap/operations/setupEdges.d.ts +4 -4
- package/dist/three-svg-renderer/core/viewmap/operations/splitEdge.d.ts +4 -4
- package/dist/three-svg-renderer/index.d.ts +3 -3
- package/dist/three-svg-renderer/utils/buffergeometry.d.ts +2 -2
- package/dist/three-svg-renderer/utils/geometry.d.ts +1 -1
- package/dist/three-svg-renderer/utils/index.d.ts +3 -3
- package/dist/three-svg-renderer/utils/orientationtests.d.ts +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +3 -3
- package/docs/classes/BasicSVGRenderer.html +2 -2
- package/docs/classes/BasicSVGRendererPlugin.html +5 -4
- package/docs/classes/DrawPass.html +6 -6
- package/docs/classes/FillPass.html +6 -6
- package/docs/classes/SVGDrawHandler.html +2 -2
- package/docs/classes/SVGDrawInfo.html +2 -2
- package/docs/classes/SVGMesh.html +3 -3
- package/docs/classes/SVGRenderInfo.html +2 -2
- package/docs/classes/SVGRenderer.html +10 -10
- package/docs/classes/ThreeSVGRendererPlugin.html +15 -14
- package/docs/classes/Viewmap.html +2 -2
- package/docs/classes/ViewmapBuildInfo.html +3 -3
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/FillPassOptions.html +5 -5
- package/docs/interfaces/SVGDrawOptions.html +2 -2
- package/docs/interfaces/SVGMeshOptions.html +2 -2
- package/docs/interfaces/SVGTexture.html +3 -3
- package/docs/interfaces/ViewmapOptions.html +2 -2
- package/package.json +14 -3
- package/src/three-svg-renderer/core/viewmap/operations/computePolygons.ts +2 -2
- package/tsconfig.json +46 -0
- package/docs/.nojekyll +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("threepipe"), require("three")) : typeof define === "function" && define.amd ? define(["exports", "threepipe", "three"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@threepipe/plugin-svg-renderer"] = {}, global.threepipe, global.threepipe));
|
|
3
|
-
})(this, function(exports2, threepipe, three) {
|
|
4
|
-
"use strict"
|
|
5
|
-
* @license
|
|
6
|
-
* @threepipe/plugin-svg-renderer v0.2.4
|
|
7
|
-
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
8
|
-
* GPLV3 License
|
|
9
|
-
* See ./dependencies.txt for any bundled third-party dependencies and licenses.
|
|
10
|
-
*/
|
|
11
|
-
|
|
3
|
+
})(this, (function(exports2, threepipe, three) {
|
|
4
|
+
"use strict";
|
|
12
5
|
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
13
6
|
class RenderableObject {
|
|
14
7
|
constructor() {
|
|
@@ -99,13 +92,13 @@
|
|
|
99
92
|
positionScreen.z *= invW;
|
|
100
93
|
vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && positionScreen.y >= -1 && positionScreen.y <= 1 && positionScreen.z >= -1 && positionScreen.z <= 1;
|
|
101
94
|
}
|
|
102
|
-
function pushVertex(x2, y2,
|
|
95
|
+
function pushVertex(x2, y2, z2) {
|
|
103
96
|
_vertex = getNextVertexInPool();
|
|
104
|
-
_vertex.position.set(x2, y2,
|
|
97
|
+
_vertex.position.set(x2, y2, z2);
|
|
105
98
|
projectVertex(_vertex);
|
|
106
99
|
}
|
|
107
|
-
function pushNormal(x2, y2,
|
|
108
|
-
normals.push(x2, y2,
|
|
100
|
+
function pushNormal(x2, y2, z2) {
|
|
101
|
+
normals.push(x2, y2, z2);
|
|
109
102
|
}
|
|
110
103
|
function pushColor(r, g, b2) {
|
|
111
104
|
colors.push(r, g, b2);
|
|
@@ -145,10 +138,10 @@
|
|
|
145
138
|
_renderData.elements.push(_line2);
|
|
146
139
|
}
|
|
147
140
|
}
|
|
148
|
-
function pushTriangle(a, b2,
|
|
141
|
+
function pushTriangle(a, b2, c, material) {
|
|
149
142
|
const v1 = _vertexPool[a];
|
|
150
143
|
const v2 = _vertexPool[b2];
|
|
151
|
-
const v3 = _vertexPool[
|
|
144
|
+
const v3 = _vertexPool[c];
|
|
152
145
|
if (checkTriangleVisibility(v1, v2, v3) === false) return;
|
|
153
146
|
if (material.side === threepipe.DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {
|
|
154
147
|
_face = getNextFaceInPool();
|
|
@@ -206,7 +199,7 @@
|
|
|
206
199
|
addObject(object);
|
|
207
200
|
}
|
|
208
201
|
const children = object.children;
|
|
209
|
-
for (let i = 0,
|
|
202
|
+
for (let i = 0, l2 = children.length; i < l2; i++) {
|
|
210
203
|
projectObject(children[i]);
|
|
211
204
|
}
|
|
212
205
|
}
|
|
@@ -251,10 +244,10 @@
|
|
|
251
244
|
const groups = geometry.groups;
|
|
252
245
|
if (attributes.position === void 0) continue;
|
|
253
246
|
const positions = attributes.position.array;
|
|
254
|
-
for (let i = 0,
|
|
247
|
+
for (let i = 0, l2 = positions.length; i < l2; i += 3) {
|
|
255
248
|
let x2 = positions[i];
|
|
256
249
|
let y2 = positions[i + 1];
|
|
257
|
-
let
|
|
250
|
+
let z2 = positions[i + 2];
|
|
258
251
|
const morphTargets = geometry.morphAttributes.position;
|
|
259
252
|
if (morphTargets !== void 0) {
|
|
260
253
|
const morphTargetsRelative = geometry.morphTargetsRelative;
|
|
@@ -266,31 +259,31 @@
|
|
|
266
259
|
if (morphTargetsRelative) {
|
|
267
260
|
x2 += target.getX(i / 3) * influence;
|
|
268
261
|
y2 += target.getY(i / 3) * influence;
|
|
269
|
-
|
|
262
|
+
z2 += target.getZ(i / 3) * influence;
|
|
270
263
|
} else {
|
|
271
264
|
x2 += (target.getX(i / 3) - positions[i]) * influence;
|
|
272
265
|
y2 += (target.getY(i / 3) - positions[i + 1]) * influence;
|
|
273
|
-
|
|
266
|
+
z2 += (target.getZ(i / 3) - positions[i + 2]) * influence;
|
|
274
267
|
}
|
|
275
268
|
}
|
|
276
269
|
}
|
|
277
|
-
renderList.pushVertex(x2, y2,
|
|
270
|
+
renderList.pushVertex(x2, y2, z2);
|
|
278
271
|
}
|
|
279
272
|
if (attributes.normal !== void 0) {
|
|
280
273
|
const normals = attributes.normal.array;
|
|
281
|
-
for (let i = 0,
|
|
274
|
+
for (let i = 0, l2 = normals.length; i < l2; i += 3) {
|
|
282
275
|
renderList.pushNormal(normals[i], normals[i + 1], normals[i + 2]);
|
|
283
276
|
}
|
|
284
277
|
}
|
|
285
278
|
if (attributes.color !== void 0) {
|
|
286
279
|
const colors = attributes.color.array;
|
|
287
|
-
for (let i = 0,
|
|
280
|
+
for (let i = 0, l2 = colors.length; i < l2; i += 3) {
|
|
288
281
|
renderList.pushColor(colors[i], colors[i + 1], colors[i + 2]);
|
|
289
282
|
}
|
|
290
283
|
}
|
|
291
284
|
if (attributes.uv !== void 0) {
|
|
292
285
|
const uvs = attributes.uv.array;
|
|
293
|
-
for (let i = 0,
|
|
286
|
+
for (let i = 0, l2 = uvs.length; i < l2; i += 2) {
|
|
294
287
|
renderList.pushUv(uvs[i], uvs[i + 1]);
|
|
295
288
|
}
|
|
296
289
|
}
|
|
@@ -301,12 +294,12 @@
|
|
|
301
294
|
const group = groups[g];
|
|
302
295
|
material = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;
|
|
303
296
|
if (material === void 0) continue;
|
|
304
|
-
for (let i = group.start,
|
|
297
|
+
for (let i = group.start, l2 = group.start + group.count; i < l2; i += 3) {
|
|
305
298
|
renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2], material);
|
|
306
299
|
}
|
|
307
300
|
}
|
|
308
301
|
} else {
|
|
309
|
-
for (let i = 0,
|
|
302
|
+
for (let i = 0, l2 = indices.length; i < l2; i += 3) {
|
|
310
303
|
renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2], material);
|
|
311
304
|
}
|
|
312
305
|
}
|
|
@@ -316,12 +309,12 @@
|
|
|
316
309
|
const group = groups[g];
|
|
317
310
|
material = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;
|
|
318
311
|
if (material === void 0) continue;
|
|
319
|
-
for (let i = group.start,
|
|
312
|
+
for (let i = group.start, l2 = group.start + group.count; i < l2; i += 3) {
|
|
320
313
|
renderList.pushTriangle(i, i + 1, i + 2, material);
|
|
321
314
|
}
|
|
322
315
|
}
|
|
323
316
|
} else {
|
|
324
|
-
for (let i = 0,
|
|
317
|
+
for (let i = 0, l2 = positions.length / 3; i < l2; i += 3) {
|
|
325
318
|
renderList.pushTriangle(i, i + 1, i + 2, material);
|
|
326
319
|
}
|
|
327
320
|
}
|
|
@@ -331,23 +324,23 @@
|
|
|
331
324
|
const attributes = geometry.attributes;
|
|
332
325
|
if (attributes.position !== void 0) {
|
|
333
326
|
const positions = attributes.position.array;
|
|
334
|
-
for (let i = 0,
|
|
327
|
+
for (let i = 0, l2 = positions.length; i < l2; i += 3) {
|
|
335
328
|
renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);
|
|
336
329
|
}
|
|
337
330
|
if (attributes.color !== void 0) {
|
|
338
331
|
const colors = attributes.color.array;
|
|
339
|
-
for (let i = 0,
|
|
332
|
+
for (let i = 0, l2 = colors.length; i < l2; i += 3) {
|
|
340
333
|
renderList.pushColor(colors[i], colors[i + 1], colors[i + 2]);
|
|
341
334
|
}
|
|
342
335
|
}
|
|
343
336
|
if (geometry.index !== null) {
|
|
344
337
|
const indices = geometry.index.array;
|
|
345
|
-
for (let i = 0,
|
|
338
|
+
for (let i = 0, l2 = indices.length; i < l2; i += 2) {
|
|
346
339
|
renderList.pushLine(indices[i], indices[i + 1]);
|
|
347
340
|
}
|
|
348
341
|
} else {
|
|
349
342
|
const step = object.isLineSegments ? 2 : 1;
|
|
350
|
-
for (let i = 0,
|
|
343
|
+
for (let i = 0, l2 = positions.length / 3 - 1; i < l2; i += step) {
|
|
351
344
|
renderList.pushLine(i, i + 1);
|
|
352
345
|
}
|
|
353
346
|
}
|
|
@@ -357,7 +350,7 @@
|
|
|
357
350
|
const attributes = geometry.attributes;
|
|
358
351
|
if (attributes.position !== void 0) {
|
|
359
352
|
const positions = attributes.position.array;
|
|
360
|
-
for (let i = 0,
|
|
353
|
+
for (let i = 0, l2 = positions.length; i < l2; i += 3) {
|
|
361
354
|
_vector4.set(positions[i], positions[i + 1], positions[i + 2], 1);
|
|
362
355
|
_vector4.applyMatrix4(_modelViewProjectionMatrix);
|
|
363
356
|
pushPoint(_vector4, object, camera);
|
|
@@ -540,8 +533,8 @@
|
|
|
540
533
|
_svg.removeChild(_svg.childNodes[0]);
|
|
541
534
|
}
|
|
542
535
|
}
|
|
543
|
-
function convert(
|
|
544
|
-
return _precision !== null ?
|
|
536
|
+
function convert(c) {
|
|
537
|
+
return _precision !== null ? c.toFixed(_precision) : c;
|
|
545
538
|
}
|
|
546
539
|
this.clear = function() {
|
|
547
540
|
removeChildNodes();
|
|
@@ -637,8 +630,8 @@
|
|
|
637
630
|
_ambientLight.setRGB(0, 0, 0);
|
|
638
631
|
_directionalLights.setRGB(0, 0, 0);
|
|
639
632
|
_pointLights.setRGB(0, 0, 0);
|
|
640
|
-
for (let
|
|
641
|
-
const light = lights[
|
|
633
|
+
for (let l2 = 0, ll = lights.length; l2 < ll; l2++) {
|
|
634
|
+
const light = lights[l2];
|
|
642
635
|
const lightColor = light.color;
|
|
643
636
|
if (light.isAmbientLight) {
|
|
644
637
|
_ambientLight.r += lightColor.r;
|
|
@@ -656,8 +649,8 @@
|
|
|
656
649
|
}
|
|
657
650
|
}
|
|
658
651
|
function calculateLight(lights, position2, normal, color) {
|
|
659
|
-
for (let
|
|
660
|
-
const light = lights[
|
|
652
|
+
for (let l2 = 0, ll = lights.length; l2 < ll; l2++) {
|
|
653
|
+
const light = lights[l2];
|
|
661
654
|
const lightColor = light.color;
|
|
662
655
|
if (light.isDirectionalLight) {
|
|
663
656
|
const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld).sub(_normal2.setFromMatrixPosition(light.target.matrixWorld)).normalize();
|
|
@@ -777,16 +770,6 @@
|
|
|
777
770
|
}
|
|
778
771
|
}
|
|
779
772
|
};
|
|
780
|
-
/**
|
|
781
|
-
* @license
|
|
782
|
-
* ts-browser-helpers v0.19.4
|
|
783
|
-
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
784
|
-
* MIT License
|
|
785
|
-
* See ./dependencies.txt for bundled third-party dependencies and licenses.
|
|
786
|
-
*/
|
|
787
|
-
function Fe(t, ...e) {
|
|
788
|
-
return t;
|
|
789
|
-
}
|
|
790
773
|
function L(t, e) {
|
|
791
774
|
return Object.hasOwn ? Object.hasOwn(t, e) : t.hasOwnProperty(e);
|
|
792
775
|
}
|
|
@@ -800,8 +783,8 @@
|
|
|
800
783
|
let o = i;
|
|
801
784
|
for (; o; ) {
|
|
802
785
|
const s = Object.values(Object.getOwnPropertyDescriptors(o));
|
|
803
|
-
for (let
|
|
804
|
-
if (
|
|
786
|
+
for (let c of s)
|
|
787
|
+
if (c.value === e)
|
|
805
788
|
return r.set(e, true), e.call(i, ...n);
|
|
806
789
|
o = Object.getPrototypeOf(o);
|
|
807
790
|
}
|
|
@@ -820,12 +803,12 @@
|
|
|
820
803
|
return this[`_oc_${n}`];
|
|
821
804
|
},
|
|
822
805
|
set(s) {
|
|
823
|
-
var
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
806
|
+
var l2;
|
|
807
|
+
const c = this[`_oc_${n}`];
|
|
808
|
+
if (c === s) return;
|
|
826
809
|
this[`_oc_${n}`] = s;
|
|
827
|
-
const
|
|
828
|
-
typeof t == "string" ? (
|
|
810
|
+
const a = e === "param" ? [n, s, c, this] : e === "object" ? [{ key: n, value: s, oldValue: c, target: this }] : [];
|
|
811
|
+
typeof t == "string" ? (l2 = this[t]) == null || l2.call(this, ...a) : typeof t == "function" && U$1.callFunction(t, this, a);
|
|
829
812
|
}
|
|
830
813
|
};
|
|
831
814
|
if (r)
|
|
@@ -837,40 +820,34 @@
|
|
|
837
820
|
if (!t) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
838
821
|
return I(t, e);
|
|
839
822
|
}
|
|
840
|
-
function
|
|
823
|
+
function bt() {
|
|
841
824
|
const t = (n, r) => n.toString(16).padStart(r, "0"), e = crypto.getRandomValues(new Uint8Array(16));
|
|
842
825
|
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
843
826
|
const i = new DataView(e.buffer);
|
|
844
827
|
return `${t(i.getUint32(0), 8)}-${t(i.getUint16(4), 4)}-${t(i.getUint16(6), 4)}-${t(i.getUint16(8), 4)}-${t(i.getUint32(10), 8)}${t(i.getUint16(14), 4)}`;
|
|
845
828
|
}
|
|
846
|
-
|
|
847
|
-
* @license
|
|
848
|
-
* uiconfig.js v0.3.1
|
|
849
|
-
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
850
|
-
* MIT License
|
|
851
|
-
* See ./dependencies.txt for bundled third-party dependencies and licenses.
|
|
852
|
-
*/
|
|
853
|
-
const C = class C {
|
|
829
|
+
const v = class v {
|
|
854
830
|
};
|
|
855
|
-
|
|
856
|
-
let
|
|
857
|
-
function
|
|
858
|
-
r = r
|
|
859
|
-
const o = r
|
|
860
|
-
let
|
|
831
|
+
v.Map = /* @__PURE__ */ new WeakMap();
|
|
832
|
+
let p = v;
|
|
833
|
+
function b(n, e, t, r, s = true) {
|
|
834
|
+
r = r !== void 0 ? r : n[e], t = t ?? e + "";
|
|
835
|
+
const o = r?.uiConfig;
|
|
836
|
+
let i;
|
|
861
837
|
if (o)
|
|
862
|
-
|
|
838
|
+
i = o;
|
|
863
839
|
else {
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
type:
|
|
840
|
+
const u = T(r);
|
|
841
|
+
u === "folder" ? i = E(t, r, {}, "folder", s, e + "") : u && (i = {
|
|
842
|
+
type: u,
|
|
867
843
|
label: t,
|
|
868
|
-
property: [n, e]
|
|
844
|
+
property: [n, e],
|
|
845
|
+
propertyKey: e + ""
|
|
869
846
|
});
|
|
870
847
|
}
|
|
871
|
-
return
|
|
848
|
+
return i && !i.label && (i.label = t), i;
|
|
872
849
|
}
|
|
873
|
-
function
|
|
850
|
+
function V(n) {
|
|
874
851
|
if (!n) return [];
|
|
875
852
|
let e = n.constructor || Object;
|
|
876
853
|
e === Array && (e = Object);
|
|
@@ -878,62 +855,62 @@
|
|
|
878
855
|
for (; e && e !== Object; )
|
|
879
856
|
r.push(e), e = Object.getPrototypeOf(e);
|
|
880
857
|
if (!r.length || Array.isArray(n)) {
|
|
881
|
-
const
|
|
882
|
-
for (const o of
|
|
883
|
-
const
|
|
884
|
-
if (
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
return r.reverse().forEach((
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
property: [n, a],
|
|
858
|
+
const s = typeof n == "object" ? Object.keys(n) : Array.isArray(n) ? n.map((o, i) => i) : [];
|
|
859
|
+
for (const o of s) {
|
|
860
|
+
const i = n[o];
|
|
861
|
+
if (i == null) continue;
|
|
862
|
+
const u = b(n, o, o + "", i, true);
|
|
863
|
+
u && t.push(u);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return r.reverse().forEach((s) => {
|
|
867
|
+
p.Map.get(s)?.forEach(({ params: o, propKey: i, uiType: u }) => {
|
|
868
|
+
let a;
|
|
869
|
+
if (u || (a = () => b(n, i)), a || (a = {
|
|
870
|
+
property: [n, i],
|
|
895
871
|
type: u || "input"
|
|
896
872
|
// ...params,
|
|
897
873
|
// ...extraParams,
|
|
898
|
-
}),
|
|
899
|
-
const
|
|
900
|
-
if (delete
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
return
|
|
874
|
+
}), o) {
|
|
875
|
+
const d = typeof o.params == "function" ? o.params(n) : o.params || {}, c = { ...o };
|
|
876
|
+
if (delete c.params, typeof a == "function") {
|
|
877
|
+
const y2 = a;
|
|
878
|
+
a = () => {
|
|
879
|
+
const m = y2();
|
|
880
|
+
return m && Object.assign(m, { ...c, ...d });
|
|
905
881
|
};
|
|
906
882
|
} else
|
|
907
|
-
Object.assign(
|
|
883
|
+
Object.assign(a, { ...c, ...d });
|
|
908
884
|
}
|
|
909
|
-
t.push(
|
|
885
|
+
t.push(a);
|
|
910
886
|
});
|
|
911
887
|
}), t;
|
|
912
888
|
}
|
|
913
|
-
function
|
|
889
|
+
function E(n, e, t = {}, r = "folder", s = false, o) {
|
|
914
890
|
return {
|
|
915
891
|
type: r,
|
|
916
892
|
label: n,
|
|
917
|
-
children:
|
|
918
|
-
uuid:
|
|
893
|
+
children: s ? [() => V(e)] : V(e),
|
|
894
|
+
uuid: bt(),
|
|
895
|
+
propertyKey: o,
|
|
919
896
|
...t
|
|
920
897
|
};
|
|
921
898
|
}
|
|
922
899
|
function T(n) {
|
|
923
900
|
return n == null ? null : Array.isArray(n) ? "folder" : typeof n == "boolean" ? "checkbox" : typeof n == "number" ? "number" : typeof n == "string" ? "input" : typeof n == "function" ? "button" : typeof n.x == "number" ? "vec" : typeof n.r == "number" ? "color" : n.isTexture ? "image" : typeof n == "object" ? "folder" : null;
|
|
924
901
|
}
|
|
925
|
-
function
|
|
902
|
+
function Q(n) {
|
|
926
903
|
return (e, t) => {
|
|
927
904
|
const r = e.constructor;
|
|
928
905
|
if (r === Object) throw new Error("Not possible to use uiConfig decorator on an object, use class instead");
|
|
929
|
-
|
|
906
|
+
p.Map.has(r) || p.Map.set(r, []), n(e, t, p.Map.get(r));
|
|
930
907
|
};
|
|
931
908
|
}
|
|
932
|
-
function
|
|
933
|
-
return
|
|
934
|
-
const o =
|
|
909
|
+
function l(n, e) {
|
|
910
|
+
return Q((t, r, s) => {
|
|
911
|
+
const o = s.findIndex((i) => i.propKey === r);
|
|
935
912
|
if (o && o < 0)
|
|
936
|
-
|
|
913
|
+
s.push({
|
|
937
914
|
params: e || {},
|
|
938
915
|
propKey: r,
|
|
939
916
|
uiType: n
|
|
@@ -942,24 +919,24 @@
|
|
|
942
919
|
throw new Error(`Property ${r} already has a uiConfig decorator`);
|
|
943
920
|
});
|
|
944
921
|
}
|
|
945
|
-
function
|
|
922
|
+
function U(n, e, t = "panel") {
|
|
946
923
|
return (r) => class extends r {
|
|
947
924
|
constructor() {
|
|
948
|
-
super(...arguments), this.uiConfig =
|
|
925
|
+
super(...arguments), this.uiConfig = E(n, this, {}, t);
|
|
949
926
|
}
|
|
950
927
|
};
|
|
951
928
|
}
|
|
952
|
-
function
|
|
953
|
-
return Array.isArray(e) && typeof e[0] == "string" && (e = e.map((r) => ({ label: r, value: r }))),
|
|
929
|
+
function W(n, e, t) {
|
|
930
|
+
return Array.isArray(e) && typeof e[0] == "string" && (e = e.map((r) => ({ label: r, value: r }))), l("dropdown", { label: n, children: e, params: t });
|
|
954
931
|
}
|
|
955
|
-
function
|
|
956
|
-
return
|
|
932
|
+
function z(n, e) {
|
|
933
|
+
return l("number", { label: n, params: e });
|
|
957
934
|
}
|
|
958
|
-
function
|
|
959
|
-
return
|
|
935
|
+
function K(n, e) {
|
|
936
|
+
return l("checkbox", { label: n, params: e });
|
|
960
937
|
}
|
|
961
938
|
function X(n, e) {
|
|
962
|
-
return
|
|
939
|
+
return U(n, e, "folder");
|
|
963
940
|
}
|
|
964
941
|
var __defProp$2 = Object.defineProperty;
|
|
965
942
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
@@ -981,19 +958,19 @@
|
|
|
981
958
|
}
|
|
982
959
|
};
|
|
983
960
|
__decorateClass$2([
|
|
984
|
-
|
|
961
|
+
K()
|
|
985
962
|
], exports2.BasicSVGRenderer.prototype, "autoClear", 2);
|
|
986
963
|
__decorateClass$2([
|
|
987
|
-
|
|
964
|
+
K()
|
|
988
965
|
], exports2.BasicSVGRenderer.prototype, "sortObjects", 2);
|
|
989
966
|
__decorateClass$2([
|
|
990
|
-
|
|
967
|
+
K()
|
|
991
968
|
], exports2.BasicSVGRenderer.prototype, "sortElements", 2);
|
|
992
969
|
__decorateClass$2([
|
|
993
|
-
|
|
970
|
+
z()
|
|
994
971
|
], exports2.BasicSVGRenderer.prototype, "overdraw", 2);
|
|
995
972
|
__decorateClass$2([
|
|
996
|
-
|
|
973
|
+
W(void 0, ["low", "high"]),
|
|
997
974
|
Ke(exports2.BasicSVGRenderer.prototype._refresh)
|
|
998
975
|
], exports2.BasicSVGRenderer.prototype, "quality", 2);
|
|
999
976
|
exports2.BasicSVGRenderer = __decorateClass$2([
|
|
@@ -1022,7 +999,7 @@
|
|
|
1022
999
|
this._lastStyles = void 0;
|
|
1023
1000
|
this.autoRender = true;
|
|
1024
1001
|
this._viewerListeners = {
|
|
1025
|
-
postRender: (
|
|
1002
|
+
postRender: (_) => {
|
|
1026
1003
|
if (this.autoRender) this.render();
|
|
1027
1004
|
}
|
|
1028
1005
|
};
|
|
@@ -1032,7 +1009,6 @@
|
|
|
1032
1009
|
this.renderer.domElement.style.display = "none";
|
|
1033
1010
|
}
|
|
1034
1011
|
onAdded(viewer) {
|
|
1035
|
-
var _a;
|
|
1036
1012
|
super.onAdded(viewer);
|
|
1037
1013
|
this.renderer.setSize(viewer.canvas.clientWidth, viewer.canvas.clientHeight);
|
|
1038
1014
|
this._refreshParams();
|
|
@@ -1048,7 +1024,7 @@
|
|
|
1048
1024
|
element.style.width = canvasStyles.width;
|
|
1049
1025
|
element.style.height = canvasStyles.height;
|
|
1050
1026
|
} else {
|
|
1051
|
-
|
|
1027
|
+
this._viewer?.console.warn("BasicSVGRendererPlugin: canvas position should be absolute for proper rendering");
|
|
1052
1028
|
}
|
|
1053
1029
|
viewer.renderManager.addEventListener("resize", this._onResize);
|
|
1054
1030
|
}
|
|
@@ -1072,10 +1048,9 @@
|
|
|
1072
1048
|
this.renderer.render(this._viewer.scene, this._viewer.scene.mainCamera);
|
|
1073
1049
|
}
|
|
1074
1050
|
download() {
|
|
1075
|
-
var _a;
|
|
1076
1051
|
const svg2 = this.renderer.domElement.outerHTML;
|
|
1077
1052
|
const blob = new Blob([svg2], { type: "image/svg+xml" });
|
|
1078
|
-
|
|
1053
|
+
this._viewer?.exportBlob(blob, "scene.svg");
|
|
1079
1054
|
}
|
|
1080
1055
|
get svgNode() {
|
|
1081
1056
|
return this.renderer.domElement;
|
|
@@ -1271,7 +1246,7 @@
|
|
|
1271
1246
|
return Math.abs(a.x - b2.x) < tolerance && Math.abs(a.y - b2.y) < tolerance;
|
|
1272
1247
|
}
|
|
1273
1248
|
const _matrix$3 = new three.Matrix4();
|
|
1274
|
-
function orient3D$2(a, b2,
|
|
1249
|
+
function orient3D$2(a, b2, c, d, epsilon = 1e-10) {
|
|
1275
1250
|
_matrix$3.set(
|
|
1276
1251
|
a.x,
|
|
1277
1252
|
a.y,
|
|
@@ -1281,9 +1256,9 @@
|
|
|
1281
1256
|
b2.y,
|
|
1282
1257
|
b2.z,
|
|
1283
1258
|
1,
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1259
|
+
c.x,
|
|
1260
|
+
c.y,
|
|
1261
|
+
c.z,
|
|
1287
1262
|
1,
|
|
1288
1263
|
d.x,
|
|
1289
1264
|
d.y,
|
|
@@ -1298,11 +1273,11 @@
|
|
|
1298
1273
|
}
|
|
1299
1274
|
return 0;
|
|
1300
1275
|
}
|
|
1301
|
-
function frontSide$1(a, b2,
|
|
1302
|
-
return orient3D$2(d, b2,
|
|
1276
|
+
function frontSide$1(a, b2, c, d, epsilon = 1e-10) {
|
|
1277
|
+
return orient3D$2(d, b2, c, a, epsilon) > 0;
|
|
1303
1278
|
}
|
|
1304
|
-
function sameSide(a, b2,
|
|
1305
|
-
return orient3D$2(a, b2,
|
|
1279
|
+
function sameSide(a, b2, c, d, e, epsilon = 1e-10) {
|
|
1280
|
+
return orient3D$2(a, b2, c, d, epsilon) > 0 === orient3D$2(a, b2, c, e, epsilon) > 0;
|
|
1306
1281
|
}
|
|
1307
1282
|
function round(num, divider = 100) {
|
|
1308
1283
|
return Math.round(num * divider) / divider;
|
|
@@ -1414,7 +1389,7 @@
|
|
|
1414
1389
|
};
|
|
1415
1390
|
var Arrangement2D = (() => {
|
|
1416
1391
|
var _scriptDir = typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.js", document.baseURI).href;
|
|
1417
|
-
return function(Arrangement2D2) {
|
|
1392
|
+
return (function(Arrangement2D2) {
|
|
1418
1393
|
Arrangement2D2 = Arrangement2D2 || {};
|
|
1419
1394
|
var Module = typeof Arrangement2D2 != "undefined" ? Arrangement2D2 : {};
|
|
1420
1395
|
var readyPromiseResolve, readyPromiseReject;
|
|
@@ -2422,8 +2397,8 @@
|
|
|
2422
2397
|
function createWasm() {
|
|
2423
2398
|
var info = { "env": asmLibraryArg, "wasi_snapshot_preview1": asmLibraryArg };
|
|
2424
2399
|
function receiveInstance(instance, module2) {
|
|
2425
|
-
var
|
|
2426
|
-
Module["asm"] =
|
|
2400
|
+
var exports$12 = instance.exports;
|
|
2401
|
+
Module["asm"] = exports$12;
|
|
2427
2402
|
wasmMemory = Module["asm"]["memory"];
|
|
2428
2403
|
assert(wasmMemory, "memory not found in wasm exports");
|
|
2429
2404
|
updateGlobalBufferAndViews(wasmMemory.buffer);
|
|
@@ -2468,8 +2443,8 @@
|
|
|
2468
2443
|
}
|
|
2469
2444
|
if (Module["instantiateWasm"]) {
|
|
2470
2445
|
try {
|
|
2471
|
-
var
|
|
2472
|
-
return
|
|
2446
|
+
var exports$1 = Module["instantiateWasm"](info, receiveInstance);
|
|
2447
|
+
return exports$1;
|
|
2473
2448
|
} catch (e) {
|
|
2474
2449
|
err("Module.instantiateWasm callback failed with error: " + e);
|
|
2475
2450
|
return false;
|
|
@@ -2966,7 +2941,7 @@
|
|
|
2966
2941
|
bytes[i] = decoded.charCodeAt(i);
|
|
2967
2942
|
}
|
|
2968
2943
|
return bytes;
|
|
2969
|
-
} catch (
|
|
2944
|
+
} catch (_) {
|
|
2970
2945
|
throw new Error("Converting base64 string to bytes failed.");
|
|
2971
2946
|
}
|
|
2972
2947
|
}
|
|
@@ -3647,7 +3622,7 @@
|
|
|
3647
3622
|
_emscripten_bind_ContourList___destroy___0(self2);
|
|
3648
3623
|
};
|
|
3649
3624
|
return Arrangement2D2.ready;
|
|
3650
|
-
};
|
|
3625
|
+
});
|
|
3651
3626
|
})();
|
|
3652
3627
|
const Arr2DPromise = Arrangement2D();
|
|
3653
3628
|
class PolygonsInfo {
|
|
@@ -3659,7 +3634,7 @@
|
|
|
3659
3634
|
async function computePolygons(viewmap, info = new PolygonsInfo()) {
|
|
3660
3635
|
const { chains, polygons } = viewmap;
|
|
3661
3636
|
const Arr2D = await Arr2DPromise;
|
|
3662
|
-
const visibleChains = chains.filter((
|
|
3637
|
+
const visibleChains = chains.filter((c) => c.visibility === ChainVisibility.Visible);
|
|
3663
3638
|
const points = new Arr2D.PointList();
|
|
3664
3639
|
let a, b2;
|
|
3665
3640
|
for (const chain of visibleChains) {
|
|
@@ -3673,7 +3648,7 @@
|
|
|
3673
3648
|
}
|
|
3674
3649
|
const builder = new Arr2D.ArrangementBuilder();
|
|
3675
3650
|
const arr2DPolygonlist = builder.getPolygons(points);
|
|
3676
|
-
const
|
|
3651
|
+
const p2 = new Arr2D.Point();
|
|
3677
3652
|
info.smallAreaIgnored = 0;
|
|
3678
3653
|
info.insidePointErrors = 0;
|
|
3679
3654
|
for (let i = 0; i < arr2DPolygonlist.size(); i++) {
|
|
@@ -3683,8 +3658,8 @@
|
|
|
3683
3658
|
const contour = convertContour(arr2DPolygon.contour);
|
|
3684
3659
|
const holes = convertContourList(arr2DPolygon.holes);
|
|
3685
3660
|
const polygon = new Polygon$1(i, contour, holes);
|
|
3686
|
-
if (arr2DPolygon.getInsidePoint(
|
|
3687
|
-
polygon.insidePoint.set(
|
|
3661
|
+
if (arr2DPolygon.getInsidePoint(p2)) {
|
|
3662
|
+
polygon.insidePoint.set(p2.x, p2.y);
|
|
3688
3663
|
polygons.push(polygon);
|
|
3689
3664
|
} else {
|
|
3690
3665
|
info.insidePointErrors += 1;
|
|
@@ -3695,7 +3670,7 @@
|
|
|
3695
3670
|
Arr2D.destroy(arr2DPolygon);
|
|
3696
3671
|
}
|
|
3697
3672
|
Arr2D.destroy(arr2DPolygonlist);
|
|
3698
|
-
Arr2D.destroy(
|
|
3673
|
+
Arr2D.destroy(p2);
|
|
3699
3674
|
}
|
|
3700
3675
|
function convertContourList(vector) {
|
|
3701
3676
|
const array2 = new Array();
|
|
@@ -3707,8 +3682,8 @@
|
|
|
3707
3682
|
function convertContour(contour) {
|
|
3708
3683
|
const array2 = new Array();
|
|
3709
3684
|
for (let i = 0; i < contour.size(); i++) {
|
|
3710
|
-
const
|
|
3711
|
-
array2.push(new three.Vector2(
|
|
3685
|
+
const p2 = contour.at(i);
|
|
3686
|
+
array2.push(new three.Vector2(p2.x, p2.y));
|
|
3712
3687
|
}
|
|
3713
3688
|
return array2;
|
|
3714
3689
|
}
|
|
@@ -3927,8 +3902,8 @@
|
|
|
3927
3902
|
_tmp1.cross(_tmp2);
|
|
3928
3903
|
return _tmp1.x > -EPSILON$1 && _tmp1.x < EPSILON$1 && _tmp1.y > -EPSILON$1 && _tmp1.y < EPSILON$1 && _tmp1.z > -EPSILON$1 && _tmp1.z < EPSILON$1;
|
|
3929
3904
|
}
|
|
3930
|
-
function orient3D$1(a, b2,
|
|
3931
|
-
_matrix4.set(a.x, a.y, a.z, 1, b2.x, b2.y, b2.z, 1,
|
|
3905
|
+
function orient3D$1(a, b2, c, d) {
|
|
3906
|
+
_matrix4.set(a.x, a.y, a.z, 1, b2.x, b2.y, b2.z, 1, c.x, c.y, c.z, 1, d.x, d.y, d.z, 1);
|
|
3932
3907
|
const det = _matrix4.determinant();
|
|
3933
3908
|
if (det < -EPSILON$1)
|
|
3934
3909
|
return -1;
|
|
@@ -3937,8 +3912,8 @@
|
|
|
3937
3912
|
else
|
|
3938
3913
|
return 0;
|
|
3939
3914
|
}
|
|
3940
|
-
function orient2D(a, b2,
|
|
3941
|
-
_matrix3.set(a.x, a.y, 1, b2.x, b2.y, 1,
|
|
3915
|
+
function orient2D(a, b2, c) {
|
|
3916
|
+
_matrix3.set(a.x, a.y, 1, b2.x, b2.y, 1, c.x, c.y, 1);
|
|
3942
3917
|
const det = _matrix3.determinant();
|
|
3943
3918
|
if (det < -EPSILON$1)
|
|
3944
3919
|
return -1;
|
|
@@ -4025,9 +4000,9 @@
|
|
|
4025
4000
|
other.b = tmp;
|
|
4026
4001
|
}
|
|
4027
4002
|
}
|
|
4028
|
-
function intersectPlane(a, b2,
|
|
4003
|
+
function intersectPlane(a, b2, p2, n, target) {
|
|
4029
4004
|
_u$1$1.subVectors(b2, a);
|
|
4030
|
-
_v$1$1.subVectors(a,
|
|
4005
|
+
_v$1$1.subVectors(a, p2);
|
|
4031
4006
|
const dot1 = n.dot(_u$1$1);
|
|
4032
4007
|
const dot2 = n.dot(_v$1$1);
|
|
4033
4008
|
_u$1$1.multiplyScalar(-dot2 / dot1);
|
|
@@ -4128,8 +4103,8 @@
|
|
|
4128
4103
|
if (intersecting && target) {
|
|
4129
4104
|
clipTriangle(t1, t2, target);
|
|
4130
4105
|
_matrix$2.invert();
|
|
4131
|
-
for (const
|
|
4132
|
-
|
|
4106
|
+
for (const p3 of target) {
|
|
4107
|
+
p3.applyMatrix4(_matrix$2);
|
|
4133
4108
|
}
|
|
4134
4109
|
}
|
|
4135
4110
|
return intersecting;
|
|
@@ -4545,9 +4520,9 @@
|
|
|
4545
4520
|
if (t === null) {
|
|
4546
4521
|
return t;
|
|
4547
4522
|
}
|
|
4548
|
-
var
|
|
4549
|
-
var
|
|
4550
|
-
|
|
4523
|
+
var l2, r, y2;
|
|
4524
|
+
var N = new Node();
|
|
4525
|
+
l2 = r = N;
|
|
4551
4526
|
while (true) {
|
|
4552
4527
|
var cmp = comparator(i, t.key);
|
|
4553
4528
|
if (cmp < 0) {
|
|
@@ -4579,17 +4554,17 @@
|
|
|
4579
4554
|
break;
|
|
4580
4555
|
}
|
|
4581
4556
|
}
|
|
4582
|
-
|
|
4583
|
-
|
|
4557
|
+
l2.right = t;
|
|
4558
|
+
l2 = t;
|
|
4584
4559
|
t = t.right;
|
|
4585
4560
|
} else {
|
|
4586
4561
|
break;
|
|
4587
4562
|
}
|
|
4588
4563
|
}
|
|
4589
|
-
|
|
4564
|
+
l2.right = t.left;
|
|
4590
4565
|
r.left = t.right;
|
|
4591
|
-
t.left =
|
|
4592
|
-
t.right =
|
|
4566
|
+
t.left = N.right;
|
|
4567
|
+
t.right = N.left;
|
|
4593
4568
|
return t;
|
|
4594
4569
|
}
|
|
4595
4570
|
function insert(i, data2, t, comparator, tree) {
|
|
@@ -4770,15 +4745,15 @@
|
|
|
4770
4745
|
};
|
|
4771
4746
|
Tree.prototype.forEach = function forEach(visitor, ctx) {
|
|
4772
4747
|
var current = this._root;
|
|
4773
|
-
var
|
|
4748
|
+
var Q2 = [];
|
|
4774
4749
|
var done = false;
|
|
4775
4750
|
while (!done) {
|
|
4776
4751
|
if (current !== null) {
|
|
4777
|
-
|
|
4752
|
+
Q2.push(current);
|
|
4778
4753
|
current = current.left;
|
|
4779
4754
|
} else {
|
|
4780
|
-
if (
|
|
4781
|
-
current =
|
|
4755
|
+
if (Q2.length !== 0) {
|
|
4756
|
+
current = Q2.pop();
|
|
4782
4757
|
visitor.call(ctx, current);
|
|
4783
4758
|
current = current.right;
|
|
4784
4759
|
} else {
|
|
@@ -4790,15 +4765,15 @@
|
|
|
4790
4765
|
};
|
|
4791
4766
|
Tree.prototype.range = function range(low, high, fn, ctx) {
|
|
4792
4767
|
var this$1$1 = this;
|
|
4793
|
-
var
|
|
4768
|
+
var Q2 = [];
|
|
4794
4769
|
var compare = this._comparator;
|
|
4795
4770
|
var node = this._root, cmp;
|
|
4796
|
-
while (
|
|
4771
|
+
while (Q2.length !== 0 || node) {
|
|
4797
4772
|
if (node) {
|
|
4798
|
-
|
|
4773
|
+
Q2.push(node);
|
|
4799
4774
|
node = node.left;
|
|
4800
4775
|
} else {
|
|
4801
|
-
node =
|
|
4776
|
+
node = Q2.pop();
|
|
4802
4777
|
cmp = compare(node.key, high);
|
|
4803
4778
|
if (cmp > 0) {
|
|
4804
4779
|
break;
|
|
@@ -4860,14 +4835,14 @@
|
|
|
4860
4835
|
};
|
|
4861
4836
|
Tree.prototype.at = function at(index) {
|
|
4862
4837
|
var current = this._root, done = false, i = 0;
|
|
4863
|
-
var
|
|
4838
|
+
var Q2 = [];
|
|
4864
4839
|
while (!done) {
|
|
4865
4840
|
if (current) {
|
|
4866
|
-
|
|
4841
|
+
Q2.push(current);
|
|
4867
4842
|
current = current.left;
|
|
4868
4843
|
} else {
|
|
4869
|
-
if (
|
|
4870
|
-
current =
|
|
4844
|
+
if (Q2.length > 0) {
|
|
4845
|
+
current = Q2.pop();
|
|
4871
4846
|
if (i === index) {
|
|
4872
4847
|
return current;
|
|
4873
4848
|
}
|
|
@@ -5003,32 +4978,32 @@
|
|
|
5003
4978
|
}
|
|
5004
4979
|
function createList(keys, values) {
|
|
5005
4980
|
var head = { next: null };
|
|
5006
|
-
var
|
|
4981
|
+
var p2 = head;
|
|
5007
4982
|
for (var i = 0; i < keys.length; i++) {
|
|
5008
|
-
|
|
4983
|
+
p2 = p2.next = { key: keys[i], data: values[i] };
|
|
5009
4984
|
}
|
|
5010
|
-
|
|
4985
|
+
p2.next = null;
|
|
5011
4986
|
return head.next;
|
|
5012
4987
|
}
|
|
5013
4988
|
function toList(root2) {
|
|
5014
4989
|
var current = root2;
|
|
5015
|
-
var
|
|
4990
|
+
var Q2 = [], done = false;
|
|
5016
4991
|
var head = { next: null };
|
|
5017
|
-
var
|
|
4992
|
+
var p2 = head;
|
|
5018
4993
|
while (!done) {
|
|
5019
4994
|
if (current) {
|
|
5020
|
-
|
|
4995
|
+
Q2.push(current);
|
|
5021
4996
|
current = current.left;
|
|
5022
4997
|
} else {
|
|
5023
|
-
if (
|
|
5024
|
-
current =
|
|
4998
|
+
if (Q2.length > 0) {
|
|
4999
|
+
current = p2 = p2.next = Q2.pop();
|
|
5025
5000
|
current = current.right;
|
|
5026
5001
|
} else {
|
|
5027
5002
|
done = true;
|
|
5028
5003
|
}
|
|
5029
5004
|
}
|
|
5030
5005
|
}
|
|
5031
|
-
|
|
5006
|
+
p2.next = null;
|
|
5032
5007
|
return head.next;
|
|
5033
5008
|
}
|
|
5034
5009
|
function sortedListToBST(list, start, end) {
|
|
@@ -5049,23 +5024,23 @@
|
|
|
5049
5024
|
return a - b2;
|
|
5050
5025
|
};
|
|
5051
5026
|
var head = {};
|
|
5052
|
-
var
|
|
5027
|
+
var p2 = head;
|
|
5053
5028
|
var p1 = l1;
|
|
5054
|
-
var
|
|
5055
|
-
while (p1 !== null &&
|
|
5056
|
-
if (compare(p1.key,
|
|
5057
|
-
|
|
5029
|
+
var p22 = l2;
|
|
5030
|
+
while (p1 !== null && p22 !== null) {
|
|
5031
|
+
if (compare(p1.key, p22.key) < 0) {
|
|
5032
|
+
p2.next = p1;
|
|
5058
5033
|
p1 = p1.next;
|
|
5059
5034
|
} else {
|
|
5060
|
-
|
|
5061
|
-
|
|
5035
|
+
p2.next = p22;
|
|
5036
|
+
p22 = p22.next;
|
|
5062
5037
|
}
|
|
5063
|
-
|
|
5038
|
+
p2 = p2.next;
|
|
5064
5039
|
}
|
|
5065
5040
|
if (p1 !== null) {
|
|
5066
|
-
|
|
5067
|
-
} else if (
|
|
5068
|
-
|
|
5041
|
+
p2.next = p1;
|
|
5042
|
+
} else if (p22 !== null) {
|
|
5043
|
+
p2.next = p22;
|
|
5069
5044
|
}
|
|
5070
5045
|
return head.next;
|
|
5071
5046
|
}
|
|
@@ -5335,7 +5310,7 @@
|
|
|
5335
5310
|
var m = 4 * j;
|
|
5336
5311
|
var a = boxes[k2];
|
|
5337
5312
|
var b2 = boxes[k2 + 1];
|
|
5338
|
-
var
|
|
5313
|
+
var c = boxes[k2 + 2];
|
|
5339
5314
|
var d = boxes[k2 + 3];
|
|
5340
5315
|
boxes[k2] = boxes[m];
|
|
5341
5316
|
boxes[k2 + 1] = boxes[m + 1];
|
|
@@ -5343,7 +5318,7 @@
|
|
|
5343
5318
|
boxes[k2 + 3] = boxes[m + 3];
|
|
5344
5319
|
boxes[m] = a;
|
|
5345
5320
|
boxes[m + 1] = b2;
|
|
5346
|
-
boxes[m + 2] =
|
|
5321
|
+
boxes[m + 2] = c;
|
|
5347
5322
|
boxes[m + 3] = d;
|
|
5348
5323
|
var e = indices[i];
|
|
5349
5324
|
indices[i] = indices[j];
|
|
@@ -5352,35 +5327,35 @@
|
|
|
5352
5327
|
function hilbert(x2, y2) {
|
|
5353
5328
|
var a = x2 ^ y2;
|
|
5354
5329
|
var b2 = 65535 ^ a;
|
|
5355
|
-
var
|
|
5330
|
+
var c = 65535 ^ (x2 | y2);
|
|
5356
5331
|
var d = x2 & (y2 ^ 65535);
|
|
5357
5332
|
var A2 = a | b2 >> 1;
|
|
5358
|
-
var
|
|
5359
|
-
var
|
|
5360
|
-
var D = a &
|
|
5333
|
+
var B = a >> 1 ^ a;
|
|
5334
|
+
var C = c >> 1 ^ b2 & d >> 1 ^ c;
|
|
5335
|
+
var D = a & c >> 1 ^ d >> 1 ^ d;
|
|
5361
5336
|
a = A2;
|
|
5362
|
-
b2 =
|
|
5363
|
-
|
|
5337
|
+
b2 = B;
|
|
5338
|
+
c = C;
|
|
5364
5339
|
d = D;
|
|
5365
5340
|
A2 = a & a >> 2 ^ b2 & b2 >> 2;
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
D ^= b2 &
|
|
5341
|
+
B = a & b2 >> 2 ^ b2 & (a ^ b2) >> 2;
|
|
5342
|
+
C ^= a & c >> 2 ^ b2 & d >> 2;
|
|
5343
|
+
D ^= b2 & c >> 2 ^ (a ^ b2) & d >> 2;
|
|
5369
5344
|
a = A2;
|
|
5370
|
-
b2 =
|
|
5371
|
-
|
|
5345
|
+
b2 = B;
|
|
5346
|
+
c = C;
|
|
5372
5347
|
d = D;
|
|
5373
5348
|
A2 = a & a >> 4 ^ b2 & b2 >> 4;
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
D ^= b2 &
|
|
5349
|
+
B = a & b2 >> 4 ^ b2 & (a ^ b2) >> 4;
|
|
5350
|
+
C ^= a & c >> 4 ^ b2 & d >> 4;
|
|
5351
|
+
D ^= b2 & c >> 4 ^ (a ^ b2) & d >> 4;
|
|
5377
5352
|
a = A2;
|
|
5378
|
-
b2 =
|
|
5379
|
-
|
|
5353
|
+
b2 = B;
|
|
5354
|
+
c = C;
|
|
5380
5355
|
d = D;
|
|
5381
|
-
|
|
5382
|
-
D ^= b2 &
|
|
5383
|
-
a =
|
|
5356
|
+
C ^= a & c >> 8 ^ b2 & d >> 8;
|
|
5357
|
+
D ^= b2 & c >> 8 ^ (a ^ b2) & d >> 8;
|
|
5358
|
+
a = C ^ C >> 1;
|
|
5384
5359
|
b2 = D ^ D >> 1;
|
|
5385
5360
|
var i0 = x2 ^ y2;
|
|
5386
5361
|
var i1 = b2 | 65535 ^ (i0 | a);
|
|
@@ -5474,9 +5449,9 @@
|
|
|
5474
5449
|
}
|
|
5475
5450
|
index.add(minX, minY, maxX, maxY);
|
|
5476
5451
|
}
|
|
5477
|
-
function defaultIntersectionReporter(
|
|
5452
|
+
function defaultIntersectionReporter(p2, interior) {
|
|
5478
5453
|
results.push({
|
|
5479
|
-
point:
|
|
5454
|
+
point: p2,
|
|
5480
5455
|
segments: interior
|
|
5481
5456
|
});
|
|
5482
5457
|
}
|
|
@@ -5548,8 +5523,8 @@
|
|
|
5548
5523
|
for (const edge of viewVertex.viewEdges) {
|
|
5549
5524
|
natures.add(edge.nature);
|
|
5550
5525
|
if (edge.faces.length > 1 && edge.nature === ViewEdgeNature.Silhouette) {
|
|
5551
|
-
concaveSilhouetteEdgeFound
|
|
5552
|
-
convexSilhouetteEdgeFound
|
|
5526
|
+
concaveSilhouetteEdgeFound ||= edge.isConcave;
|
|
5527
|
+
convexSilhouetteEdgeFound ||= !edge.isConcave;
|
|
5553
5528
|
}
|
|
5554
5529
|
}
|
|
5555
5530
|
if (natures.size === 0) {
|
|
@@ -5600,8 +5575,8 @@
|
|
|
5600
5575
|
}
|
|
5601
5576
|
}
|
|
5602
5577
|
if (farthestHalfedge && otherVertex) {
|
|
5603
|
-
const
|
|
5604
|
-
const
|
|
5578
|
+
const c = camera.position;
|
|
5579
|
+
const p2 = vertex.position;
|
|
5605
5580
|
const e = otherVertex.position;
|
|
5606
5581
|
const boundaryFace = farthestHalfedge.twin.face;
|
|
5607
5582
|
if (boundaryFace) {
|
|
@@ -5609,7 +5584,7 @@
|
|
|
5609
5584
|
if (halfedge.face !== boundaryFace) {
|
|
5610
5585
|
const q = halfedge.next.vertex.position;
|
|
5611
5586
|
const r = halfedge.next.vertex.position;
|
|
5612
|
-
if (!sameSide(
|
|
5587
|
+
if (!sameSide(p2, q, r, c, e) && sameSide(c, p2, q, e, r) && sameSide(c, p2, r, e, q)) {
|
|
5613
5588
|
return true;
|
|
5614
5589
|
}
|
|
5615
5590
|
}
|
|
@@ -5709,7 +5684,7 @@
|
|
|
5709
5684
|
};
|
|
5710
5685
|
if (this.skipActions) res();
|
|
5711
5686
|
else {
|
|
5712
|
-
actions[idx].process().catch((
|
|
5687
|
+
actions[idx].process().catch((_) => {
|
|
5713
5688
|
}).then(res);
|
|
5714
5689
|
}
|
|
5715
5690
|
} else {
|
|
@@ -5844,10 +5819,10 @@
|
|
|
5844
5819
|
return actions;
|
|
5845
5820
|
}
|
|
5846
5821
|
visibleChains() {
|
|
5847
|
-
return this.chains.filter((
|
|
5822
|
+
return this.chains.filter((c) => c.visibility === ChainVisibility.Visible);
|
|
5848
5823
|
}
|
|
5849
5824
|
hiddenChains() {
|
|
5850
|
-
return this.chains.filter((
|
|
5825
|
+
return this.chains.filter((c) => c.visibility === ChainVisibility.Hidden);
|
|
5851
5826
|
}
|
|
5852
5827
|
}
|
|
5853
5828
|
const methods$1 = {};
|
|
@@ -6067,24 +6042,24 @@
|
|
|
6067
6042
|
}
|
|
6068
6043
|
function forward() {
|
|
6069
6044
|
const i = this.position();
|
|
6070
|
-
const
|
|
6071
|
-
|
|
6045
|
+
const p2 = this.parent();
|
|
6046
|
+
p2.add(this.remove(), i + 1);
|
|
6072
6047
|
return this;
|
|
6073
6048
|
}
|
|
6074
6049
|
function backward() {
|
|
6075
6050
|
const i = this.position();
|
|
6076
|
-
const
|
|
6077
|
-
|
|
6051
|
+
const p2 = this.parent();
|
|
6052
|
+
p2.add(this.remove(), i ? i - 1 : 0);
|
|
6078
6053
|
return this;
|
|
6079
6054
|
}
|
|
6080
6055
|
function front() {
|
|
6081
|
-
const
|
|
6082
|
-
|
|
6056
|
+
const p2 = this.parent();
|
|
6057
|
+
p2.add(this.remove());
|
|
6083
6058
|
return this;
|
|
6084
6059
|
}
|
|
6085
6060
|
function back() {
|
|
6086
|
-
const
|
|
6087
|
-
|
|
6061
|
+
const p2 = this.parent();
|
|
6062
|
+
p2.add(this.remove(), 0);
|
|
6088
6063
|
return this;
|
|
6089
6064
|
}
|
|
6090
6065
|
function before(element) {
|
|
@@ -6155,8 +6130,8 @@
|
|
|
6155
6130
|
}
|
|
6156
6131
|
function removeClass(name) {
|
|
6157
6132
|
if (this.hasClass(name)) {
|
|
6158
|
-
this.attr("class", this.classes().filter(function(
|
|
6159
|
-
return
|
|
6133
|
+
this.attr("class", this.classes().filter(function(c) {
|
|
6134
|
+
return c !== name;
|
|
6160
6135
|
}).join(" "));
|
|
6161
6136
|
}
|
|
6162
6137
|
return this;
|
|
@@ -6346,13 +6321,13 @@
|
|
|
6346
6321
|
return false;
|
|
6347
6322
|
}
|
|
6348
6323
|
}
|
|
6349
|
-
function hueToRgb(
|
|
6324
|
+
function hueToRgb(p2, q, t) {
|
|
6350
6325
|
if (t < 0) t += 1;
|
|
6351
6326
|
if (t > 1) t -= 1;
|
|
6352
|
-
if (t < 1 / 6) return
|
|
6327
|
+
if (t < 1 / 6) return p2 + (q - p2) * 6 * t;
|
|
6353
6328
|
if (t < 1 / 2) return q;
|
|
6354
|
-
if (t < 2 / 3) return
|
|
6355
|
-
return
|
|
6329
|
+
if (t < 2 / 3) return p2 + (q - p2) * (2 / 3 - t) * 6;
|
|
6330
|
+
return p2;
|
|
6356
6331
|
}
|
|
6357
6332
|
class Color {
|
|
6358
6333
|
constructor(...inputs) {
|
|
@@ -6377,10 +6352,10 @@
|
|
|
6377
6352
|
PI: pi
|
|
6378
6353
|
} = Math;
|
|
6379
6354
|
if (mode === "vibrant") {
|
|
6380
|
-
const
|
|
6381
|
-
const
|
|
6382
|
-
const
|
|
6383
|
-
const color = new Color(
|
|
6355
|
+
const l2 = (81 - 57) * random() + 57;
|
|
6356
|
+
const c = (83 - 45) * random() + 45;
|
|
6357
|
+
const h = 360 * random();
|
|
6358
|
+
const color = new Color(l2, c, h, "lch");
|
|
6384
6359
|
return color;
|
|
6385
6360
|
} else if (mode === "sine") {
|
|
6386
6361
|
t = t == null ? random() : t;
|
|
@@ -6390,16 +6365,16 @@
|
|
|
6390
6365
|
const color = new Color(r, g, b2);
|
|
6391
6366
|
return color;
|
|
6392
6367
|
} else if (mode === "pastel") {
|
|
6393
|
-
const
|
|
6394
|
-
const
|
|
6395
|
-
const
|
|
6396
|
-
const color = new Color(
|
|
6368
|
+
const l2 = (94 - 86) * random() + 86;
|
|
6369
|
+
const c = (26 - 9) * random() + 9;
|
|
6370
|
+
const h = 360 * random();
|
|
6371
|
+
const color = new Color(l2, c, h, "lch");
|
|
6397
6372
|
return color;
|
|
6398
6373
|
} else if (mode === "dark") {
|
|
6399
|
-
const
|
|
6400
|
-
const
|
|
6401
|
-
const
|
|
6402
|
-
const color = new Color(
|
|
6374
|
+
const l2 = 10 + 10 * random();
|
|
6375
|
+
const c = (125 - 75) * random() + 86;
|
|
6376
|
+
const h = 360 * random();
|
|
6377
|
+
const color = new Color(l2, c, h, "lch");
|
|
6403
6378
|
return color;
|
|
6404
6379
|
} else if (mode === "rgb") {
|
|
6405
6380
|
const r = 255 * random();
|
|
@@ -6408,10 +6383,10 @@
|
|
|
6408
6383
|
const color = new Color(r, g, b2);
|
|
6409
6384
|
return color;
|
|
6410
6385
|
} else if (mode === "lab") {
|
|
6411
|
-
const
|
|
6386
|
+
const l2 = 100 * random();
|
|
6412
6387
|
const a = 256 * random() - 128;
|
|
6413
6388
|
const b2 = 256 * random() - 128;
|
|
6414
|
-
const color = new Color(
|
|
6389
|
+
const color = new Color(l2, a, b2, "lab");
|
|
6415
6390
|
return color;
|
|
6416
6391
|
} else if (mode === "grey") {
|
|
6417
6392
|
const grey = 255 * random();
|
|
@@ -6436,10 +6411,10 @@
|
|
|
6436
6411
|
if (k2 === 1) {
|
|
6437
6412
|
return new Color(0, 0, 0, 1, "cmyk");
|
|
6438
6413
|
}
|
|
6439
|
-
const
|
|
6414
|
+
const c = (1 - r - k2) / (1 - k2);
|
|
6440
6415
|
const m = (1 - g - k2) / (1 - k2);
|
|
6441
6416
|
const y2 = (1 - b2 - k2) / (1 - k2);
|
|
6442
|
-
const color = new Color(
|
|
6417
|
+
const color = new Color(c, m, y2, k2, "cmyk");
|
|
6443
6418
|
return color;
|
|
6444
6419
|
}
|
|
6445
6420
|
hsl() {
|
|
@@ -6451,15 +6426,15 @@
|
|
|
6451
6426
|
const [r, g, b2] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6452
6427
|
const max = Math.max(r, g, b2);
|
|
6453
6428
|
const min = Math.min(r, g, b2);
|
|
6454
|
-
const
|
|
6429
|
+
const l2 = (max + min) / 2;
|
|
6455
6430
|
const isGrey = max === min;
|
|
6456
6431
|
const delta = max - min;
|
|
6457
|
-
const s = isGrey ? 0 :
|
|
6458
|
-
const
|
|
6459
|
-
const color = new Color(360 *
|
|
6432
|
+
const s = isGrey ? 0 : l2 > 0.5 ? delta / (2 - max - min) : delta / (max + min);
|
|
6433
|
+
const h = isGrey ? 0 : max === r ? ((g - b2) / delta + (g < b2 ? 6 : 0)) / 6 : max === g ? ((b2 - r) / delta + 2) / 6 : max === b2 ? ((r - g) / delta + 4) / 6 : 0;
|
|
6434
|
+
const color = new Color(360 * h, 100 * s, 100 * l2, "hsl");
|
|
6460
6435
|
return color;
|
|
6461
6436
|
}
|
|
6462
|
-
init(a = 0, b2 = 0,
|
|
6437
|
+
init(a = 0, b2 = 0, c = 0, d = 0, space = "rgb") {
|
|
6463
6438
|
a = !a ? 0 : a;
|
|
6464
6439
|
if (this.space) {
|
|
6465
6440
|
for (const component in this.space) {
|
|
@@ -6472,7 +6447,7 @@
|
|
|
6472
6447
|
Object.assign(this, {
|
|
6473
6448
|
_a: a,
|
|
6474
6449
|
_b: b2,
|
|
6475
|
-
_c:
|
|
6450
|
+
_c: c,
|
|
6476
6451
|
_d: d,
|
|
6477
6452
|
space
|
|
6478
6453
|
});
|
|
@@ -6548,27 +6523,27 @@
|
|
|
6548
6523
|
const {
|
|
6549
6524
|
x: x2,
|
|
6550
6525
|
y: y2,
|
|
6551
|
-
z
|
|
6526
|
+
z: z2
|
|
6552
6527
|
} = this.xyz();
|
|
6553
|
-
const
|
|
6528
|
+
const l2 = 116 * y2 - 16;
|
|
6554
6529
|
const a = 500 * (x2 - y2);
|
|
6555
|
-
const b2 = 200 * (y2 -
|
|
6556
|
-
const color = new Color(
|
|
6530
|
+
const b2 = 200 * (y2 - z2);
|
|
6531
|
+
const color = new Color(l2, a, b2, "lab");
|
|
6557
6532
|
return color;
|
|
6558
6533
|
}
|
|
6559
6534
|
lch() {
|
|
6560
6535
|
const {
|
|
6561
|
-
l,
|
|
6536
|
+
l: l2,
|
|
6562
6537
|
a,
|
|
6563
6538
|
b: b2
|
|
6564
6539
|
} = this.lab();
|
|
6565
|
-
const
|
|
6566
|
-
let
|
|
6567
|
-
if (
|
|
6568
|
-
|
|
6569
|
-
|
|
6540
|
+
const c = Math.sqrt(a ** 2 + b2 ** 2);
|
|
6541
|
+
let h = 180 * Math.atan2(b2, a) / Math.PI;
|
|
6542
|
+
if (h < 0) {
|
|
6543
|
+
h *= -1;
|
|
6544
|
+
h = 360 - h;
|
|
6570
6545
|
}
|
|
6571
|
-
const color = new Color(
|
|
6546
|
+
const color = new Color(l2, c, h, "lch");
|
|
6572
6547
|
return color;
|
|
6573
6548
|
}
|
|
6574
6549
|
/*
|
|
@@ -6581,24 +6556,24 @@
|
|
|
6581
6556
|
let {
|
|
6582
6557
|
x: x2,
|
|
6583
6558
|
y: y2,
|
|
6584
|
-
z
|
|
6559
|
+
z: z2
|
|
6585
6560
|
} = this;
|
|
6586
6561
|
if (this.space === "lab" || this.space === "lch") {
|
|
6587
6562
|
let {
|
|
6588
|
-
l,
|
|
6563
|
+
l: l2,
|
|
6589
6564
|
a,
|
|
6590
6565
|
b: b3
|
|
6591
6566
|
} = this;
|
|
6592
6567
|
if (this.space === "lch") {
|
|
6593
6568
|
const {
|
|
6594
|
-
c
|
|
6595
|
-
h
|
|
6569
|
+
c,
|
|
6570
|
+
h
|
|
6596
6571
|
} = this;
|
|
6597
6572
|
const dToR = Math.PI / 180;
|
|
6598
|
-
a =
|
|
6599
|
-
b3 =
|
|
6573
|
+
a = c * Math.cos(dToR * h);
|
|
6574
|
+
b3 = c * Math.sin(dToR * h);
|
|
6600
6575
|
}
|
|
6601
|
-
const yL = (
|
|
6576
|
+
const yL = (l2 + 16) / 116;
|
|
6602
6577
|
const xL = a / 500 + yL;
|
|
6603
6578
|
const zL = yL - b3 / 200;
|
|
6604
6579
|
const ct = 16 / 116;
|
|
@@ -6606,11 +6581,11 @@
|
|
|
6606
6581
|
const nm = 7.787;
|
|
6607
6582
|
x2 = 0.95047 * (xL ** 3 > mx ? xL ** 3 : (xL - ct) / nm);
|
|
6608
6583
|
y2 = 1 * (yL ** 3 > mx ? yL ** 3 : (yL - ct) / nm);
|
|
6609
|
-
|
|
6584
|
+
z2 = 1.08883 * (zL ** 3 > mx ? zL ** 3 : (zL - ct) / nm);
|
|
6610
6585
|
}
|
|
6611
|
-
const rU = x2 * 3.2406 + y2 * -1.5372 +
|
|
6612
|
-
const gU = x2 * -0.9689 + y2 * 1.8758 +
|
|
6613
|
-
const bU = x2 * 0.0557 + y2 * -0.204 +
|
|
6586
|
+
const rU = x2 * 3.2406 + y2 * -1.5372 + z2 * -0.4986;
|
|
6587
|
+
const gU = x2 * -0.9689 + y2 * 1.8758 + z2 * 0.0415;
|
|
6588
|
+
const bU = x2 * 0.0557 + y2 * -0.204 + z2 * 1.057;
|
|
6614
6589
|
const pow = Math.pow;
|
|
6615
6590
|
const bd = 31308e-7;
|
|
6616
6591
|
const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU;
|
|
@@ -6620,33 +6595,33 @@
|
|
|
6620
6595
|
return color;
|
|
6621
6596
|
} else if (this.space === "hsl") {
|
|
6622
6597
|
let {
|
|
6623
|
-
h
|
|
6598
|
+
h,
|
|
6624
6599
|
s,
|
|
6625
|
-
l
|
|
6600
|
+
l: l2
|
|
6626
6601
|
} = this;
|
|
6627
|
-
|
|
6602
|
+
h /= 360;
|
|
6628
6603
|
s /= 100;
|
|
6629
|
-
|
|
6604
|
+
l2 /= 100;
|
|
6630
6605
|
if (s === 0) {
|
|
6631
|
-
|
|
6632
|
-
const color2 = new Color(
|
|
6606
|
+
l2 *= 255;
|
|
6607
|
+
const color2 = new Color(l2, l2, l2);
|
|
6633
6608
|
return color2;
|
|
6634
6609
|
}
|
|
6635
|
-
const q =
|
|
6636
|
-
const
|
|
6637
|
-
const r = 255 * hueToRgb(
|
|
6638
|
-
const g = 255 * hueToRgb(
|
|
6639
|
-
const b2 = 255 * hueToRgb(
|
|
6610
|
+
const q = l2 < 0.5 ? l2 * (1 + s) : l2 + s - l2 * s;
|
|
6611
|
+
const p2 = 2 * l2 - q;
|
|
6612
|
+
const r = 255 * hueToRgb(p2, q, h + 1 / 3);
|
|
6613
|
+
const g = 255 * hueToRgb(p2, q, h);
|
|
6614
|
+
const b2 = 255 * hueToRgb(p2, q, h - 1 / 3);
|
|
6640
6615
|
const color = new Color(r, g, b2);
|
|
6641
6616
|
return color;
|
|
6642
6617
|
} else if (this.space === "cmyk") {
|
|
6643
6618
|
const {
|
|
6644
|
-
c
|
|
6619
|
+
c,
|
|
6645
6620
|
m,
|
|
6646
6621
|
y: y2,
|
|
6647
6622
|
k: k2
|
|
6648
6623
|
} = this;
|
|
6649
|
-
const r = 255 * (1 - Math.min(1,
|
|
6624
|
+
const r = 255 * (1 - Math.min(1, c * (1 - k2) + k2));
|
|
6650
6625
|
const g = 255 * (1 - Math.min(1, m * (1 - k2) + k2));
|
|
6651
6626
|
const b2 = 255 * (1 - Math.min(1, y2 * (1 - k2) + k2));
|
|
6652
6627
|
const color = new Color(r, g, b2);
|
|
@@ -6692,8 +6667,8 @@
|
|
|
6692
6667
|
const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883;
|
|
6693
6668
|
const x2 = xU > 8856e-6 ? Math.pow(xU, 1 / 3) : 7.787 * xU + 16 / 116;
|
|
6694
6669
|
const y2 = yU > 8856e-6 ? Math.pow(yU, 1 / 3) : 7.787 * yU + 16 / 116;
|
|
6695
|
-
const
|
|
6696
|
-
const color = new Color(x2, y2,
|
|
6670
|
+
const z2 = zU > 8856e-6 ? Math.pow(zU, 1 / 3) : 7.787 * zU + 16 / 116;
|
|
6671
|
+
const color = new Color(x2, y2, z2, "xyz");
|
|
6697
6672
|
return color;
|
|
6698
6673
|
}
|
|
6699
6674
|
/*
|
|
@@ -6828,16 +6803,16 @@
|
|
|
6828
6803
|
return o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null;
|
|
6829
6804
|
}
|
|
6830
6805
|
// left matrix, right matrix, target matrix which is overwritten
|
|
6831
|
-
static matrixMultiply(
|
|
6832
|
-
const a =
|
|
6833
|
-
const b2 =
|
|
6834
|
-
const
|
|
6835
|
-
const d =
|
|
6836
|
-
const e =
|
|
6837
|
-
const f =
|
|
6806
|
+
static matrixMultiply(l2, r, o) {
|
|
6807
|
+
const a = l2.a * r.a + l2.c * r.b;
|
|
6808
|
+
const b2 = l2.b * r.a + l2.d * r.b;
|
|
6809
|
+
const c = l2.a * r.c + l2.c * r.d;
|
|
6810
|
+
const d = l2.b * r.c + l2.d * r.d;
|
|
6811
|
+
const e = l2.e + l2.a * r.e + l2.c * r.f;
|
|
6812
|
+
const f = l2.f + l2.b * r.e + l2.d * r.f;
|
|
6838
6813
|
o.a = a;
|
|
6839
6814
|
o.b = b2;
|
|
6840
|
-
o.c =
|
|
6815
|
+
o.c = c;
|
|
6841
6816
|
o.d = d;
|
|
6842
6817
|
o.e = e;
|
|
6843
6818
|
o.f = f;
|
|
@@ -6860,19 +6835,19 @@
|
|
|
6860
6835
|
decompose(cx2 = 0, cy2 = 0) {
|
|
6861
6836
|
const a = this.a;
|
|
6862
6837
|
const b2 = this.b;
|
|
6863
|
-
const
|
|
6838
|
+
const c = this.c;
|
|
6864
6839
|
const d = this.d;
|
|
6865
6840
|
const e = this.e;
|
|
6866
6841
|
const f = this.f;
|
|
6867
|
-
const determinant = a * d - b2 *
|
|
6842
|
+
const determinant = a * d - b2 * c;
|
|
6868
6843
|
const ccw = determinant > 0 ? 1 : -1;
|
|
6869
6844
|
const sx = ccw * Math.sqrt(a * a + b2 * b2);
|
|
6870
6845
|
const thetaRad = Math.atan2(ccw * b2, ccw * a);
|
|
6871
6846
|
const theta = 180 / Math.PI * thetaRad;
|
|
6872
6847
|
const ct = Math.cos(thetaRad);
|
|
6873
6848
|
const st = Math.sin(thetaRad);
|
|
6874
|
-
const lam = (a *
|
|
6875
|
-
const sy =
|
|
6849
|
+
const lam = (a * c + b2 * d) / determinant;
|
|
6850
|
+
const sy = c * sx / (lam * a - b2) || d * sx / (lam * b2 + a);
|
|
6876
6851
|
const tx = e - cx2 + cx2 * ct * sx + cy2 * (lam * ct * sx - st * sy);
|
|
6877
6852
|
const ty = f - cy2 + cx2 * st * sx + cy2 * (lam * st * sx + ct * sy);
|
|
6878
6853
|
return {
|
|
@@ -6926,15 +6901,15 @@
|
|
|
6926
6901
|
inverseO() {
|
|
6927
6902
|
const a = this.a;
|
|
6928
6903
|
const b2 = this.b;
|
|
6929
|
-
const
|
|
6904
|
+
const c = this.c;
|
|
6930
6905
|
const d = this.d;
|
|
6931
6906
|
const e = this.e;
|
|
6932
6907
|
const f = this.f;
|
|
6933
|
-
const det = a * d - b2 *
|
|
6908
|
+
const det = a * d - b2 * c;
|
|
6934
6909
|
if (!det) throw new Error("Cannot invert " + this);
|
|
6935
6910
|
const na = d / det;
|
|
6936
6911
|
const nb = -b2 / det;
|
|
6937
|
-
const nc = -
|
|
6912
|
+
const nc = -c / det;
|
|
6938
6913
|
const nd = a / det;
|
|
6939
6914
|
const ne = -(na * e + nc * f);
|
|
6940
6915
|
const nf = -(nb * e + nd * f);
|
|
@@ -6951,17 +6926,17 @@
|
|
|
6951
6926
|
}
|
|
6952
6927
|
lmultiplyO(matrix) {
|
|
6953
6928
|
const r = this;
|
|
6954
|
-
const
|
|
6955
|
-
return Matrix.matrixMultiply(
|
|
6929
|
+
const l2 = matrix instanceof Matrix ? matrix : new Matrix(matrix);
|
|
6930
|
+
return Matrix.matrixMultiply(l2, r, this);
|
|
6956
6931
|
}
|
|
6957
6932
|
// Left multiplies by the given matrix
|
|
6958
6933
|
multiply(matrix) {
|
|
6959
6934
|
return this.clone().multiplyO(matrix);
|
|
6960
6935
|
}
|
|
6961
6936
|
multiplyO(matrix) {
|
|
6962
|
-
const
|
|
6937
|
+
const l2 = this;
|
|
6963
6938
|
const r = matrix instanceof Matrix ? matrix : new Matrix(matrix);
|
|
6964
|
-
return Matrix.matrixMultiply(
|
|
6939
|
+
return Matrix.matrixMultiply(l2, r, this);
|
|
6965
6940
|
}
|
|
6966
6941
|
// Rotate matrix
|
|
6967
6942
|
rotate(r, cx2, cy2) {
|
|
@@ -6974,15 +6949,15 @@
|
|
|
6974
6949
|
const {
|
|
6975
6950
|
a,
|
|
6976
6951
|
b: b2,
|
|
6977
|
-
c
|
|
6952
|
+
c,
|
|
6978
6953
|
d,
|
|
6979
6954
|
e,
|
|
6980
6955
|
f
|
|
6981
6956
|
} = this;
|
|
6982
6957
|
this.a = a * cos - b2 * sin;
|
|
6983
6958
|
this.b = b2 * cos + a * sin;
|
|
6984
|
-
this.c =
|
|
6985
|
-
this.d = d * cos +
|
|
6959
|
+
this.c = c * cos - d * sin;
|
|
6960
|
+
this.d = d * cos + c * sin;
|
|
6986
6961
|
this.e = e * cos - f * sin + cy2 * sin - cx2 * cos + cx2;
|
|
6987
6962
|
this.f = f * cos + e * sin - cx2 * sin - cy2 * cos + cy2;
|
|
6988
6963
|
return this;
|
|
@@ -7000,14 +6975,14 @@
|
|
|
7000
6975
|
const {
|
|
7001
6976
|
a,
|
|
7002
6977
|
b: b2,
|
|
7003
|
-
c
|
|
6978
|
+
c,
|
|
7004
6979
|
d,
|
|
7005
6980
|
e,
|
|
7006
6981
|
f
|
|
7007
6982
|
} = this;
|
|
7008
6983
|
this.a = a * x2;
|
|
7009
6984
|
this.b = b2 * y2;
|
|
7010
|
-
this.c =
|
|
6985
|
+
this.c = c * x2;
|
|
7011
6986
|
this.d = d * y2;
|
|
7012
6987
|
this.e = e * x2 - cx2 * x2 + cx2;
|
|
7013
6988
|
this.f = f * y2 - cy2 * y2 + cy2;
|
|
@@ -7021,13 +6996,13 @@
|
|
|
7021
6996
|
const {
|
|
7022
6997
|
a,
|
|
7023
6998
|
b: b2,
|
|
7024
|
-
c
|
|
6999
|
+
c,
|
|
7025
7000
|
d,
|
|
7026
7001
|
e,
|
|
7027
7002
|
f
|
|
7028
7003
|
} = this;
|
|
7029
7004
|
this.a = a + b2 * lx;
|
|
7030
|
-
this.c =
|
|
7005
|
+
this.c = c + d * lx;
|
|
7031
7006
|
this.e = e + f * lx - cy2 * lx;
|
|
7032
7007
|
return this;
|
|
7033
7008
|
}
|
|
@@ -7048,15 +7023,15 @@
|
|
|
7048
7023
|
const {
|
|
7049
7024
|
a,
|
|
7050
7025
|
b: b2,
|
|
7051
|
-
c
|
|
7026
|
+
c,
|
|
7052
7027
|
d,
|
|
7053
7028
|
e,
|
|
7054
7029
|
f
|
|
7055
7030
|
} = this;
|
|
7056
7031
|
this.a = a + b2 * lx;
|
|
7057
7032
|
this.b = b2 + a * ly;
|
|
7058
|
-
this.c =
|
|
7059
|
-
this.d = d +
|
|
7033
|
+
this.c = c + d * lx;
|
|
7034
|
+
this.d = d + c * ly;
|
|
7060
7035
|
this.e = e + f * lx - cy2 * lx;
|
|
7061
7036
|
this.f = f + e * ly - cx2 * ly;
|
|
7062
7037
|
return this;
|
|
@@ -7208,12 +7183,12 @@
|
|
|
7208
7183
|
let yMin = Infinity;
|
|
7209
7184
|
let yMax = -Infinity;
|
|
7210
7185
|
const pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)];
|
|
7211
|
-
pts.forEach(function(
|
|
7212
|
-
|
|
7213
|
-
xMin = Math.min(xMin,
|
|
7214
|
-
xMax = Math.max(xMax,
|
|
7215
|
-
yMin = Math.min(yMin,
|
|
7216
|
-
yMax = Math.max(yMax,
|
|
7186
|
+
pts.forEach(function(p2) {
|
|
7187
|
+
p2 = p2.transform(m);
|
|
7188
|
+
xMin = Math.min(xMin, p2.x);
|
|
7189
|
+
xMax = Math.max(xMax, p2.x);
|
|
7190
|
+
yMin = Math.min(yMin, p2.y);
|
|
7191
|
+
yMax = Math.max(yMax, p2.y);
|
|
7217
7192
|
});
|
|
7218
7193
|
return new Box(xMin, yMin, xMax - xMin, yMax - yMin);
|
|
7219
7194
|
}
|
|
@@ -7363,7 +7338,7 @@
|
|
|
7363
7338
|
if (n.events) n.events = {};
|
|
7364
7339
|
}
|
|
7365
7340
|
function on(node, events, listener, binding, options) {
|
|
7366
|
-
const
|
|
7341
|
+
const l2 = listener.bind(binding || node);
|
|
7367
7342
|
const instance = makeInstance(node);
|
|
7368
7343
|
const bag = getEvents(instance);
|
|
7369
7344
|
const n = getEventTarget(instance);
|
|
@@ -7376,8 +7351,8 @@
|
|
|
7376
7351
|
const ns = event.split(".")[1] || "*";
|
|
7377
7352
|
bag[ev] = bag[ev] || {};
|
|
7378
7353
|
bag[ev][ns] = bag[ev][ns] || {};
|
|
7379
|
-
bag[ev][ns][listener._svgjsListenerId] =
|
|
7380
|
-
n.addEventListener(ev,
|
|
7354
|
+
bag[ev][ns][listener._svgjsListenerId] = l2;
|
|
7355
|
+
n.addEventListener(ev, l2, options || false);
|
|
7381
7356
|
});
|
|
7382
7357
|
}
|
|
7383
7358
|
function off(node, events, listener, options) {
|
|
@@ -7392,7 +7367,7 @@
|
|
|
7392
7367
|
events.forEach(function(event) {
|
|
7393
7368
|
const ev = event && event.split(".")[0];
|
|
7394
7369
|
const ns = event && event.split(".")[1];
|
|
7395
|
-
let namespace,
|
|
7370
|
+
let namespace, l2;
|
|
7396
7371
|
if (listener) {
|
|
7397
7372
|
if (bag[ev] && bag[ev][ns || "*"]) {
|
|
7398
7373
|
n.removeEventListener(ev, bag[ev][ns || "*"][listener], options || false);
|
|
@@ -7400,8 +7375,8 @@
|
|
|
7400
7375
|
}
|
|
7401
7376
|
} else if (ev && ns) {
|
|
7402
7377
|
if (bag[ev] && bag[ev][ns]) {
|
|
7403
|
-
for (
|
|
7404
|
-
off(n, [ev, ns].join("."),
|
|
7378
|
+
for (l2 in bag[ev][ns]) {
|
|
7379
|
+
off(n, [ev, ns].join("."), l2);
|
|
7405
7380
|
}
|
|
7406
7381
|
delete bag[ev][ns];
|
|
7407
7382
|
}
|
|
@@ -7981,8 +7956,8 @@
|
|
|
7981
7956
|
}
|
|
7982
7957
|
// Get parent document
|
|
7983
7958
|
root() {
|
|
7984
|
-
const
|
|
7985
|
-
return
|
|
7959
|
+
const p2 = this.parent(getClass(root));
|
|
7960
|
+
return p2 && p2.root();
|
|
7986
7961
|
}
|
|
7987
7962
|
// set given data to the elements data property
|
|
7988
7963
|
setData(o) {
|
|
@@ -7991,8 +7966,8 @@
|
|
|
7991
7966
|
}
|
|
7992
7967
|
// Set element size to given width and height
|
|
7993
7968
|
size(width2, height2) {
|
|
7994
|
-
const
|
|
7995
|
-
return this.width(new SVGNumber(
|
|
7969
|
+
const p2 = proportionalSize(this, width2, height2);
|
|
7970
|
+
return this.width(new SVGNumber(p2.width)).height(new SVGNumber(p2.height));
|
|
7996
7971
|
}
|
|
7997
7972
|
// Set width of element
|
|
7998
7973
|
width(width2) {
|
|
@@ -8053,11 +8028,11 @@
|
|
|
8053
8028
|
});
|
|
8054
8029
|
registerMethods(["Element", "Runner"], {
|
|
8055
8030
|
// Let the user set the matrix directly
|
|
8056
|
-
matrix: function(mat, b2,
|
|
8031
|
+
matrix: function(mat, b2, c, d, e, f) {
|
|
8057
8032
|
if (mat == null) {
|
|
8058
8033
|
return new Matrix(this);
|
|
8059
8034
|
}
|
|
8060
|
-
return this.attr("transform", new Matrix(mat, b2,
|
|
8035
|
+
return this.attr("transform", new Matrix(mat, b2, c, d, e, f));
|
|
8061
8036
|
},
|
|
8062
8037
|
// Map rotation to transform
|
|
8063
8038
|
rotate: function(angle, cx2, cy2) {
|
|
@@ -8288,8 +8263,8 @@
|
|
|
8288
8263
|
super(nodeOrNew("ellipse", node), attrs2);
|
|
8289
8264
|
}
|
|
8290
8265
|
size(width2, height2) {
|
|
8291
|
-
const
|
|
8292
|
-
return this.rx(new SVGNumber(
|
|
8266
|
+
const p2 = proportionalSize(this, width2, height2);
|
|
8267
|
+
return this.rx(new SVGNumber(p2.width).divide(2)).ry(new SVGNumber(p2.height).divide(2));
|
|
8293
8268
|
}
|
|
8294
8269
|
}
|
|
8295
8270
|
extend(Ellipse, circled);
|
|
@@ -8348,9 +8323,9 @@
|
|
|
8348
8323
|
super(nodeOrNew(type + "Gradient", typeof type === "string" ? null : type), attrs2);
|
|
8349
8324
|
}
|
|
8350
8325
|
// custom attr to handle transform
|
|
8351
|
-
attr(a, b2,
|
|
8326
|
+
attr(a, b2, c) {
|
|
8352
8327
|
if (a === "transform") a = "gradientTransform";
|
|
8353
|
-
return super.attr(a, b2,
|
|
8328
|
+
return super.attr(a, b2, c);
|
|
8354
8329
|
}
|
|
8355
8330
|
bbox() {
|
|
8356
8331
|
return new Box();
|
|
@@ -8397,9 +8372,9 @@
|
|
|
8397
8372
|
super(nodeOrNew("pattern", node), attrs2);
|
|
8398
8373
|
}
|
|
8399
8374
|
// custom attr to handle transform
|
|
8400
|
-
attr(a, b2,
|
|
8375
|
+
attr(a, b2, c) {
|
|
8401
8376
|
if (a === "transform") a = "patternTransform";
|
|
8402
|
-
return super.attr(a, b2,
|
|
8377
|
+
return super.attr(a, b2, c);
|
|
8403
8378
|
}
|
|
8404
8379
|
bbox() {
|
|
8405
8380
|
return new Box();
|
|
@@ -8453,13 +8428,13 @@
|
|
|
8453
8428
|
if (!url) return this;
|
|
8454
8429
|
const img = new globals.window.Image();
|
|
8455
8430
|
on(img, "load", function(e) {
|
|
8456
|
-
const
|
|
8431
|
+
const p2 = this.parent(Pattern);
|
|
8457
8432
|
if (this.width() === 0 && this.height() === 0) {
|
|
8458
8433
|
this.size(img.width, img.height);
|
|
8459
8434
|
}
|
|
8460
|
-
if (
|
|
8461
|
-
if (
|
|
8462
|
-
|
|
8435
|
+
if (p2 instanceof Pattern) {
|
|
8436
|
+
if (p2.width() === 0 && p2.height() === 0) {
|
|
8437
|
+
p2.size(this.width(), this.height());
|
|
8463
8438
|
}
|
|
8464
8439
|
}
|
|
8465
8440
|
if (typeof callback === "function") {
|
|
@@ -8632,8 +8607,8 @@
|
|
|
8632
8607
|
}
|
|
8633
8608
|
// Set element size to given width and height
|
|
8634
8609
|
size(width2, height2) {
|
|
8635
|
-
const
|
|
8636
|
-
return this.attr(this.array().size(
|
|
8610
|
+
const p2 = proportionalSize(this, width2, height2);
|
|
8611
|
+
return this.attr(this.array().size(p2.width, p2.height).toLine());
|
|
8637
8612
|
}
|
|
8638
8613
|
}
|
|
8639
8614
|
extend(Line, pointed);
|
|
@@ -8797,11 +8772,11 @@
|
|
|
8797
8772
|
super();
|
|
8798
8773
|
this.stepper = fn;
|
|
8799
8774
|
}
|
|
8800
|
-
done(
|
|
8801
|
-
return
|
|
8775
|
+
done(c) {
|
|
8776
|
+
return c.done;
|
|
8802
8777
|
}
|
|
8803
|
-
step(current, target, dt,
|
|
8804
|
-
return this.stepper(current, target, dt,
|
|
8778
|
+
step(current, target, dt, c) {
|
|
8779
|
+
return this.stepper(current, target, dt, c);
|
|
8805
8780
|
}
|
|
8806
8781
|
}
|
|
8807
8782
|
function recalculate() {
|
|
@@ -8820,19 +8795,19 @@
|
|
|
8820
8795
|
super();
|
|
8821
8796
|
this.duration(duration).overshoot(overshoot);
|
|
8822
8797
|
}
|
|
8823
|
-
step(current, target, dt,
|
|
8798
|
+
step(current, target, dt, c) {
|
|
8824
8799
|
if (typeof current === "string") return current;
|
|
8825
|
-
|
|
8800
|
+
c.done = dt === Infinity;
|
|
8826
8801
|
if (dt === Infinity) return target;
|
|
8827
8802
|
if (dt === 0) return current;
|
|
8828
8803
|
if (dt > 100) dt = 16;
|
|
8829
8804
|
dt /= 1e3;
|
|
8830
|
-
const velocity =
|
|
8805
|
+
const velocity = c.velocity || 0;
|
|
8831
8806
|
const acceleration = -this.d * velocity - this.k * (current - target);
|
|
8832
8807
|
const newPosition = current + velocity * dt + acceleration * dt * dt / 2;
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
return
|
|
8808
|
+
c.velocity = velocity + acceleration * dt;
|
|
8809
|
+
c.done = Math.abs(target - newPosition) + Math.abs(velocity) < 2e-3;
|
|
8810
|
+
return c.done ? target : newPosition;
|
|
8836
8811
|
}
|
|
8837
8812
|
}
|
|
8838
8813
|
extend(Spring, {
|
|
@@ -8840,26 +8815,26 @@
|
|
|
8840
8815
|
overshoot: makeSetterGetter("_overshoot", recalculate)
|
|
8841
8816
|
});
|
|
8842
8817
|
class PID extends Controller {
|
|
8843
|
-
constructor(
|
|
8818
|
+
constructor(p2 = 0.1, i = 0.01, d = 0, windup = 1e3) {
|
|
8844
8819
|
super();
|
|
8845
|
-
this.p(
|
|
8820
|
+
this.p(p2).i(i).d(d).windup(windup);
|
|
8846
8821
|
}
|
|
8847
|
-
step(current, target, dt,
|
|
8822
|
+
step(current, target, dt, c) {
|
|
8848
8823
|
if (typeof current === "string") return current;
|
|
8849
|
-
|
|
8824
|
+
c.done = dt === Infinity;
|
|
8850
8825
|
if (dt === Infinity) return target;
|
|
8851
8826
|
if (dt === 0) return current;
|
|
8852
|
-
const
|
|
8853
|
-
let i = (
|
|
8854
|
-
const d = (
|
|
8827
|
+
const p2 = target - current;
|
|
8828
|
+
let i = (c.integral || 0) + p2 * dt;
|
|
8829
|
+
const d = (p2 - (c.error || 0)) / dt;
|
|
8855
8830
|
const windup = this._windup;
|
|
8856
8831
|
if (windup !== false) {
|
|
8857
8832
|
i = Math.max(-windup, Math.min(i, windup));
|
|
8858
8833
|
}
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
return
|
|
8834
|
+
c.error = p2;
|
|
8835
|
+
c.integral = i;
|
|
8836
|
+
c.done = Math.abs(p2) < 1e-3;
|
|
8837
|
+
return c.done ? target : current + (this.P * p2 + this.I * i + this.D * d);
|
|
8863
8838
|
}
|
|
8864
8839
|
}
|
|
8865
8840
|
extend(PID, {
|
|
@@ -8881,72 +8856,72 @@
|
|
|
8881
8856
|
Z: 0
|
|
8882
8857
|
};
|
|
8883
8858
|
const pathHandlers = {
|
|
8884
|
-
M: function(
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
return ["M",
|
|
8859
|
+
M: function(c, p2, p0) {
|
|
8860
|
+
p2.x = p0.x = c[0];
|
|
8861
|
+
p2.y = p0.y = c[1];
|
|
8862
|
+
return ["M", p2.x, p2.y];
|
|
8888
8863
|
},
|
|
8889
|
-
L: function(
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
return ["L",
|
|
8864
|
+
L: function(c, p2) {
|
|
8865
|
+
p2.x = c[0];
|
|
8866
|
+
p2.y = c[1];
|
|
8867
|
+
return ["L", c[0], c[1]];
|
|
8893
8868
|
},
|
|
8894
|
-
H: function(
|
|
8895
|
-
|
|
8896
|
-
return ["H",
|
|
8869
|
+
H: function(c, p2) {
|
|
8870
|
+
p2.x = c[0];
|
|
8871
|
+
return ["H", c[0]];
|
|
8897
8872
|
},
|
|
8898
|
-
V: function(
|
|
8899
|
-
|
|
8900
|
-
return ["V",
|
|
8873
|
+
V: function(c, p2) {
|
|
8874
|
+
p2.y = c[0];
|
|
8875
|
+
return ["V", c[0]];
|
|
8901
8876
|
},
|
|
8902
|
-
C: function(
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
return ["C",
|
|
8877
|
+
C: function(c, p2) {
|
|
8878
|
+
p2.x = c[4];
|
|
8879
|
+
p2.y = c[5];
|
|
8880
|
+
return ["C", c[0], c[1], c[2], c[3], c[4], c[5]];
|
|
8906
8881
|
},
|
|
8907
|
-
S: function(
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
return ["S",
|
|
8882
|
+
S: function(c, p2) {
|
|
8883
|
+
p2.x = c[2];
|
|
8884
|
+
p2.y = c[3];
|
|
8885
|
+
return ["S", c[0], c[1], c[2], c[3]];
|
|
8911
8886
|
},
|
|
8912
|
-
Q: function(
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
return ["Q",
|
|
8887
|
+
Q: function(c, p2) {
|
|
8888
|
+
p2.x = c[2];
|
|
8889
|
+
p2.y = c[3];
|
|
8890
|
+
return ["Q", c[0], c[1], c[2], c[3]];
|
|
8916
8891
|
},
|
|
8917
|
-
T: function(
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
return ["T",
|
|
8892
|
+
T: function(c, p2) {
|
|
8893
|
+
p2.x = c[0];
|
|
8894
|
+
p2.y = c[1];
|
|
8895
|
+
return ["T", c[0], c[1]];
|
|
8921
8896
|
},
|
|
8922
|
-
Z: function(
|
|
8923
|
-
|
|
8924
|
-
|
|
8897
|
+
Z: function(c, p2, p0) {
|
|
8898
|
+
p2.x = p0.x;
|
|
8899
|
+
p2.y = p0.y;
|
|
8925
8900
|
return ["Z"];
|
|
8926
8901
|
},
|
|
8927
|
-
A: function(
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
return ["A",
|
|
8902
|
+
A: function(c, p2) {
|
|
8903
|
+
p2.x = c[5];
|
|
8904
|
+
p2.y = c[6];
|
|
8905
|
+
return ["A", c[0], c[1], c[2], c[3], c[4], c[5], c[6]];
|
|
8931
8906
|
}
|
|
8932
8907
|
};
|
|
8933
8908
|
const mlhvqtcsaz = "mlhvqtcsaz".split("");
|
|
8934
8909
|
for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {
|
|
8935
|
-
pathHandlers[mlhvqtcsaz[i]] = /* @__PURE__ */ function(i2) {
|
|
8936
|
-
return function(
|
|
8937
|
-
if (i2 === "H")
|
|
8938
|
-
else if (i2 === "V")
|
|
8910
|
+
pathHandlers[mlhvqtcsaz[i]] = /* @__PURE__ */ (function(i2) {
|
|
8911
|
+
return function(c, p2, p0) {
|
|
8912
|
+
if (i2 === "H") c[0] = c[0] + p2.x;
|
|
8913
|
+
else if (i2 === "V") c[0] = c[0] + p2.y;
|
|
8939
8914
|
else if (i2 === "A") {
|
|
8940
|
-
|
|
8941
|
-
|
|
8915
|
+
c[5] = c[5] + p2.x;
|
|
8916
|
+
c[6] = c[6] + p2.y;
|
|
8942
8917
|
} else {
|
|
8943
|
-
for (let j = 0, jl =
|
|
8944
|
-
|
|
8918
|
+
for (let j = 0, jl = c.length; j < jl; ++j) {
|
|
8919
|
+
c[j] = c[j] + (j % 2 ? p2.y : p2.x);
|
|
8945
8920
|
}
|
|
8946
8921
|
}
|
|
8947
|
-
return pathHandlers[i2](
|
|
8922
|
+
return pathHandlers[i2](c, p2, p0);
|
|
8948
8923
|
};
|
|
8949
|
-
}(mlhvqtcsaz[i].toUpperCase());
|
|
8924
|
+
})(mlhvqtcsaz[i].toUpperCase());
|
|
8950
8925
|
}
|
|
8951
8926
|
function makeAbsolut(parser2) {
|
|
8952
8927
|
const command = parser2.segment[0];
|
|
@@ -9123,25 +9098,25 @@
|
|
|
9123
9098
|
x2 -= box.x;
|
|
9124
9099
|
y2 -= box.y;
|
|
9125
9100
|
if (!isNaN(x2) && !isNaN(y2)) {
|
|
9126
|
-
for (let
|
|
9127
|
-
|
|
9128
|
-
if (
|
|
9101
|
+
for (let l2, i = this.length - 1; i >= 0; i--) {
|
|
9102
|
+
l2 = this[i][0];
|
|
9103
|
+
if (l2 === "M" || l2 === "L" || l2 === "T") {
|
|
9129
9104
|
this[i][1] += x2;
|
|
9130
9105
|
this[i][2] += y2;
|
|
9131
|
-
} else if (
|
|
9106
|
+
} else if (l2 === "H") {
|
|
9132
9107
|
this[i][1] += x2;
|
|
9133
|
-
} else if (
|
|
9108
|
+
} else if (l2 === "V") {
|
|
9134
9109
|
this[i][1] += y2;
|
|
9135
|
-
} else if (
|
|
9110
|
+
} else if (l2 === "C" || l2 === "S" || l2 === "Q") {
|
|
9136
9111
|
this[i][1] += x2;
|
|
9137
9112
|
this[i][2] += y2;
|
|
9138
9113
|
this[i][3] += x2;
|
|
9139
9114
|
this[i][4] += y2;
|
|
9140
|
-
if (
|
|
9115
|
+
if (l2 === "C") {
|
|
9141
9116
|
this[i][5] += x2;
|
|
9142
9117
|
this[i][6] += y2;
|
|
9143
9118
|
}
|
|
9144
|
-
} else if (
|
|
9119
|
+
} else if (l2 === "A") {
|
|
9145
9120
|
this[i][6] += x2;
|
|
9146
9121
|
this[i][7] += y2;
|
|
9147
9122
|
}
|
|
@@ -9159,28 +9134,28 @@
|
|
|
9159
9134
|
// Resize path string
|
|
9160
9135
|
size(width2, height2) {
|
|
9161
9136
|
const box = this.bbox();
|
|
9162
|
-
let i,
|
|
9137
|
+
let i, l2;
|
|
9163
9138
|
box.width = box.width === 0 ? 1 : box.width;
|
|
9164
9139
|
box.height = box.height === 0 ? 1 : box.height;
|
|
9165
9140
|
for (i = this.length - 1; i >= 0; i--) {
|
|
9166
|
-
|
|
9167
|
-
if (
|
|
9141
|
+
l2 = this[i][0];
|
|
9142
|
+
if (l2 === "M" || l2 === "L" || l2 === "T") {
|
|
9168
9143
|
this[i][1] = (this[i][1] - box.x) * width2 / box.width + box.x;
|
|
9169
9144
|
this[i][2] = (this[i][2] - box.y) * height2 / box.height + box.y;
|
|
9170
|
-
} else if (
|
|
9145
|
+
} else if (l2 === "H") {
|
|
9171
9146
|
this[i][1] = (this[i][1] - box.x) * width2 / box.width + box.x;
|
|
9172
|
-
} else if (
|
|
9147
|
+
} else if (l2 === "V") {
|
|
9173
9148
|
this[i][1] = (this[i][1] - box.y) * height2 / box.height + box.y;
|
|
9174
|
-
} else if (
|
|
9149
|
+
} else if (l2 === "C" || l2 === "S" || l2 === "Q") {
|
|
9175
9150
|
this[i][1] = (this[i][1] - box.x) * width2 / box.width + box.x;
|
|
9176
9151
|
this[i][2] = (this[i][2] - box.y) * height2 / box.height + box.y;
|
|
9177
9152
|
this[i][3] = (this[i][3] - box.x) * width2 / box.width + box.x;
|
|
9178
9153
|
this[i][4] = (this[i][4] - box.y) * height2 / box.height + box.y;
|
|
9179
|
-
if (
|
|
9154
|
+
if (l2 === "C") {
|
|
9180
9155
|
this[i][5] = (this[i][5] - box.x) * width2 / box.width + box.x;
|
|
9181
9156
|
this[i][6] = (this[i][6] - box.y) * height2 / box.height + box.y;
|
|
9182
9157
|
}
|
|
9183
|
-
} else if (
|
|
9158
|
+
} else if (l2 === "A") {
|
|
9184
9159
|
this[i][1] = this[i][1] * width2 / box.width;
|
|
9185
9160
|
this[i][2] = this[i][2] * height2 / box.height;
|
|
9186
9161
|
this[i][6] = (this[i][6] - box.x) * width2 / box.width + box.x;
|
|
@@ -9447,8 +9422,8 @@
|
|
|
9447
9422
|
}
|
|
9448
9423
|
// Set element size to given width and height
|
|
9449
9424
|
size(width2, height2) {
|
|
9450
|
-
const
|
|
9451
|
-
return this.attr("d", this.array().size(
|
|
9425
|
+
const p2 = proportionalSize(this, width2, height2);
|
|
9426
|
+
return this.attr("d", this.array().size(p2.width, p2.height));
|
|
9452
9427
|
}
|
|
9453
9428
|
// Set width of element
|
|
9454
9429
|
width(width2) {
|
|
@@ -9483,12 +9458,12 @@
|
|
|
9483
9458
|
function move$2(x2, y2) {
|
|
9484
9459
|
return this.attr("points", this.array().move(x2, y2));
|
|
9485
9460
|
}
|
|
9486
|
-
function plot(
|
|
9487
|
-
return
|
|
9461
|
+
function plot(p2) {
|
|
9462
|
+
return p2 == null ? this.array() : this.clear().attr("points", typeof p2 === "string" ? p2 : this._array = new PointArray(p2));
|
|
9488
9463
|
}
|
|
9489
9464
|
function size$1(width2, height2) {
|
|
9490
|
-
const
|
|
9491
|
-
return this.attr("points", this.array().size(
|
|
9465
|
+
const p2 = proportionalSize(this, width2, height2);
|
|
9466
|
+
return this.attr("points", this.array().size(p2.width, p2.height));
|
|
9492
9467
|
}
|
|
9493
9468
|
var poly = {
|
|
9494
9469
|
__proto__: null,
|
|
@@ -9507,8 +9482,8 @@
|
|
|
9507
9482
|
registerMethods({
|
|
9508
9483
|
Container: {
|
|
9509
9484
|
// Create a wrapped polygon element
|
|
9510
|
-
polygon: wrapWithAttrCheck(function(
|
|
9511
|
-
return this.put(new Polygon()).plot(
|
|
9485
|
+
polygon: wrapWithAttrCheck(function(p2) {
|
|
9486
|
+
return this.put(new Polygon()).plot(p2 || new PointArray());
|
|
9512
9487
|
})
|
|
9513
9488
|
}
|
|
9514
9489
|
});
|
|
@@ -9524,8 +9499,8 @@
|
|
|
9524
9499
|
registerMethods({
|
|
9525
9500
|
Container: {
|
|
9526
9501
|
// Create a wrapped polygon element
|
|
9527
|
-
polyline: wrapWithAttrCheck(function(
|
|
9528
|
-
return this.put(new Polyline()).plot(
|
|
9502
|
+
polyline: wrapWithAttrCheck(function(p2) {
|
|
9503
|
+
return this.put(new Polyline()).plot(p2 || new PointArray());
|
|
9529
9504
|
})
|
|
9530
9505
|
}
|
|
9531
9506
|
});
|
|
@@ -10030,16 +10005,16 @@
|
|
|
10030
10005
|
}
|
|
10031
10006
|
return this;
|
|
10032
10007
|
}
|
|
10033
|
-
loops(
|
|
10008
|
+
loops(p2) {
|
|
10034
10009
|
const loopDuration = this._duration + this._wait;
|
|
10035
|
-
if (
|
|
10010
|
+
if (p2 == null) {
|
|
10036
10011
|
const loopsDone = Math.floor(this._time / loopDuration);
|
|
10037
10012
|
const relativeTime = this._time - loopsDone * loopDuration;
|
|
10038
10013
|
const position2 = relativeTime / this._duration;
|
|
10039
10014
|
return Math.min(loopsDone + position2, this._times);
|
|
10040
10015
|
}
|
|
10041
|
-
const whole = Math.floor(
|
|
10042
|
-
const partial =
|
|
10016
|
+
const whole = Math.floor(p2);
|
|
10017
|
+
const partial = p2 % 1;
|
|
10043
10018
|
const time = loopDuration * whole + this._duration * partial;
|
|
10044
10019
|
return this.time(time);
|
|
10045
10020
|
}
|
|
@@ -10048,7 +10023,7 @@
|
|
|
10048
10023
|
this._persist = dtOrForever;
|
|
10049
10024
|
return this;
|
|
10050
10025
|
}
|
|
10051
|
-
position(
|
|
10026
|
+
position(p2) {
|
|
10052
10027
|
const x2 = this._time;
|
|
10053
10028
|
const d = this._duration;
|
|
10054
10029
|
const w = this._wait;
|
|
@@ -10056,7 +10031,7 @@
|
|
|
10056
10031
|
const s = this._swing;
|
|
10057
10032
|
const r = this._reverse;
|
|
10058
10033
|
let position2;
|
|
10059
|
-
if (
|
|
10034
|
+
if (p2 == null) {
|
|
10060
10035
|
const f = function(x3) {
|
|
10061
10036
|
const swinging = s * Math.floor(x3 % (2 * (w + d)) / (w + d));
|
|
10062
10037
|
const backwards = swinging && !r || !swinging && r;
|
|
@@ -10071,14 +10046,14 @@
|
|
|
10071
10046
|
const loopsDone = Math.floor(this.loops());
|
|
10072
10047
|
const swingForward = s && loopsDone % 2 === 0;
|
|
10073
10048
|
const forwards = swingForward && !r || r && swingForward;
|
|
10074
|
-
position2 = loopsDone + (forwards ?
|
|
10049
|
+
position2 = loopsDone + (forwards ? p2 : 1 - p2);
|
|
10075
10050
|
return this.loops(position2);
|
|
10076
10051
|
}
|
|
10077
|
-
progress(
|
|
10078
|
-
if (
|
|
10052
|
+
progress(p2) {
|
|
10053
|
+
if (p2 == null) {
|
|
10079
10054
|
return Math.min(1, this._time / this.duration());
|
|
10080
10055
|
}
|
|
10081
|
-
return this.time(
|
|
10056
|
+
return this.time(p2 * this.duration());
|
|
10082
10057
|
}
|
|
10083
10058
|
/*
|
|
10084
10059
|
Basic Functionality
|
|
@@ -10577,9 +10552,9 @@
|
|
|
10577
10552
|
return this._queueNumber("height", height2);
|
|
10578
10553
|
},
|
|
10579
10554
|
// Add animatable plot
|
|
10580
|
-
plot(a, b2,
|
|
10555
|
+
plot(a, b2, c, d) {
|
|
10581
10556
|
if (arguments.length === 4) {
|
|
10582
|
-
return this.plot([a, b2,
|
|
10557
|
+
return this.plot([a, b2, c, d]);
|
|
10583
10558
|
}
|
|
10584
10559
|
if (this._tryRetarget("plot", a)) return this;
|
|
10585
10560
|
const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a);
|
|
@@ -10992,8 +10967,8 @@
|
|
|
10992
10967
|
}
|
|
10993
10968
|
const m = new Matrix(child);
|
|
10994
10969
|
const matrix = m.translate(dx2, dy2).transform(m.inverse());
|
|
10995
|
-
const
|
|
10996
|
-
child.move(
|
|
10970
|
+
const p2 = new Point(bbox2.x, bbox2.y).transform(matrix);
|
|
10971
|
+
child.move(p2.x, p2.y);
|
|
10997
10972
|
});
|
|
10998
10973
|
return this;
|
|
10999
10974
|
}
|
|
@@ -11013,9 +10988,9 @@
|
|
|
11013
10988
|
return this.dmove(dx2, dy2);
|
|
11014
10989
|
}
|
|
11015
10990
|
function size(width2, height2, box = this.bbox()) {
|
|
11016
|
-
const
|
|
11017
|
-
const scaleX =
|
|
11018
|
-
const scaleY =
|
|
10991
|
+
const p2 = proportionalSize(this, width2, height2, box);
|
|
10992
|
+
const scaleX = p2.width / box.width;
|
|
10993
|
+
const scaleY = p2.height / box.height;
|
|
11019
10994
|
this.children().forEach((child, i) => {
|
|
11020
10995
|
const o = new Point(box).transform(new Matrix(child).inverse());
|
|
11021
10996
|
child.scale(scaleX, scaleY, o.x, o.y);
|
|
@@ -11344,7 +11319,7 @@
|
|
|
11344
11319
|
case "rect": {
|
|
11345
11320
|
let {
|
|
11346
11321
|
width: w,
|
|
11347
|
-
height:
|
|
11322
|
+
height: h,
|
|
11348
11323
|
rx: rx2,
|
|
11349
11324
|
ry: ry2,
|
|
11350
11325
|
x: x2,
|
|
@@ -11355,17 +11330,17 @@
|
|
|
11355
11330
|
rx2 = rx2 || ry2;
|
|
11356
11331
|
ry2 = ry2 || rx2;
|
|
11357
11332
|
if (rx2 > w / 2) rx2 = w / 2;
|
|
11358
|
-
if (ry2 >
|
|
11333
|
+
if (ry2 > h / 2) ry2 = h / 2;
|
|
11359
11334
|
if (rx2 && ry2) {
|
|
11360
11335
|
d = [
|
|
11361
11336
|
["M", rx2 + x2, y2],
|
|
11362
11337
|
["h", w - 2 * rx2],
|
|
11363
11338
|
["a", rx2, ry2, 0, 0, 1, rx2, ry2],
|
|
11364
|
-
["v",
|
|
11339
|
+
["v", h - 2 * ry2],
|
|
11365
11340
|
["a", rx2, ry2, 0, 0, 1, -rx2, ry2],
|
|
11366
11341
|
["h", -w + 2 * rx2],
|
|
11367
11342
|
["a", rx2, ry2, 0, 0, 1, -rx2, -ry2],
|
|
11368
|
-
["v", -
|
|
11343
|
+
["v", -h + 2 * ry2],
|
|
11369
11344
|
["a", rx2, ry2, 0, 0, 1, rx2, -ry2],
|
|
11370
11345
|
["z"]
|
|
11371
11346
|
];
|
|
@@ -11373,9 +11348,9 @@
|
|
|
11373
11348
|
d = [
|
|
11374
11349
|
["M", x2, y2],
|
|
11375
11350
|
["h", w],
|
|
11376
|
-
["v",
|
|
11351
|
+
["v", h],
|
|
11377
11352
|
["h", -w],
|
|
11378
|
-
["v", -
|
|
11353
|
+
["v", -h],
|
|
11379
11354
|
["z"]
|
|
11380
11355
|
];
|
|
11381
11356
|
}
|
|
@@ -11495,13 +11470,13 @@
|
|
|
11495
11470
|
}
|
|
11496
11471
|
function getSVGPathCommands(points, closed = true) {
|
|
11497
11472
|
const cmds = new Array();
|
|
11498
|
-
let
|
|
11473
|
+
let p2;
|
|
11499
11474
|
if (points.length > 0) {
|
|
11500
|
-
|
|
11501
|
-
cmds.push(["M", round(
|
|
11475
|
+
p2 = points[0];
|
|
11476
|
+
cmds.push(["M", round(p2.x), round(p2.y)]);
|
|
11502
11477
|
for (let i = 1; i < points.length; i++) {
|
|
11503
|
-
|
|
11504
|
-
cmds.push(["L", round(
|
|
11478
|
+
p2 = points[i];
|
|
11479
|
+
cmds.push(["L", round(p2.x), round(p2.y)]);
|
|
11505
11480
|
}
|
|
11506
11481
|
if (closed) {
|
|
11507
11482
|
cmds.push(["Z"]);
|
|
@@ -11567,7 +11542,7 @@
|
|
|
11567
11542
|
svg2.add(group);
|
|
11568
11543
|
for (const mesh of viewmap.meshes) {
|
|
11569
11544
|
if (mesh.drawFills) {
|
|
11570
|
-
const polygons = viewmap.polygons.filter((
|
|
11545
|
+
const polygons = viewmap.polygons.filter((p2) => p2.mesh === mesh);
|
|
11571
11546
|
const objectGroup = new G({ id: mesh.name });
|
|
11572
11547
|
group.add(objectGroup);
|
|
11573
11548
|
for (const polygon of polygons) {
|
|
@@ -11618,7 +11593,7 @@
|
|
|
11618
11593
|
}
|
|
11619
11594
|
}
|
|
11620
11595
|
if (img) {
|
|
11621
|
-
const patternAndImages = svg2.defs().children().filter((
|
|
11596
|
+
const patternAndImages = svg2.defs().children().filter((c) => c instanceof Pattern && c.children().length === 1).map((c) => [c, c.children()[0]]);
|
|
11622
11597
|
patternAndImages.forEach(([pattern, image]) => {
|
|
11623
11598
|
pattern.x(0);
|
|
11624
11599
|
pattern.y(0);
|
|
@@ -11703,7 +11678,7 @@
|
|
|
11703
11678
|
super(options);
|
|
11704
11679
|
}
|
|
11705
11680
|
async draw(svg2, viewmap) {
|
|
11706
|
-
const chains = viewmap.chains.filter((
|
|
11681
|
+
const chains = viewmap.chains.filter((c) => c.visibility === ChainVisibility.Visible);
|
|
11707
11682
|
const meshes = Array.from(viewmap.meshes).filter((m) => m.drawVisibleContours);
|
|
11708
11683
|
const group = new G({ id: "visible-contours" });
|
|
11709
11684
|
drawChains(group, meshes, chains, this.options);
|
|
@@ -11725,7 +11700,7 @@
|
|
|
11725
11700
|
}
|
|
11726
11701
|
async draw(svg2, viewmap) {
|
|
11727
11702
|
const chains = viewmap.chains.filter(
|
|
11728
|
-
(
|
|
11703
|
+
(c) => c.visibility === ChainVisibility.Hidden
|
|
11729
11704
|
);
|
|
11730
11705
|
const meshes = Array.from(viewmap.meshes).filter((m) => m.drawHiddenContours);
|
|
11731
11706
|
const group = new G({ id: "hidden-contours" });
|
|
@@ -11734,19 +11709,18 @@
|
|
|
11734
11709
|
}
|
|
11735
11710
|
}
|
|
11736
11711
|
function drawChains(parent, meshes, chains, options) {
|
|
11737
|
-
var _a;
|
|
11738
11712
|
const { defaultStyle, styles } = options;
|
|
11739
11713
|
ViewEdgesNatures.sort(
|
|
11740
11714
|
(n1, n2) => (styles[n1].drawOrder ?? 0) - (styles[n2].drawOrder ?? 0)
|
|
11741
11715
|
);
|
|
11742
11716
|
for (const mesh of meshes) {
|
|
11743
|
-
const objectChains = chains.filter((
|
|
11717
|
+
const objectChains = chains.filter((c) => c.object === mesh);
|
|
11744
11718
|
const objectGroup = new G({ id: mesh.name });
|
|
11745
11719
|
parent.add(objectGroup);
|
|
11746
11720
|
for (const nature of ViewEdgesNatures) {
|
|
11747
|
-
if (
|
|
11721
|
+
if (styles[nature]?.enabled) {
|
|
11748
11722
|
const strokeStyle = { ...defaultStyle, ...styles[nature] };
|
|
11749
|
-
const natureChains = objectChains.filter((
|
|
11723
|
+
const natureChains = objectChains.filter((c) => c.nature === nature);
|
|
11750
11724
|
const natureGroup = new G({ id: nature });
|
|
11751
11725
|
objectGroup.add(natureGroup);
|
|
11752
11726
|
for (const chain of natureChains) {
|
|
@@ -11793,7 +11767,7 @@
|
|
|
11793
11767
|
}
|
|
11794
11768
|
const EPSILON = 1e-10;
|
|
11795
11769
|
const _matrix = new three.Matrix4();
|
|
11796
|
-
function orient3D(a, b2,
|
|
11770
|
+
function orient3D(a, b2, c, d) {
|
|
11797
11771
|
_matrix.set(
|
|
11798
11772
|
a.x,
|
|
11799
11773
|
a.y,
|
|
@@ -11803,9 +11777,9 @@
|
|
|
11803
11777
|
b2.y,
|
|
11804
11778
|
b2.z,
|
|
11805
11779
|
1,
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11780
|
+
c.x,
|
|
11781
|
+
c.y,
|
|
11782
|
+
c.z,
|
|
11809
11783
|
1,
|
|
11810
11784
|
d.x,
|
|
11811
11785
|
d.y,
|
|
@@ -11820,8 +11794,8 @@
|
|
|
11820
11794
|
}
|
|
11821
11795
|
return 0;
|
|
11822
11796
|
}
|
|
11823
|
-
function frontSide(a, b2,
|
|
11824
|
-
return orient3D(d, b2,
|
|
11797
|
+
function frontSide(a, b2, c, d) {
|
|
11798
|
+
return orient3D(d, b2, c, a);
|
|
11825
11799
|
}
|
|
11826
11800
|
const _u$1 = new three.Vector3();
|
|
11827
11801
|
const _v = new three.Vector3();
|
|
@@ -12076,13 +12050,13 @@
|
|
|
12076
12050
|
}
|
|
12077
12051
|
const b2 = halfIn.next;
|
|
12078
12052
|
const d = halfOut.prev;
|
|
12079
|
-
const
|
|
12053
|
+
const h = g.next;
|
|
12080
12054
|
halfIn.next = halfOut;
|
|
12081
12055
|
halfOut.prev = halfIn;
|
|
12082
12056
|
g.next = b2;
|
|
12083
12057
|
b2.prev = g;
|
|
12084
|
-
d.next =
|
|
12085
|
-
|
|
12058
|
+
d.next = h;
|
|
12059
|
+
h.prev = d;
|
|
12086
12060
|
return true;
|
|
12087
12061
|
}
|
|
12088
12062
|
const _u = new three.Vector3();
|
|
@@ -12352,10 +12326,10 @@
|
|
|
12352
12326
|
}
|
|
12353
12327
|
let found = false;
|
|
12354
12328
|
const loop = h1.nextLoop();
|
|
12355
|
-
let
|
|
12356
|
-
while (!found && !
|
|
12357
|
-
found =
|
|
12358
|
-
|
|
12329
|
+
let h = loop.next();
|
|
12330
|
+
while (!found && !h.done) {
|
|
12331
|
+
found = h.value === h2;
|
|
12332
|
+
h = loop.next();
|
|
12359
12333
|
}
|
|
12360
12334
|
if (!found) {
|
|
12361
12335
|
face.halfedge = h1;
|
|
@@ -12364,8 +12338,8 @@
|
|
|
12364
12338
|
newFace = new Face(h2);
|
|
12365
12339
|
struct.faces.push(newFace);
|
|
12366
12340
|
}
|
|
12367
|
-
for (const
|
|
12368
|
-
|
|
12341
|
+
for (const h3 of h2.nextLoop()) {
|
|
12342
|
+
h3.face = newFace;
|
|
12369
12343
|
}
|
|
12370
12344
|
}
|
|
12371
12345
|
return h1;
|
|
@@ -12373,22 +12347,22 @@
|
|
|
12373
12347
|
function splitEdge(struct, halfedge, position2, tolerance = 1e-10) {
|
|
12374
12348
|
const twin = halfedge.twin;
|
|
12375
12349
|
const A2 = halfedge.vertex;
|
|
12376
|
-
const
|
|
12350
|
+
const B = twin.vertex;
|
|
12377
12351
|
if (A2.matchesPosition(position2, tolerance)) {
|
|
12378
12352
|
return A2;
|
|
12379
12353
|
}
|
|
12380
|
-
if (
|
|
12381
|
-
return
|
|
12354
|
+
if (B.matchesPosition(position2, tolerance)) {
|
|
12355
|
+
return B;
|
|
12382
12356
|
}
|
|
12383
12357
|
const newVertex = new Vertex();
|
|
12384
12358
|
newVertex.position.copy(position2);
|
|
12385
12359
|
const newHalfedge = new Halfedge(newVertex);
|
|
12386
|
-
const newTwin = new Halfedge(
|
|
12360
|
+
const newTwin = new Halfedge(B);
|
|
12387
12361
|
newHalfedge.twin = newTwin;
|
|
12388
12362
|
newTwin.twin = newHalfedge;
|
|
12389
12363
|
A2.halfedge = halfedge;
|
|
12390
12364
|
newVertex.halfedge = newHalfedge;
|
|
12391
|
-
|
|
12365
|
+
B.halfedge = newTwin;
|
|
12392
12366
|
newHalfedge.face = halfedge.face;
|
|
12393
12367
|
newTwin.face = twin.face;
|
|
12394
12368
|
newHalfedge.next = halfedge.next;
|
|
@@ -12443,7 +12417,7 @@
|
|
|
12443
12417
|
}
|
|
12444
12418
|
const hash1 = i1 + "-" + i2;
|
|
12445
12419
|
let h1 = halfedgeMap.get(hash1);
|
|
12446
|
-
if (h1
|
|
12420
|
+
if (h1?.face) h1 = void 0;
|
|
12447
12421
|
if (!h1) {
|
|
12448
12422
|
try {
|
|
12449
12423
|
h1 = struct.addEdge(v1, v2);
|
|
@@ -12639,7 +12613,7 @@
|
|
|
12639
12613
|
const BYTES_PER_NODE = 6 * 4 + 4 + 4;
|
|
12640
12614
|
const IS_LEAFNODE_FLAG = 65535;
|
|
12641
12615
|
const FLOAT32_EPSILON = Math.pow(2, -24);
|
|
12642
|
-
const SKIP_GENERATION = Symbol("SKIP_GENERATION");
|
|
12616
|
+
const SKIP_GENERATION = /* @__PURE__ */ Symbol("SKIP_GENERATION");
|
|
12643
12617
|
function getVertexCount(geo) {
|
|
12644
12618
|
return geo.index ? geo.index.count : geo.attributes.position.count;
|
|
12645
12619
|
}
|
|
@@ -12805,22 +12779,22 @@
|
|
|
12805
12779
|
ci = ci * stride + bufferOffset;
|
|
12806
12780
|
}
|
|
12807
12781
|
for (let el = 0; el < 3; el++) {
|
|
12808
|
-
let a, b2,
|
|
12782
|
+
let a, b2, c;
|
|
12809
12783
|
if (normalized) {
|
|
12810
12784
|
a = posAttr[getters[el]](ai);
|
|
12811
12785
|
b2 = posAttr[getters[el]](bi);
|
|
12812
|
-
|
|
12786
|
+
c = posAttr[getters[el]](ci);
|
|
12813
12787
|
} else {
|
|
12814
12788
|
a = posArr[ai + el];
|
|
12815
12789
|
b2 = posArr[bi + el];
|
|
12816
|
-
|
|
12790
|
+
c = posArr[ci + el];
|
|
12817
12791
|
}
|
|
12818
12792
|
let min = a;
|
|
12819
12793
|
if (b2 < min) min = b2;
|
|
12820
|
-
if (
|
|
12794
|
+
if (c < min) min = c;
|
|
12821
12795
|
let max = a;
|
|
12822
12796
|
if (b2 > max) max = b2;
|
|
12823
|
-
if (
|
|
12797
|
+
if (c > max) max = c;
|
|
12824
12798
|
const halfExtents = (max - min) / 2;
|
|
12825
12799
|
const el2 = el * 2;
|
|
12826
12800
|
triangleBounds[tri6 + el2 + 0] = min + halfExtents;
|
|
@@ -12924,9 +12898,9 @@
|
|
|
12924
12898
|
const truncatedBins = [...sahBins];
|
|
12925
12899
|
truncatedBins.length = count;
|
|
12926
12900
|
let b2 = 0;
|
|
12927
|
-
for (let
|
|
12901
|
+
for (let c = cStart; c < cEnd; c += 6, b2++) {
|
|
12928
12902
|
const bin = truncatedBins[b2];
|
|
12929
|
-
bin.candidate = triangleBounds[
|
|
12903
|
+
bin.candidate = triangleBounds[c + 2 * a];
|
|
12930
12904
|
bin.count = 0;
|
|
12931
12905
|
const {
|
|
12932
12906
|
bounds,
|
|
@@ -12941,7 +12915,7 @@
|
|
|
12941
12915
|
bounds[d] = Infinity;
|
|
12942
12916
|
bounds[d + 3] = -Infinity;
|
|
12943
12917
|
}
|
|
12944
|
-
expandByTriangleBounds(
|
|
12918
|
+
expandByTriangleBounds(c, triangleBounds, bounds);
|
|
12945
12919
|
}
|
|
12946
12920
|
truncatedBins.sort(binsSort);
|
|
12947
12921
|
let splitCount = count;
|
|
@@ -12952,14 +12926,14 @@
|
|
|
12952
12926
|
splitCount--;
|
|
12953
12927
|
}
|
|
12954
12928
|
}
|
|
12955
|
-
for (let
|
|
12956
|
-
const center2 = triangleBounds[
|
|
12929
|
+
for (let c = cStart; c < cEnd; c += 6) {
|
|
12930
|
+
const center2 = triangleBounds[c + 2 * a];
|
|
12957
12931
|
for (let bi = 0; bi < splitCount; bi++) {
|
|
12958
12932
|
const bin = truncatedBins[bi];
|
|
12959
12933
|
if (center2 >= bin.candidate) {
|
|
12960
|
-
expandByTriangleBounds(
|
|
12934
|
+
expandByTriangleBounds(c, triangleBounds, bin.rightCacheBounds);
|
|
12961
12935
|
} else {
|
|
12962
|
-
expandByTriangleBounds(
|
|
12936
|
+
expandByTriangleBounds(c, triangleBounds, bin.leftCacheBounds);
|
|
12963
12937
|
bin.count++;
|
|
12964
12938
|
}
|
|
12965
12939
|
}
|
|
@@ -12996,14 +12970,14 @@
|
|
|
12996
12970
|
bounds[d + 3] = -Infinity;
|
|
12997
12971
|
}
|
|
12998
12972
|
}
|
|
12999
|
-
for (let
|
|
13000
|
-
const triCenter = triangleBounds[
|
|
12973
|
+
for (let c = cStart; c < cEnd; c += 6) {
|
|
12974
|
+
const triCenter = triangleBounds[c + 2 * a];
|
|
13001
12975
|
const relativeCenter = triCenter - axisLeft;
|
|
13002
12976
|
let binIndex = ~~(relativeCenter / binWidth);
|
|
13003
12977
|
if (binIndex >= BIN_COUNT) binIndex = BIN_COUNT - 1;
|
|
13004
12978
|
const bin = sahBins[binIndex];
|
|
13005
12979
|
bin.count++;
|
|
13006
|
-
expandByTriangleBounds(
|
|
12980
|
+
expandByTriangleBounds(c, triangleBounds, bin.bounds);
|
|
13007
12981
|
}
|
|
13008
12982
|
const lastBin = sahBins[BIN_COUNT - 1];
|
|
13009
12983
|
copyBounds(lastBin.bounds, lastBin.rightCacheBounds);
|
|
@@ -13169,7 +13143,7 @@
|
|
|
13169
13143
|
if (node.buffer) {
|
|
13170
13144
|
const buffer = node.buffer;
|
|
13171
13145
|
uint8Array.set(new Uint8Array(buffer), byteOffset);
|
|
13172
|
-
for (let offset = byteOffset,
|
|
13146
|
+
for (let offset = byteOffset, l2 = byteOffset + buffer.byteLength; offset < l2; offset += BYTES_PER_NODE) {
|
|
13173
13147
|
const offset2 = offset / 2;
|
|
13174
13148
|
if (!IS_LEAF(offset2, uint16Array)) {
|
|
13175
13149
|
uint32Array[offset / 4 + 6] += stride4Offset;
|
|
@@ -13205,7 +13179,7 @@
|
|
|
13205
13179
|
const byteCount = useUint32 ? 4 : 2;
|
|
13206
13180
|
const buffer = useSharedArrayBuffer ? new SharedArrayBuffer(triCount * byteCount) : new ArrayBuffer(triCount * byteCount);
|
|
13207
13181
|
const indirectBuffer = useUint32 ? new Uint32Array(buffer) : new Uint16Array(buffer);
|
|
13208
|
-
for (let i = 0,
|
|
13182
|
+
for (let i = 0, l2 = indirectBuffer.length; i < l2; i++) {
|
|
13209
13183
|
indirectBuffer[i] = i;
|
|
13210
13184
|
}
|
|
13211
13185
|
return indirectBuffer;
|
|
@@ -13311,9 +13285,9 @@
|
|
|
13311
13285
|
setFromPointsField(points, field) {
|
|
13312
13286
|
let min = Infinity;
|
|
13313
13287
|
let max = -Infinity;
|
|
13314
|
-
for (let i = 0,
|
|
13315
|
-
const
|
|
13316
|
-
const val =
|
|
13288
|
+
for (let i = 0, l2 = points.length; i < l2; i++) {
|
|
13289
|
+
const p2 = points[i];
|
|
13290
|
+
const val = p2[field];
|
|
13317
13291
|
min = val < min ? val : min;
|
|
13318
13292
|
max = val > max ? val : max;
|
|
13319
13293
|
}
|
|
@@ -13323,9 +13297,9 @@
|
|
|
13323
13297
|
setFromPoints(axis, points) {
|
|
13324
13298
|
let min = Infinity;
|
|
13325
13299
|
let max = -Infinity;
|
|
13326
|
-
for (let i = 0,
|
|
13327
|
-
const
|
|
13328
|
-
const val = axis.dot(
|
|
13300
|
+
for (let i = 0, l2 = points.length; i < l2; i++) {
|
|
13301
|
+
const p2 = points[i];
|
|
13302
|
+
const val = axis.dot(p2);
|
|
13329
13303
|
min = val < min ? val : min;
|
|
13330
13304
|
max = val > max ? val : max;
|
|
13331
13305
|
}
|
|
@@ -13336,8 +13310,8 @@
|
|
|
13336
13310
|
return this.min > other.max || other.min > this.max;
|
|
13337
13311
|
}
|
|
13338
13312
|
}
|
|
13339
|
-
SeparatingAxisBounds.prototype.setFromBox = function() {
|
|
13340
|
-
const
|
|
13313
|
+
SeparatingAxisBounds.prototype.setFromBox = (function() {
|
|
13314
|
+
const p2 = new threepipe.Vector3();
|
|
13341
13315
|
return function setFromBox(axis, box) {
|
|
13342
13316
|
const boxMin = box.min;
|
|
13343
13317
|
const boxMax = box.max;
|
|
@@ -13345,11 +13319,11 @@
|
|
|
13345
13319
|
let max = -Infinity;
|
|
13346
13320
|
for (let x2 = 0; x2 <= 1; x2++) {
|
|
13347
13321
|
for (let y2 = 0; y2 <= 1; y2++) {
|
|
13348
|
-
for (let
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
const val = axis.dot(
|
|
13322
|
+
for (let z2 = 0; z2 <= 1; z2++) {
|
|
13323
|
+
p2.x = boxMin.x * x2 + boxMax.x * (1 - x2);
|
|
13324
|
+
p2.y = boxMin.y * y2 + boxMax.y * (1 - y2);
|
|
13325
|
+
p2.z = boxMin.z * z2 + boxMax.z * (1 - z2);
|
|
13326
|
+
const val = axis.dot(p2);
|
|
13353
13327
|
min = Math.min(val, min);
|
|
13354
13328
|
max = Math.max(val, max);
|
|
13355
13329
|
}
|
|
@@ -13358,8 +13332,8 @@
|
|
|
13358
13332
|
this.min = min;
|
|
13359
13333
|
this.max = max;
|
|
13360
13334
|
};
|
|
13361
|
-
}();
|
|
13362
|
-
const closestPointLineToLine = function() {
|
|
13335
|
+
})();
|
|
13336
|
+
const closestPointLineToLine = (function() {
|
|
13363
13337
|
const dir1 = new threepipe.Vector3();
|
|
13364
13338
|
const dir2 = new threepipe.Vector3();
|
|
13365
13339
|
const v02 = new threepipe.Vector3();
|
|
@@ -13387,8 +13361,8 @@
|
|
|
13387
13361
|
result.x = d;
|
|
13388
13362
|
result.y = d2;
|
|
13389
13363
|
};
|
|
13390
|
-
}();
|
|
13391
|
-
const closestPointsSegmentToSegment = function() {
|
|
13364
|
+
})();
|
|
13365
|
+
const closestPointsSegmentToSegment = (function() {
|
|
13392
13366
|
const paramResult = new threepipe.Vector2();
|
|
13393
13367
|
const temp12 = new threepipe.Vector3();
|
|
13394
13368
|
const temp22 = new threepipe.Vector3();
|
|
@@ -13417,52 +13391,52 @@
|
|
|
13417
13391
|
l2.closestPointToPoint(target1, true, target2);
|
|
13418
13392
|
return;
|
|
13419
13393
|
} else {
|
|
13420
|
-
let
|
|
13394
|
+
let p2;
|
|
13421
13395
|
if (d < 0) {
|
|
13422
|
-
|
|
13396
|
+
p2 = l1.start;
|
|
13423
13397
|
} else {
|
|
13424
|
-
|
|
13398
|
+
p2 = l1.end;
|
|
13425
13399
|
}
|
|
13426
|
-
let
|
|
13400
|
+
let p22;
|
|
13427
13401
|
if (d2 < 0) {
|
|
13428
|
-
|
|
13402
|
+
p22 = l2.start;
|
|
13429
13403
|
} else {
|
|
13430
|
-
|
|
13404
|
+
p22 = l2.end;
|
|
13431
13405
|
}
|
|
13432
13406
|
const closestPoint = temp12;
|
|
13433
13407
|
const closestPoint2 = temp22;
|
|
13434
|
-
l1.closestPointToPoint(
|
|
13435
|
-
l2.closestPointToPoint(
|
|
13436
|
-
if (closestPoint.distanceToSquared(
|
|
13408
|
+
l1.closestPointToPoint(p22, true, temp12);
|
|
13409
|
+
l2.closestPointToPoint(p2, true, temp22);
|
|
13410
|
+
if (closestPoint.distanceToSquared(p22) <= closestPoint2.distanceToSquared(p2)) {
|
|
13437
13411
|
target1.copy(closestPoint);
|
|
13438
|
-
target2.copy(
|
|
13412
|
+
target2.copy(p22);
|
|
13439
13413
|
return;
|
|
13440
13414
|
} else {
|
|
13441
|
-
target1.copy(
|
|
13415
|
+
target1.copy(p2);
|
|
13442
13416
|
target2.copy(closestPoint2);
|
|
13443
13417
|
return;
|
|
13444
13418
|
}
|
|
13445
13419
|
}
|
|
13446
13420
|
};
|
|
13447
|
-
}();
|
|
13448
|
-
const sphereIntersectTriangle = function() {
|
|
13421
|
+
})();
|
|
13422
|
+
const sphereIntersectTriangle = (function() {
|
|
13449
13423
|
const closestPointTemp = new threepipe.Vector3();
|
|
13450
13424
|
const projectedPointTemp = new threepipe.Vector3();
|
|
13451
13425
|
const planeTemp = new threepipe.Plane();
|
|
13452
13426
|
const lineTemp = new threepipe.Line3();
|
|
13453
13427
|
return function sphereIntersectTriangle2(sphere, triangle3) {
|
|
13454
13428
|
const { radius, center: center2 } = sphere;
|
|
13455
|
-
const { a, b: b2, c
|
|
13429
|
+
const { a, b: b2, c } = triangle3;
|
|
13456
13430
|
lineTemp.start = a;
|
|
13457
13431
|
lineTemp.end = b2;
|
|
13458
13432
|
const closestPoint1 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13459
13433
|
if (closestPoint1.distanceTo(center2) <= radius) return true;
|
|
13460
13434
|
lineTemp.start = a;
|
|
13461
|
-
lineTemp.end =
|
|
13435
|
+
lineTemp.end = c;
|
|
13462
13436
|
const closestPoint2 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13463
13437
|
if (closestPoint2.distanceTo(center2) <= radius) return true;
|
|
13464
13438
|
lineTemp.start = b2;
|
|
13465
|
-
lineTemp.end =
|
|
13439
|
+
lineTemp.end = c;
|
|
13466
13440
|
const closestPoint3 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13467
13441
|
if (closestPoint3.distanceTo(center2) <= radius) return true;
|
|
13468
13442
|
const plane = triangle3.getPlane(planeTemp);
|
|
@@ -13474,7 +13448,7 @@
|
|
|
13474
13448
|
}
|
|
13475
13449
|
return false;
|
|
13476
13450
|
};
|
|
13477
|
-
}();
|
|
13451
|
+
})();
|
|
13478
13452
|
const ZERO_EPSILON = 1e-15;
|
|
13479
13453
|
function isNearZero(value) {
|
|
13480
13454
|
return Math.abs(value) < ZERO_EPSILON;
|
|
@@ -13496,7 +13470,7 @@
|
|
|
13496
13470
|
update() {
|
|
13497
13471
|
const a = this.a;
|
|
13498
13472
|
const b2 = this.b;
|
|
13499
|
-
const
|
|
13473
|
+
const c = this.c;
|
|
13500
13474
|
const points = this.points;
|
|
13501
13475
|
const satAxes = this.satAxes;
|
|
13502
13476
|
const satBounds = this.satBounds;
|
|
@@ -13510,18 +13484,18 @@
|
|
|
13510
13484
|
sab1.setFromPoints(axis1, points);
|
|
13511
13485
|
const axis2 = satAxes[2];
|
|
13512
13486
|
const sab2 = satBounds[2];
|
|
13513
|
-
axis2.subVectors(b2,
|
|
13487
|
+
axis2.subVectors(b2, c);
|
|
13514
13488
|
sab2.setFromPoints(axis2, points);
|
|
13515
13489
|
const axis3 = satAxes[3];
|
|
13516
13490
|
const sab3 = satBounds[3];
|
|
13517
|
-
axis3.subVectors(
|
|
13491
|
+
axis3.subVectors(c, a);
|
|
13518
13492
|
sab3.setFromPoints(axis3, points);
|
|
13519
13493
|
this.sphere.setFromPoints(this.points);
|
|
13520
13494
|
this.plane.setFromNormalAndCoplanarPoint(axis0, a);
|
|
13521
13495
|
this.needsUpdate = false;
|
|
13522
13496
|
}
|
|
13523
13497
|
}
|
|
13524
|
-
ExtendedTriangle.prototype.closestPointToSegment = function() {
|
|
13498
|
+
ExtendedTriangle.prototype.closestPointToSegment = (function() {
|
|
13525
13499
|
const point1 = new threepipe.Vector3();
|
|
13526
13500
|
const point2 = new threepipe.Vector3();
|
|
13527
13501
|
const edge = new threepipe.Line3();
|
|
@@ -13558,8 +13532,8 @@
|
|
|
13558
13532
|
}
|
|
13559
13533
|
return Math.sqrt(closestDistanceSq);
|
|
13560
13534
|
};
|
|
13561
|
-
}();
|
|
13562
|
-
ExtendedTriangle.prototype.intersectsTriangle = function() {
|
|
13535
|
+
})();
|
|
13536
|
+
ExtendedTriangle.prototype.intersectsTriangle = (function() {
|
|
13563
13537
|
const saTri2 = new ExtendedTriangle();
|
|
13564
13538
|
const arr1 = new Array(3);
|
|
13565
13539
|
const arr2 = new Array(3);
|
|
@@ -13722,15 +13696,15 @@
|
|
|
13722
13696
|
return true;
|
|
13723
13697
|
}
|
|
13724
13698
|
};
|
|
13725
|
-
}();
|
|
13726
|
-
ExtendedTriangle.prototype.distanceToPoint = function() {
|
|
13699
|
+
})();
|
|
13700
|
+
ExtendedTriangle.prototype.distanceToPoint = (function() {
|
|
13727
13701
|
const target = new threepipe.Vector3();
|
|
13728
13702
|
return function distanceToPoint(point2) {
|
|
13729
13703
|
this.closestPointToPoint(point2, target);
|
|
13730
13704
|
return point2.distanceTo(target);
|
|
13731
13705
|
};
|
|
13732
|
-
}();
|
|
13733
|
-
ExtendedTriangle.prototype.distanceToTriangle = function() {
|
|
13706
|
+
})();
|
|
13707
|
+
ExtendedTriangle.prototype.distanceToTriangle = (function() {
|
|
13734
13708
|
const point2 = new threepipe.Vector3();
|
|
13735
13709
|
const point22 = new threepipe.Vector3();
|
|
13736
13710
|
const cornerFields = ["a", "b", "c"];
|
|
@@ -13785,7 +13759,7 @@
|
|
|
13785
13759
|
}
|
|
13786
13760
|
return Math.sqrt(closestDistanceSq);
|
|
13787
13761
|
};
|
|
13788
|
-
}();
|
|
13762
|
+
})();
|
|
13789
13763
|
class OrientedBox {
|
|
13790
13764
|
constructor(min, max, matrix) {
|
|
13791
13765
|
this.isOrientedBox = true;
|
|
@@ -13815,7 +13789,7 @@
|
|
|
13815
13789
|
this.needsUpdate = true;
|
|
13816
13790
|
}
|
|
13817
13791
|
}
|
|
13818
|
-
OrientedBox.prototype.update = /* @__PURE__ */ function() {
|
|
13792
|
+
OrientedBox.prototype.update = /* @__PURE__ */ (function() {
|
|
13819
13793
|
return function update() {
|
|
13820
13794
|
const matrix = this.matrix;
|
|
13821
13795
|
const min = this.min;
|
|
@@ -13823,12 +13797,12 @@
|
|
|
13823
13797
|
const points = this.points;
|
|
13824
13798
|
for (let x2 = 0; x2 <= 1; x2++) {
|
|
13825
13799
|
for (let y2 = 0; y2 <= 1; y2++) {
|
|
13826
|
-
for (let
|
|
13827
|
-
const i = (1 << 0) * x2 | (1 << 1) * y2 | (1 << 2) *
|
|
13800
|
+
for (let z2 = 0; z2 <= 1; z2++) {
|
|
13801
|
+
const i = (1 << 0) * x2 | (1 << 1) * y2 | (1 << 2) * z2;
|
|
13828
13802
|
const v2 = points[i];
|
|
13829
13803
|
v2.x = x2 ? max.x : min.x;
|
|
13830
13804
|
v2.y = y2 ? max.y : min.y;
|
|
13831
|
-
v2.z =
|
|
13805
|
+
v2.z = z2 ? max.z : min.z;
|
|
13832
13806
|
v2.applyMatrix4(matrix);
|
|
13833
13807
|
}
|
|
13834
13808
|
}
|
|
@@ -13851,8 +13825,8 @@
|
|
|
13851
13825
|
this.invMatrix.copy(this.matrix).invert();
|
|
13852
13826
|
this.needsUpdate = false;
|
|
13853
13827
|
};
|
|
13854
|
-
}();
|
|
13855
|
-
OrientedBox.prototype.intersectsBox = function() {
|
|
13828
|
+
})();
|
|
13829
|
+
OrientedBox.prototype.intersectsBox = (function() {
|
|
13856
13830
|
const aabbBounds = new SeparatingAxisBounds();
|
|
13857
13831
|
return function intersectsBox(box) {
|
|
13858
13832
|
if (this.needsUpdate) {
|
|
@@ -13880,8 +13854,8 @@
|
|
|
13880
13854
|
}
|
|
13881
13855
|
return true;
|
|
13882
13856
|
};
|
|
13883
|
-
}();
|
|
13884
|
-
OrientedBox.prototype.intersectsTriangle = function() {
|
|
13857
|
+
})();
|
|
13858
|
+
OrientedBox.prototype.intersectsTriangle = (function() {
|
|
13885
13859
|
const saTri = new ExtendedTriangle();
|
|
13886
13860
|
const pointsArr = new Array(3);
|
|
13887
13861
|
const cachedSatBounds = new SeparatingAxisBounds();
|
|
@@ -13930,8 +13904,8 @@
|
|
|
13930
13904
|
}
|
|
13931
13905
|
return true;
|
|
13932
13906
|
};
|
|
13933
|
-
}();
|
|
13934
|
-
OrientedBox.prototype.closestPointToPoint = /* @__PURE__ */ function() {
|
|
13907
|
+
})();
|
|
13908
|
+
OrientedBox.prototype.closestPointToPoint = /* @__PURE__ */ (function() {
|
|
13935
13909
|
return function closestPointToPoint2(point2, target1) {
|
|
13936
13910
|
if (this.needsUpdate) {
|
|
13937
13911
|
this.update();
|
|
@@ -13939,15 +13913,15 @@
|
|
|
13939
13913
|
target1.copy(point2).applyMatrix4(this.invMatrix).clamp(this.min, this.max).applyMatrix4(this.matrix);
|
|
13940
13914
|
return target1;
|
|
13941
13915
|
};
|
|
13942
|
-
}();
|
|
13943
|
-
OrientedBox.prototype.distanceToPoint = function() {
|
|
13916
|
+
})();
|
|
13917
|
+
OrientedBox.prototype.distanceToPoint = (function() {
|
|
13944
13918
|
const target = new threepipe.Vector3();
|
|
13945
13919
|
return function distanceToPoint(point2) {
|
|
13946
13920
|
this.closestPointToPoint(point2, target);
|
|
13947
13921
|
return point2.distanceTo(target);
|
|
13948
13922
|
};
|
|
13949
|
-
}();
|
|
13950
|
-
OrientedBox.prototype.distanceToBox = function() {
|
|
13923
|
+
})();
|
|
13924
|
+
OrientedBox.prototype.distanceToBox = (function() {
|
|
13951
13925
|
const xyzFields = ["x", "y", "z"];
|
|
13952
13926
|
const segments1 = new Array(12).fill().map(() => new threepipe.Line3());
|
|
13953
13927
|
const segments2 = new Array(12).fill().map(() => new threepipe.Line3());
|
|
@@ -13973,12 +13947,12 @@
|
|
|
13973
13947
|
const points = this.points;
|
|
13974
13948
|
let closestDistanceSq = Infinity;
|
|
13975
13949
|
for (let i = 0; i < 8; i++) {
|
|
13976
|
-
const
|
|
13977
|
-
point2.copy(
|
|
13978
|
-
const dist =
|
|
13950
|
+
const p2 = points[i];
|
|
13951
|
+
point2.copy(p2).clamp(min, max);
|
|
13952
|
+
const dist = p2.distanceToSquared(point2);
|
|
13979
13953
|
if (dist < closestDistanceSq) {
|
|
13980
13954
|
closestDistanceSq = dist;
|
|
13981
|
-
if (target1) target1.copy(
|
|
13955
|
+
if (target1) target1.copy(p2);
|
|
13982
13956
|
if (target2) target2.copy(point2);
|
|
13983
13957
|
if (dist < threshold2) return Math.sqrt(dist);
|
|
13984
13958
|
}
|
|
@@ -14013,10 +13987,10 @@
|
|
|
14013
13987
|
}
|
|
14014
13988
|
for (let x2 = 0; x2 <= 1; x2++) {
|
|
14015
13989
|
for (let y2 = 0; y2 <= 1; y2++) {
|
|
14016
|
-
for (let
|
|
13990
|
+
for (let z2 = 0; z2 <= 1; z2++) {
|
|
14017
13991
|
point2.x = x2 ? max.x : min.x;
|
|
14018
13992
|
point2.y = y2 ? max.y : min.y;
|
|
14019
|
-
point2.z =
|
|
13993
|
+
point2.z = z2 ? max.z : min.z;
|
|
14020
13994
|
this.closestPointToPoint(point2, point1);
|
|
14021
13995
|
const dist = point2.distanceToSquared(point1);
|
|
14022
13996
|
if (dist < closestDistanceSq) {
|
|
@@ -14044,7 +14018,7 @@
|
|
|
14044
14018
|
}
|
|
14045
14019
|
return Math.sqrt(closestDistanceSq);
|
|
14046
14020
|
};
|
|
14047
|
-
}();
|
|
14021
|
+
})();
|
|
14048
14022
|
class PrimitivePool {
|
|
14049
14023
|
constructor(getNewPrimitive) {
|
|
14050
14024
|
this._getNewPrimitive = getNewPrimitive;
|
|
@@ -14278,28 +14252,28 @@
|
|
|
14278
14252
|
point: point2.clone()
|
|
14279
14253
|
};
|
|
14280
14254
|
}
|
|
14281
|
-
function checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b2,
|
|
14255
|
+
function checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b2, c, side) {
|
|
14282
14256
|
_vA.fromBufferAttribute(position2, a);
|
|
14283
14257
|
_vB.fromBufferAttribute(position2, b2);
|
|
14284
|
-
_vC.fromBufferAttribute(position2,
|
|
14258
|
+
_vC.fromBufferAttribute(position2, c);
|
|
14285
14259
|
const intersection = checkIntersection(ray2, _vA, _vB, _vC, _intersectionPoint, side);
|
|
14286
14260
|
if (intersection) {
|
|
14287
14261
|
if (uv) {
|
|
14288
14262
|
_uvA.fromBufferAttribute(uv, a);
|
|
14289
14263
|
_uvB.fromBufferAttribute(uv, b2);
|
|
14290
|
-
_uvC.fromBufferAttribute(uv,
|
|
14264
|
+
_uvC.fromBufferAttribute(uv, c);
|
|
14291
14265
|
intersection.uv = threepipe.Triangle.getInterpolation(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new threepipe.Vector2());
|
|
14292
14266
|
}
|
|
14293
14267
|
if (uv1) {
|
|
14294
14268
|
_uvA.fromBufferAttribute(uv1, a);
|
|
14295
14269
|
_uvB.fromBufferAttribute(uv1, b2);
|
|
14296
|
-
_uvC.fromBufferAttribute(uv1,
|
|
14270
|
+
_uvC.fromBufferAttribute(uv1, c);
|
|
14297
14271
|
intersection.uv1 = threepipe.Triangle.getInterpolation(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new threepipe.Vector2());
|
|
14298
14272
|
}
|
|
14299
14273
|
if (normal) {
|
|
14300
14274
|
_normalA.fromBufferAttribute(normal, a);
|
|
14301
14275
|
_normalB.fromBufferAttribute(normal, b2);
|
|
14302
|
-
_normalC.fromBufferAttribute(normal,
|
|
14276
|
+
_normalC.fromBufferAttribute(normal, c);
|
|
14303
14277
|
intersection.normal = threepipe.Triangle.getInterpolation(_intersectionPoint, _vA, _vB, _vC, _normalA, _normalB, _normalC, new threepipe.Vector3());
|
|
14304
14278
|
if (intersection.normal.dot(ray2.direction) > 0) {
|
|
14305
14279
|
intersection.normal.multiplyScalar(-1);
|
|
@@ -14308,7 +14282,7 @@
|
|
|
14308
14282
|
const face = {
|
|
14309
14283
|
a,
|
|
14310
14284
|
b: b2,
|
|
14311
|
-
c
|
|
14285
|
+
c,
|
|
14312
14286
|
normal: new threepipe.Vector3(),
|
|
14313
14287
|
materialIndex: 0
|
|
14314
14288
|
};
|
|
@@ -14322,15 +14296,15 @@
|
|
|
14322
14296
|
const triOffset = tri * 3;
|
|
14323
14297
|
let a = triOffset + 0;
|
|
14324
14298
|
let b2 = triOffset + 1;
|
|
14325
|
-
let
|
|
14299
|
+
let c = triOffset + 2;
|
|
14326
14300
|
const index = geo.index;
|
|
14327
14301
|
if (geo.index) {
|
|
14328
14302
|
a = index.getX(a);
|
|
14329
14303
|
b2 = index.getX(b2);
|
|
14330
|
-
|
|
14304
|
+
c = index.getX(c);
|
|
14331
14305
|
}
|
|
14332
14306
|
const { position: position2, normal, uv, uv1 } = geo.attributes;
|
|
14333
|
-
const intersection = checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b2,
|
|
14307
|
+
const intersection = checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b2, c, side);
|
|
14334
14308
|
if (intersection) {
|
|
14335
14309
|
intersection.faceIndex = tri;
|
|
14336
14310
|
if (intersections) intersections.push(intersection);
|
|
@@ -14384,7 +14358,7 @@
|
|
|
14384
14358
|
const { geometry } = bvh;
|
|
14385
14359
|
const { index } = geometry;
|
|
14386
14360
|
const pos = geometry.attributes.position;
|
|
14387
|
-
for (let i = offset,
|
|
14361
|
+
for (let i = offset, l2 = count + offset; i < l2; i++) {
|
|
14388
14362
|
let tri;
|
|
14389
14363
|
tri = i;
|
|
14390
14364
|
setTriangle(triangle3, tri * 3, index, pos);
|
|
@@ -14405,7 +14379,7 @@
|
|
|
14405
14379
|
let buffer, uint32Array2, uint16Array2, float32Array2;
|
|
14406
14380
|
let byteOffset = 0;
|
|
14407
14381
|
const roots = bvh._roots;
|
|
14408
|
-
for (let i = 0,
|
|
14382
|
+
for (let i = 0, l2 = roots.length; i < l2; i++) {
|
|
14409
14383
|
buffer = roots[i];
|
|
14410
14384
|
uint32Array2 = new Uint32Array(buffer);
|
|
14411
14385
|
uint16Array2 = new Uint16Array(buffer);
|
|
@@ -14425,17 +14399,17 @@
|
|
|
14425
14399
|
let maxx = -Infinity;
|
|
14426
14400
|
let maxy = -Infinity;
|
|
14427
14401
|
let maxz = -Infinity;
|
|
14428
|
-
for (let i = 3 * offset,
|
|
14402
|
+
for (let i = 3 * offset, l2 = 3 * (offset + count); i < l2; i++) {
|
|
14429
14403
|
let index = indexArr[i];
|
|
14430
14404
|
const x2 = posAttr.getX(index);
|
|
14431
14405
|
const y2 = posAttr.getY(index);
|
|
14432
|
-
const
|
|
14406
|
+
const z2 = posAttr.getZ(index);
|
|
14433
14407
|
if (x2 < minx) minx = x2;
|
|
14434
14408
|
if (x2 > maxx) maxx = x2;
|
|
14435
14409
|
if (y2 < miny) miny = y2;
|
|
14436
14410
|
if (y2 > maxy) maxy = y2;
|
|
14437
|
-
if (
|
|
14438
|
-
if (
|
|
14411
|
+
if (z2 < minz) minz = z2;
|
|
14412
|
+
if (z2 > maxz) maxz = z2;
|
|
14439
14413
|
}
|
|
14440
14414
|
if (float32Array2[node32Index + 0] !== minx || float32Array2[node32Index + 1] !== miny || float32Array2[node32Index + 2] !== minz || float32Array2[node32Index + 3] !== maxx || float32Array2[node32Index + 4] !== maxy || float32Array2[node32Index + 5] !== maxz) {
|
|
14441
14415
|
float32Array2[node32Index + 0] = minx;
|
|
@@ -14559,7 +14533,7 @@
|
|
|
14559
14533
|
const { geometry } = bvh;
|
|
14560
14534
|
const { index } = geometry;
|
|
14561
14535
|
const pos = geometry.attributes.position;
|
|
14562
|
-
for (let i = offset,
|
|
14536
|
+
for (let i = offset, l2 = count + offset; i < l2; i++) {
|
|
14563
14537
|
let tri;
|
|
14564
14538
|
tri = bvh.resolveTriangleIndex(i);
|
|
14565
14539
|
setTriangle(triangle3, tri * 3, index, pos);
|
|
@@ -14686,7 +14660,7 @@
|
|
|
14686
14660
|
tri.b.applyMatrix4(geometryToBvh);
|
|
14687
14661
|
tri.c.applyMatrix4(geometryToBvh);
|
|
14688
14662
|
tri.needsUpdate = true;
|
|
14689
|
-
for (let i = offset * 3,
|
|
14663
|
+
for (let i = offset * 3, l2 = (count + offset) * 3; i < l2; i += 3) {
|
|
14690
14664
|
setTriangle(triangle2$1, i, thisIndex, thisPos);
|
|
14691
14665
|
triangle2$1.needsUpdate = true;
|
|
14692
14666
|
if (tri.intersectsTriangle(triangle2$1)) {
|
|
@@ -14698,13 +14672,13 @@
|
|
|
14698
14672
|
});
|
|
14699
14673
|
return res;
|
|
14700
14674
|
} else {
|
|
14701
|
-
for (let i = offset * 3,
|
|
14675
|
+
for (let i = offset * 3, l2 = (count + offset) * 3; i < l2; i += 3) {
|
|
14702
14676
|
setTriangle(triangle$1, i, thisIndex, thisPos);
|
|
14703
14677
|
triangle$1.a.applyMatrix4(invertedMat$1);
|
|
14704
14678
|
triangle$1.b.applyMatrix4(invertedMat$1);
|
|
14705
14679
|
triangle$1.c.applyMatrix4(invertedMat$1);
|
|
14706
14680
|
triangle$1.needsUpdate = true;
|
|
14707
|
-
for (let i2 = 0,
|
|
14681
|
+
for (let i2 = 0, l22 = index.count; i2 < l22; i2 += 3) {
|
|
14708
14682
|
setTriangle(triangle2$1, i2, index, pos);
|
|
14709
14683
|
triangle2$1.needsUpdate = true;
|
|
14710
14684
|
if (triangle$1.intersectsTriangle(triangle2$1)) {
|
|
@@ -14791,7 +14765,7 @@
|
|
|
14791
14765
|
triangle22.b.applyMatrix4(geometryToBvh);
|
|
14792
14766
|
triangle22.c.applyMatrix4(geometryToBvh);
|
|
14793
14767
|
triangle22.needsUpdate = true;
|
|
14794
|
-
for (let i = offset,
|
|
14768
|
+
for (let i = offset, l3 = offset + count; i < l3; i++) {
|
|
14795
14769
|
setTriangle(triangle3, 3 * i, index, pos);
|
|
14796
14770
|
triangle3.needsUpdate = true;
|
|
14797
14771
|
const dist = triangle3.distanceToTriangle(triangle22, tempTarget1, tempTarget2);
|
|
@@ -14819,7 +14793,7 @@
|
|
|
14819
14793
|
triangle22.b.applyMatrix4(geometryToBvh);
|
|
14820
14794
|
triangle22.c.applyMatrix4(geometryToBvh);
|
|
14821
14795
|
triangle22.needsUpdate = true;
|
|
14822
|
-
for (let i = offset,
|
|
14796
|
+
for (let i = offset, l3 = offset + count; i < l3; i++) {
|
|
14823
14797
|
setTriangle(triangle3, 3 * i, index, pos);
|
|
14824
14798
|
triangle3.needsUpdate = true;
|
|
14825
14799
|
const dist = triangle3.distanceToTriangle(triangle22, tempTarget1, tempTarget2);
|
|
@@ -14872,7 +14846,7 @@
|
|
|
14872
14846
|
let buffer, uint32Array2, uint16Array2, float32Array2;
|
|
14873
14847
|
let byteOffset = 0;
|
|
14874
14848
|
const roots = bvh._roots;
|
|
14875
|
-
for (let i = 0,
|
|
14849
|
+
for (let i = 0, l2 = roots.length; i < l2; i++) {
|
|
14876
14850
|
buffer = roots[i];
|
|
14877
14851
|
uint32Array2 = new Uint32Array(buffer);
|
|
14878
14852
|
uint16Array2 = new Uint16Array(buffer);
|
|
@@ -14892,20 +14866,20 @@
|
|
|
14892
14866
|
let maxx = -Infinity;
|
|
14893
14867
|
let maxy = -Infinity;
|
|
14894
14868
|
let maxz = -Infinity;
|
|
14895
|
-
for (let i = offset,
|
|
14869
|
+
for (let i = offset, l2 = offset + count; i < l2; i++) {
|
|
14896
14870
|
const t = 3 * bvh.resolveTriangleIndex(i);
|
|
14897
14871
|
for (let j = 0; j < 3; j++) {
|
|
14898
14872
|
let index = t + j;
|
|
14899
14873
|
index = indexArr ? indexArr[index] : index;
|
|
14900
14874
|
const x2 = posAttr.getX(index);
|
|
14901
14875
|
const y2 = posAttr.getY(index);
|
|
14902
|
-
const
|
|
14876
|
+
const z2 = posAttr.getZ(index);
|
|
14903
14877
|
if (x2 < minx) minx = x2;
|
|
14904
14878
|
if (x2 > maxx) maxx = x2;
|
|
14905
14879
|
if (y2 < miny) miny = y2;
|
|
14906
14880
|
if (y2 > maxy) maxy = y2;
|
|
14907
|
-
if (
|
|
14908
|
-
if (
|
|
14881
|
+
if (z2 < minz) minz = z2;
|
|
14882
|
+
if (z2 > maxz) maxz = z2;
|
|
14909
14883
|
}
|
|
14910
14884
|
}
|
|
14911
14885
|
if (float32Array2[node32Index + 0] !== minx || float32Array2[node32Index + 1] !== miny || float32Array2[node32Index + 2] !== minz || float32Array2[node32Index + 3] !== maxx || float32Array2[node32Index + 4] !== maxy || float32Array2[node32Index + 5] !== maxz) {
|
|
@@ -15080,7 +15054,7 @@
|
|
|
15080
15054
|
tri.b.applyMatrix4(geometryToBvh);
|
|
15081
15055
|
tri.c.applyMatrix4(geometryToBvh);
|
|
15082
15056
|
tri.needsUpdate = true;
|
|
15083
|
-
for (let i = offset,
|
|
15057
|
+
for (let i = offset, l2 = count + offset; i < l2; i++) {
|
|
15084
15058
|
setTriangle(triangle2, 3 * bvh.resolveTriangleIndex(i), thisIndex, thisPos);
|
|
15085
15059
|
triangle2.needsUpdate = true;
|
|
15086
15060
|
if (tri.intersectsTriangle(triangle2)) {
|
|
@@ -15092,14 +15066,14 @@
|
|
|
15092
15066
|
});
|
|
15093
15067
|
return res;
|
|
15094
15068
|
} else {
|
|
15095
|
-
for (let i = offset,
|
|
15069
|
+
for (let i = offset, l2 = count + offset; i < l2; i++) {
|
|
15096
15070
|
const ti = bvh.resolveTriangleIndex(i);
|
|
15097
15071
|
setTriangle(triangle, 3 * ti, thisIndex, thisPos);
|
|
15098
15072
|
triangle.a.applyMatrix4(invertedMat);
|
|
15099
15073
|
triangle.b.applyMatrix4(invertedMat);
|
|
15100
15074
|
triangle.c.applyMatrix4(invertedMat);
|
|
15101
15075
|
triangle.needsUpdate = true;
|
|
15102
|
-
for (let i2 = 0,
|
|
15076
|
+
for (let i2 = 0, l22 = index.count; i2 < l22; i2 += 3) {
|
|
15103
15077
|
setTriangle(triangle2, i2, index, pos);
|
|
15104
15078
|
triangle2.needsUpdate = true;
|
|
15105
15079
|
if (triangle.intersectsTriangle(triangle2)) {
|
|
@@ -15187,7 +15161,7 @@
|
|
|
15187
15161
|
triangle22.b.applyMatrix4(geometryToBvh);
|
|
15188
15162
|
triangle22.c.applyMatrix4(geometryToBvh);
|
|
15189
15163
|
triangle22.needsUpdate = true;
|
|
15190
|
-
for (let i = offset,
|
|
15164
|
+
for (let i = offset, l3 = offset + count; i < l3; i++) {
|
|
15191
15165
|
const ti = bvh.resolveTriangleIndex(i);
|
|
15192
15166
|
setTriangle(triangle3, 3 * ti, index, pos);
|
|
15193
15167
|
triangle3.needsUpdate = true;
|
|
@@ -15216,7 +15190,7 @@
|
|
|
15216
15190
|
triangle22.b.applyMatrix4(geometryToBvh);
|
|
15217
15191
|
triangle22.c.applyMatrix4(geometryToBvh);
|
|
15218
15192
|
triangle22.needsUpdate = true;
|
|
15219
|
-
for (let i = offset,
|
|
15193
|
+
for (let i = offset, l3 = offset + count; i < l3; i++) {
|
|
15220
15194
|
const ti = bvh.resolveTriangleIndex(i);
|
|
15221
15195
|
setTriangle(triangle3, 3 * ti, index, pos);
|
|
15222
15196
|
triangle3.needsUpdate = true;
|
|
@@ -15660,7 +15634,7 @@
|
|
|
15660
15634
|
const groups = geometry.groups;
|
|
15661
15635
|
const side = isMaterial ? materialOrSide.side : materialOrSide;
|
|
15662
15636
|
const raycastFunc = this.indirect ? raycast_indirect : raycast;
|
|
15663
|
-
for (let i = 0,
|
|
15637
|
+
for (let i = 0, l2 = roots.length; i < l2; i++) {
|
|
15664
15638
|
const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;
|
|
15665
15639
|
const startCount = intersects.length;
|
|
15666
15640
|
raycastFunc(this, i, materialSide, ray2, intersects);
|
|
@@ -15682,7 +15656,7 @@
|
|
|
15682
15656
|
const groups = geometry.groups;
|
|
15683
15657
|
const side = isMaterial ? materialOrSide.side : materialOrSide;
|
|
15684
15658
|
const raycastFirstFunc = this.indirect ? raycastFirst_indirect : raycastFirst;
|
|
15685
|
-
for (let i = 0,
|
|
15659
|
+
for (let i = 0, l2 = roots.length; i < l2; i++) {
|
|
15686
15660
|
const materialSide = isArrayMaterial ? materialOrSide[groups[i].materialIndex].side : side;
|
|
15687
15661
|
const result = raycastFirstFunc(this, i, materialSide, ray2);
|
|
15688
15662
|
if (result != null && (closestResult == null || result.distance < closestResult.distance)) {
|
|
@@ -15698,7 +15672,7 @@
|
|
|
15698
15672
|
let result = false;
|
|
15699
15673
|
const roots = this._roots;
|
|
15700
15674
|
const intersectsGeometryFunc = this.indirect ? intersectsGeometry_indirect : intersectsGeometry;
|
|
15701
|
-
for (let i = 0,
|
|
15675
|
+
for (let i = 0, l2 = roots.length; i < l2; i++) {
|
|
15702
15676
|
result = intersectsGeometryFunc(this, i, otherGeometry, geomToMesh);
|
|
15703
15677
|
if (result) {
|
|
15704
15678
|
break;
|
|
@@ -15737,7 +15711,7 @@
|
|
|
15737
15711
|
let result = false;
|
|
15738
15712
|
let byteOffset = 0;
|
|
15739
15713
|
const roots = this._roots;
|
|
15740
|
-
for (let i = 0,
|
|
15714
|
+
for (let i = 0, l2 = roots.length; i < l2; i++) {
|
|
15741
15715
|
const root2 = roots[i];
|
|
15742
15716
|
result = shapecast(this, i, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset);
|
|
15743
15717
|
if (result) {
|
|
@@ -15882,7 +15856,7 @@
|
|
|
15882
15856
|
}
|
|
15883
15857
|
} else {
|
|
15884
15858
|
const hits = bvh.raycast(ray, this.material);
|
|
15885
|
-
for (let i = 0,
|
|
15859
|
+
for (let i = 0, l2 = hits.length; i < l2; i++) {
|
|
15886
15860
|
const hit = convertRaycastIntersect(hits[i], this, raycaster);
|
|
15887
15861
|
if (hit) {
|
|
15888
15862
|
intersects.push(hit);
|
|
@@ -15907,7 +15881,7 @@
|
|
|
15907
15881
|
const bvhOptions = {
|
|
15908
15882
|
maxLeafTris: 1,
|
|
15909
15883
|
strategy: CENTER,
|
|
15910
|
-
...options
|
|
15884
|
+
...options?.bvhOptions
|
|
15911
15885
|
};
|
|
15912
15886
|
this.bvhOptions = bvhOptions;
|
|
15913
15887
|
this.bvh = new MeshBVH(this.threeMesh.geometry, bvhOptions);
|
|
@@ -16098,7 +16072,7 @@
|
|
|
16098
16072
|
this._meshes = /* @__PURE__ */ new Map();
|
|
16099
16073
|
this._rendering = false;
|
|
16100
16074
|
this._viewerListeners = {
|
|
16101
|
-
postRender: (
|
|
16075
|
+
postRender: (_) => {
|
|
16102
16076
|
if (this.autoRender) this.render();
|
|
16103
16077
|
}
|
|
16104
16078
|
};
|
|
@@ -16125,21 +16099,19 @@
|
|
|
16125
16099
|
Vertex.MAX_LOOP = 1e4;
|
|
16126
16100
|
}
|
|
16127
16101
|
setDirty(...args) {
|
|
16128
|
-
var _a, _b;
|
|
16129
16102
|
if (args[0] === "enabled") {
|
|
16130
16103
|
const last = args[2];
|
|
16131
16104
|
const current = args[1];
|
|
16132
|
-
if (last !== current &&
|
|
16105
|
+
if (last !== current && this._meshes?.size) {
|
|
16133
16106
|
this._toggleMaterialRendering([...this._meshes.values()], !current);
|
|
16134
16107
|
}
|
|
16135
16108
|
if (this.svgNodeContainer) {
|
|
16136
16109
|
this.svgNodeContainer.style.display = current ? "" : "none";
|
|
16137
16110
|
}
|
|
16138
16111
|
}
|
|
16139
|
-
|
|
16112
|
+
this._viewer?.setDirty();
|
|
16140
16113
|
}
|
|
16141
16114
|
onAdded(viewer) {
|
|
16142
|
-
var _a;
|
|
16143
16115
|
super.onAdded(viewer);
|
|
16144
16116
|
if (this.autoAddToContainer) {
|
|
16145
16117
|
viewer.container.prepend(this.svgNodeContainer);
|
|
@@ -16152,7 +16124,7 @@
|
|
|
16152
16124
|
this.svgNodeContainer.style.width = canvasStyles.width;
|
|
16153
16125
|
this.svgNodeContainer.style.height = canvasStyles.height;
|
|
16154
16126
|
} else {
|
|
16155
|
-
|
|
16127
|
+
this._viewer?.console.warn("ThreeSVGRendererPlugin: canvas position should be absolute for proper rendering");
|
|
16156
16128
|
}
|
|
16157
16129
|
viewer.renderManager.addEventListener("resize", this._onResize);
|
|
16158
16130
|
}
|
|
@@ -16284,16 +16256,14 @@
|
|
|
16284
16256
|
return "";
|
|
16285
16257
|
}
|
|
16286
16258
|
download() {
|
|
16287
|
-
var _a;
|
|
16288
16259
|
const svg2 = this.svgNodeContainer.innerHTML;
|
|
16289
16260
|
const blob = new Blob([svg2], { type: "image/svg+xml" });
|
|
16290
|
-
|
|
16261
|
+
this._viewer?.exportBlob(blob, "scene.svg");
|
|
16291
16262
|
}
|
|
16292
16263
|
get svgNode() {
|
|
16293
|
-
var _a;
|
|
16294
16264
|
if (!this.svgNodeContainer.children.length) return void 0;
|
|
16295
16265
|
if (this.svgNodeContainer.children.length > 1) {
|
|
16296
|
-
|
|
16266
|
+
this._viewer?.console.warn("ThreeSVGRenderer: Multiple svg nodes in container, should not be possible");
|
|
16297
16267
|
}
|
|
16298
16268
|
return this.svgNodeContainer.children[0];
|
|
16299
16269
|
}
|
|
@@ -16306,9 +16276,9 @@
|
|
|
16306
16276
|
this.renderer.viewmap.options.creaseAngle.min = this.creaseAngle.x;
|
|
16307
16277
|
this.renderer.viewmap.options.creaseAngle.max = this.creaseAngle.y;
|
|
16308
16278
|
const passes = this.renderer.drawHandler.passes;
|
|
16309
|
-
const fillPass = passes.find((
|
|
16310
|
-
const visibleContourPass = passes.find((
|
|
16311
|
-
const hiddenContourPass = passes.find((
|
|
16279
|
+
const fillPass = passes.find((p2) => p2 instanceof FillPass);
|
|
16280
|
+
const visibleContourPass = passes.find((p2) => p2 instanceof VisibleChainPass);
|
|
16281
|
+
const hiddenContourPass = passes.find((p2) => p2 instanceof HiddenChainPass);
|
|
16312
16282
|
if (fillPass) {
|
|
16313
16283
|
fillPass.enabled = this.drawPolygons && (this.drawPolygonFills || this.drawPolygonStrokes || this.drawImageFills);
|
|
16314
16284
|
fillPass.drawFills = this.drawPolygonFills;
|
|
@@ -16381,23 +16351,6 @@
|
|
|
16381
16351
|
exports2.ThreeSVGRendererPlugin = __decorateClass([
|
|
16382
16352
|
threepipe.uiFolderContainer("SVG Renderer")
|
|
16383
16353
|
], exports2.ThreeSVGRendererPlugin);
|
|
16384
|
-
/**
|
|
16385
|
-
* @license
|
|
16386
|
-
* three-svg-renderer
|
|
16387
|
-
*
|
|
16388
|
-
* GNU GENERAL PUBLIC LICENSE
|
|
16389
|
-
* Version 3, 29 June 2007
|
|
16390
|
-
*
|
|
16391
|
-
* Copyright (c) 2022 Axel Antoine
|
|
16392
|
-
*/
|
|
16393
|
-
/**
|
|
16394
|
-
* @license
|
|
16395
|
-
* three-mesh-halfedge
|
|
16396
|
-
*
|
|
16397
|
-
* MIT License
|
|
16398
|
-
*
|
|
16399
|
-
* Copyright (c) 2022 Axel Antoine
|
|
16400
|
-
*/
|
|
16401
16354
|
exports2.DrawPass = DrawPass;
|
|
16402
16355
|
exports2.FillPass = FillPass;
|
|
16403
16356
|
exports2.SVGDrawHandler = SVGDrawHandler;
|
|
@@ -16408,5 +16361,5 @@
|
|
|
16408
16361
|
exports2.Viewmap = Viewmap;
|
|
16409
16362
|
exports2.ViewmapBuildInfo = ViewmapBuildInfo;
|
|
16410
16363
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
16411
|
-
});
|
|
16364
|
+
}));
|
|
16412
16365
|
//# sourceMappingURL=index.js.map
|