@threepipe/plugin-svg-renderer 0.2.3 → 0.2.5
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 +21 -0
- package/README.md +12 -0
- package/dist/dependencies.txt +13 -13
- package/dist/index.js +614 -665
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +630 -681
- package/dist/index.mjs.map +1 -1
- package/dist/three-svg-renderer/core/SVGMesh.d.ts +1 -1
- package/dist/three-svg-renderer/core/SVGMesh.d.ts.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/BasicSVGRenderer.html +7 -0
- package/docs/classes/BasicSVGRendererPlugin.html +36 -0
- package/docs/classes/DrawPass.html +11 -0
- package/docs/classes/FillPass.html +15 -0
- package/docs/classes/SVGDrawHandler.html +5 -0
- package/docs/classes/SVGDrawInfo.html +4 -0
- package/docs/classes/SVGMesh.html +29 -0
- package/docs/classes/SVGRenderInfo.html +6 -0
- package/docs/classes/SVGRenderer.html +17 -0
- package/docs/classes/ThreeSVGRendererPlugin.html +67 -0
- package/docs/classes/Viewmap.html +15 -0
- package/docs/classes/ViewmapBuildInfo.html +8 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1 -0
- package/docs/interfaces/FillPassOptions.html +14 -0
- package/docs/interfaces/SVGDrawOptions.html +2 -0
- package/docs/interfaces/SVGMeshOptions.html +2 -0
- package/docs/interfaces/SVGTexture.html +7 -0
- package/docs/interfaces/ViewmapOptions.html +5 -0
- package/package.json +9 -5
- package/src/three-svg-renderer/core/SVGMesh.ts +1 -1
- package/src/three-svg-renderer/core/viewmap/operations/assignPolygons.ts +3 -3
- package/src/three-svg-renderer/core/viewmap/operations/computeChainsVisibility.ts +7 -7
- package/tsconfig.json +45 -0
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
})(this, function(exports2, threepipe, three) {
|
|
4
4
|
"use strict";/**
|
|
5
5
|
* @license
|
|
6
|
-
* @threepipe/plugin-svg-renderer v0.2.
|
|
6
|
+
* @threepipe/plugin-svg-renderer v0.2.5
|
|
7
7
|
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
8
8
|
* GPLV3 License
|
|
9
9
|
* See ./dependencies.txt for any bundled third-party dependencies and licenses.
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
function pushNormal(x2, y2, z) {
|
|
108
108
|
normals.push(x2, y2, z);
|
|
109
109
|
}
|
|
110
|
-
function pushColor(r, g,
|
|
111
|
-
colors.push(r, g,
|
|
110
|
+
function pushColor(r, g, b2) {
|
|
111
|
+
colors.push(r, g, b2);
|
|
112
112
|
}
|
|
113
113
|
function pushUv(x2, y2) {
|
|
114
114
|
uvs.push(x2, y2);
|
|
@@ -123,9 +123,9 @@
|
|
|
123
123
|
function checkBackfaceCulling(v1, v2, v3) {
|
|
124
124
|
return (v3.positionScreen.x - v1.positionScreen.x) * (v2.positionScreen.y - v1.positionScreen.y) - (v3.positionScreen.y - v1.positionScreen.y) * (v2.positionScreen.x - v1.positionScreen.x) < 0;
|
|
125
125
|
}
|
|
126
|
-
function pushLine(a,
|
|
126
|
+
function pushLine(a, b2) {
|
|
127
127
|
const v1 = _vertexPool[a];
|
|
128
|
-
const v2 = _vertexPool[
|
|
128
|
+
const v2 = _vertexPool[b2];
|
|
129
129
|
v1.positionScreen.copy(v1.position).applyMatrix4(_modelViewProjectionMatrix);
|
|
130
130
|
v2.positionScreen.copy(v2.position).applyMatrix4(_modelViewProjectionMatrix);
|
|
131
131
|
if (clipLine(v1.positionScreen, v2.positionScreen) === true) {
|
|
@@ -140,15 +140,15 @@
|
|
|
140
140
|
_line2.material = object.material;
|
|
141
141
|
if (object.material.vertexColors) {
|
|
142
142
|
_line2.vertexColors[0].fromArray(colors, a * 3);
|
|
143
|
-
_line2.vertexColors[1].fromArray(colors,
|
|
143
|
+
_line2.vertexColors[1].fromArray(colors, b2 * 3);
|
|
144
144
|
}
|
|
145
145
|
_renderData.elements.push(_line2);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function pushTriangle(a,
|
|
148
|
+
function pushTriangle(a, b2, c2, material) {
|
|
149
149
|
const v1 = _vertexPool[a];
|
|
150
|
-
const v2 = _vertexPool[
|
|
151
|
-
const v3 = _vertexPool[
|
|
150
|
+
const v2 = _vertexPool[b2];
|
|
151
|
+
const v3 = _vertexPool[c2];
|
|
152
152
|
if (checkTriangleVisibility(v1, v2, v3) === false) return;
|
|
153
153
|
if (material.side === threepipe.DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {
|
|
154
154
|
_face = getNextFaceInPool();
|
|
@@ -443,13 +443,13 @@
|
|
|
443
443
|
}
|
|
444
444
|
return _spritePool[_spriteCount++];
|
|
445
445
|
}
|
|
446
|
-
function painterSort(a,
|
|
447
|
-
if (a.renderOrder !==
|
|
448
|
-
return a.renderOrder -
|
|
449
|
-
} else if (a.z !==
|
|
450
|
-
return
|
|
451
|
-
} else if (a.id !==
|
|
452
|
-
return a.id -
|
|
446
|
+
function painterSort(a, b2) {
|
|
447
|
+
if (a.renderOrder !== b2.renderOrder) {
|
|
448
|
+
return a.renderOrder - b2.renderOrder;
|
|
449
|
+
} else if (a.z !== b2.z) {
|
|
450
|
+
return b2.z - a.z;
|
|
451
|
+
} else if (a.id !== b2.id) {
|
|
452
|
+
return a.id - b2.id;
|
|
453
453
|
} else {
|
|
454
454
|
return 0;
|
|
455
455
|
}
|
|
@@ -492,6 +492,7 @@
|
|
|
492
492
|
this.sortObjects = true;
|
|
493
493
|
this.sortElements = true;
|
|
494
494
|
this.overdraw = 0.5;
|
|
495
|
+
this.outputColorSpace = threepipe.SRGBColorSpace;
|
|
495
496
|
this.info = {
|
|
496
497
|
render: {
|
|
497
498
|
vertices: 0,
|
|
@@ -539,12 +540,12 @@
|
|
|
539
540
|
_svg.removeChild(_svg.childNodes[0]);
|
|
540
541
|
}
|
|
541
542
|
}
|
|
542
|
-
function convert(
|
|
543
|
-
return _precision !== null ?
|
|
543
|
+
function convert(c2) {
|
|
544
|
+
return _precision !== null ? c2.toFixed(_precision) : c2;
|
|
544
545
|
}
|
|
545
546
|
this.clear = function() {
|
|
546
547
|
removeChildNodes();
|
|
547
|
-
_svg.style.backgroundColor = _clearColor.getStyle();
|
|
548
|
+
_svg.style.backgroundColor = _clearColor.getStyle(_this.outputColorSpace);
|
|
548
549
|
};
|
|
549
550
|
this.render = function(scene, camera) {
|
|
550
551
|
if (camera instanceof threepipe.Camera === false) {
|
|
@@ -554,7 +555,7 @@
|
|
|
554
555
|
const background = scene.background;
|
|
555
556
|
if (background && background.isColor) {
|
|
556
557
|
removeChildNodes();
|
|
557
|
-
_svg.style.backgroundColor = background.getStyle();
|
|
558
|
+
_svg.style.backgroundColor = background.getStyle(_this.outputColorSpace);
|
|
558
559
|
} else if (this.autoClear === true) {
|
|
559
560
|
this.clear();
|
|
560
561
|
}
|
|
@@ -689,14 +690,14 @@
|
|
|
689
690
|
const path = "M" + convert(v1.x - scaleX * 0.5) + "," + convert(v1.y - scaleY * 0.5) + "h" + convert(scaleX) + "v" + convert(scaleY) + "h" + convert(-scaleX) + "z";
|
|
690
691
|
let style = "";
|
|
691
692
|
if (material.isSpriteMaterial || material.isPointsMaterial) {
|
|
692
|
-
style = "fill:" + material.color.getStyle() + ";fill-opacity:" + material.opacity;
|
|
693
|
+
style = "fill:" + material.color.getStyle(_this.outputColorSpace) + ";fill-opacity:" + material.opacity;
|
|
693
694
|
}
|
|
694
695
|
addPath(style, path);
|
|
695
696
|
}
|
|
696
697
|
function renderLine(v1, v2, material) {
|
|
697
698
|
const path = "M" + convert(v1.positionScreen.x) + "," + convert(v1.positionScreen.y) + "L" + convert(v2.positionScreen.x) + "," + convert(v2.positionScreen.y);
|
|
698
699
|
if (material.isLineBasicMaterial) {
|
|
699
|
-
let style = "fill:none;stroke:" + material.color.getStyle() + ";stroke-opacity:" + material.opacity + ";stroke-width:" + material.linewidth + ";stroke-linecap:" + material.linecap;
|
|
700
|
+
let style = "fill:none;stroke:" + material.color.getStyle(_this.outputColorSpace) + ";stroke-opacity:" + material.opacity + ";stroke-width:" + material.linewidth + ";stroke-linecap:" + material.linecap;
|
|
700
701
|
if (material.isLineDashedMaterial) {
|
|
701
702
|
style = style + ";stroke-dasharray:" + material.dashSize + "," + material.gapSize;
|
|
702
703
|
}
|
|
@@ -727,9 +728,9 @@
|
|
|
727
728
|
_color2.setRGB(_normal2.x, _normal2.y, _normal2.z).multiplyScalar(0.5).addScalar(0.5);
|
|
728
729
|
}
|
|
729
730
|
if (material.wireframe) {
|
|
730
|
-
style = "fill:none;stroke:" + _color2.getStyle() + ";stroke-opacity:" + material.opacity + ";stroke-width:" + material.wireframeLinewidth + ";stroke-linecap:" + material.wireframeLinecap + ";stroke-linejoin:" + material.wireframeLinejoin;
|
|
731
|
+
style = "fill:none;stroke:" + _color2.getStyle(_this.outputColorSpace) + ";stroke-opacity:" + material.opacity + ";stroke-width:" + material.wireframeLinewidth + ";stroke-linecap:" + material.wireframeLinecap + ";stroke-linejoin:" + material.wireframeLinejoin;
|
|
731
732
|
} else {
|
|
732
|
-
style = "fill:" + _color2.getStyle() + ";fill-opacity:" + material.opacity;
|
|
733
|
+
style = "fill:" + _color2.getStyle(_this.outputColorSpace) + ";fill-opacity:" + material.opacity;
|
|
733
734
|
}
|
|
734
735
|
addPath(style, path);
|
|
735
736
|
}
|
|
@@ -778,230 +779,187 @@
|
|
|
778
779
|
};
|
|
779
780
|
/**
|
|
780
781
|
* @license
|
|
781
|
-
*
|
|
782
|
+
* ts-browser-helpers v0.19.4
|
|
782
783
|
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
783
784
|
* MIT License
|
|
785
|
+
* See ./dependencies.txt for bundled third-party dependencies and licenses.
|
|
784
786
|
*/
|
|
785
|
-
function
|
|
786
|
-
return
|
|
787
|
+
function Fe(t, ...e) {
|
|
788
|
+
return t;
|
|
787
789
|
}
|
|
788
|
-
function
|
|
789
|
-
|
|
790
|
-
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
791
|
-
const t = new DataView(e.buffer);
|
|
792
|
-
return `${n(t.getUint32(0), 8)}-${n(t.getUint16(4), 4)}-${n(t.getUint16(6), 4)}-${n(t.getUint16(8), 4)}-${n(t.getUint32(10), 8)}${n(t.getUint16(14), 4)}`;
|
|
793
|
-
}
|
|
794
|
-
class UiConfigTypeMap {
|
|
795
|
-
}
|
|
796
|
-
UiConfigTypeMap.Map = /* @__PURE__ */ new Map();
|
|
797
|
-
function generateValueConfig(obj, key, label, val) {
|
|
798
|
-
val = val !== null && val !== void 0 ? val : obj[key];
|
|
799
|
-
const config = val === null || val === void 0 ? void 0 : val.uiConfig;
|
|
800
|
-
let result = void 0;
|
|
801
|
-
if (config) {
|
|
802
|
-
result = config;
|
|
803
|
-
} else {
|
|
804
|
-
const uiType = valueToUiType(val);
|
|
805
|
-
if (uiType === "folder") {
|
|
806
|
-
result = generateUiFolder(key + "", val, {}, "folder", true);
|
|
807
|
-
} else if (uiType)
|
|
808
|
-
result = {
|
|
809
|
-
type: uiType,
|
|
810
|
-
label: key + "",
|
|
811
|
-
property: [obj, key]
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
label = label !== null && label !== void 0 ? label : key + "";
|
|
815
|
-
if (result && !result.label)
|
|
816
|
-
result.label = label;
|
|
817
|
-
return result;
|
|
790
|
+
function L(t, e) {
|
|
791
|
+
return Object.hasOwn ? Object.hasOwn(t, e) : t.hasOwnProperty(e);
|
|
818
792
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
return
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
for (const key of keys) {
|
|
834
|
-
const val = obj[key];
|
|
835
|
-
if (val === void 0 || val === null)
|
|
836
|
-
continue;
|
|
837
|
-
const c = () => generateValueConfig(obj, key, key + "", val);
|
|
838
|
-
result.push(c);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
types.reverse().forEach((t) => {
|
|
842
|
-
var _a;
|
|
843
|
-
(_a = UiConfigTypeMap.Map.get(t)) === null || _a === void 0 ? void 0 : _a.forEach(({ params, propKey, uiType }) => {
|
|
844
|
-
let config;
|
|
845
|
-
if (!uiType) {
|
|
846
|
-
config = () => generateValueConfig(obj, propKey);
|
|
847
|
-
}
|
|
848
|
-
if (!config) {
|
|
849
|
-
config = {
|
|
850
|
-
property: [obj, propKey],
|
|
851
|
-
type: uiType || "input"
|
|
852
|
-
// ...params,
|
|
853
|
-
// ...extraParams,
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
if (params) {
|
|
857
|
-
const extraParams = typeof params.params === "function" ? params.params(obj) : params.params || {};
|
|
858
|
-
const params1 = Object.assign({}, params);
|
|
859
|
-
delete params1.params;
|
|
860
|
-
if (typeof config === "function") {
|
|
861
|
-
const c1 = config;
|
|
862
|
-
config = () => Object.assign(c1(), Object.assign(Object.assign({}, params1), extraParams));
|
|
863
|
-
}
|
|
864
|
-
Object.assign(config, Object.assign(Object.assign({}, params1), extraParams));
|
|
793
|
+
const k = class k2 {
|
|
794
|
+
static callFunction(e, i, n = []) {
|
|
795
|
+
if (!i) return e(...n);
|
|
796
|
+
if (e.name && i[e.name] === e) return e.call(i, ...n);
|
|
797
|
+
k2.methodMap.has(i) || k2.methodMap.set(i, /* @__PURE__ */ new WeakMap());
|
|
798
|
+
const r = k2.methodMap.get(i);
|
|
799
|
+
if (!r.has(e)) {
|
|
800
|
+
let o = i;
|
|
801
|
+
for (; o; ) {
|
|
802
|
+
const s = Object.values(Object.getOwnPropertyDescriptors(o));
|
|
803
|
+
for (let a of s)
|
|
804
|
+
if (a.value === e)
|
|
805
|
+
return r.set(e, true), e.call(i, ...n);
|
|
806
|
+
o = Object.getPrototypeOf(o);
|
|
865
807
|
}
|
|
866
|
-
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
return result;
|
|
870
|
-
}
|
|
871
|
-
function generateUiFolder(label, obj, params = {}, type = "folder", dynamic = false) {
|
|
872
|
-
return Object.assign({ type, label, children: !dynamic ? generateUiConfig(obj) : () => generateUiConfig(obj), uuid: it() }, params);
|
|
873
|
-
}
|
|
874
|
-
function valueToUiType(val) {
|
|
875
|
-
if (val === null || val === void 0)
|
|
876
|
-
return null;
|
|
877
|
-
if (Array.isArray(val))
|
|
878
|
-
return "folder";
|
|
879
|
-
if (typeof val === "boolean")
|
|
880
|
-
return "checkbox";
|
|
881
|
-
if (typeof val === "number")
|
|
882
|
-
return "number";
|
|
883
|
-
if (typeof val === "string")
|
|
884
|
-
return "input";
|
|
885
|
-
if (typeof val === "function")
|
|
886
|
-
return "button";
|
|
887
|
-
if (typeof val.x === "number")
|
|
888
|
-
return "vec";
|
|
889
|
-
if (typeof val.r === "number")
|
|
890
|
-
return "color";
|
|
891
|
-
if (val.isTexture)
|
|
892
|
-
return "image";
|
|
893
|
-
if (typeof val === "object")
|
|
894
|
-
return "folder";
|
|
895
|
-
return null;
|
|
896
|
-
}
|
|
897
|
-
function uiConfigDecorator(action) {
|
|
898
|
-
return (targetPrototype, propertyKey) => {
|
|
899
|
-
const type = targetPrototype.constructor;
|
|
900
|
-
if (type === Object)
|
|
901
|
-
throw new Error("Not possible to use uiConfig decorator on an object, use class instead");
|
|
902
|
-
if (!UiConfigTypeMap.Map.has(type))
|
|
903
|
-
UiConfigTypeMap.Map.set(type, []);
|
|
904
|
-
action(targetPrototype, propertyKey, UiConfigTypeMap.Map.get(type));
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
function uiConfig(uiType, params) {
|
|
908
|
-
return uiConfigDecorator((_, propertyKey, uiConfigs) => {
|
|
909
|
-
const index = uiConfigs.findIndex((item) => item.propKey === propertyKey);
|
|
910
|
-
if (index && index < 0)
|
|
911
|
-
uiConfigs.push({
|
|
912
|
-
params: params || {},
|
|
913
|
-
propKey: propertyKey,
|
|
914
|
-
uiType
|
|
915
|
-
});
|
|
916
|
-
else {
|
|
917
|
-
throw new Error(`Property ${propertyKey} already has a uiConfig decorator`);
|
|
808
|
+
r.set(e, false);
|
|
918
809
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
810
|
+
return r.get(e) ? e.call(i, ...n) : e(...n);
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
k.methodMap = /* @__PURE__ */ new WeakMap();
|
|
814
|
+
let U$1 = k;
|
|
815
|
+
function I(t, e = "param") {
|
|
816
|
+
if (!t) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
817
|
+
return (i, n, r) => {
|
|
818
|
+
const o = {
|
|
819
|
+
get() {
|
|
820
|
+
return this[`_oc_${n}`];
|
|
821
|
+
},
|
|
822
|
+
set(s) {
|
|
823
|
+
var u;
|
|
824
|
+
const a = this[`_oc_${n}`];
|
|
825
|
+
if (a === s) return;
|
|
826
|
+
this[`_oc_${n}`] = s;
|
|
827
|
+
const c2 = e === "param" ? [n, s, a, this] : e === "object" ? [{ key: n, value: s, oldValue: a, target: this }] : [];
|
|
828
|
+
typeof t == "string" ? (u = this[t]) == null || u.call(this, ...c2) : typeof t == "function" && U$1.callFunction(t, this, c2);
|
|
927
829
|
}
|
|
928
830
|
};
|
|
831
|
+
if (r)
|
|
832
|
+
return L(r, "value") && delete r.value, L(r, "writable") && delete r.writable, L(r, "initializer") && delete r.initializer, Object.assign(r, o);
|
|
833
|
+
Object.defineProperty(i, n, o);
|
|
929
834
|
};
|
|
930
835
|
}
|
|
931
|
-
function
|
|
932
|
-
if (
|
|
933
|
-
|
|
934
|
-
return uiConfig("dropdown", { label, children, params });
|
|
935
|
-
}
|
|
936
|
-
function uiNumber(label, params) {
|
|
937
|
-
return uiConfig("number", { label, params });
|
|
938
|
-
}
|
|
939
|
-
function uiToggle(label, params) {
|
|
940
|
-
return uiConfig("checkbox", { label, params });
|
|
836
|
+
function Ke(t, e = "void") {
|
|
837
|
+
if (!t) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
838
|
+
return I(t, e);
|
|
941
839
|
}
|
|
942
|
-
function
|
|
943
|
-
|
|
840
|
+
function xt() {
|
|
841
|
+
const t = (n, r) => n.toString(16).padStart(r, "0"), e = crypto.getRandomValues(new Uint8Array(16));
|
|
842
|
+
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
843
|
+
const i = new DataView(e.buffer);
|
|
844
|
+
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)}`;
|
|
944
845
|
}
|
|
945
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
946
|
-
var e = new Error(message);
|
|
947
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
948
|
-
};
|
|
949
846
|
/**
|
|
950
847
|
* @license
|
|
951
|
-
*
|
|
848
|
+
* uiconfig.js v0.3.1
|
|
952
849
|
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
953
850
|
* MIT License
|
|
954
851
|
* See ./dependencies.txt for bundled third-party dependencies and licenses.
|
|
955
852
|
*/
|
|
956
|
-
|
|
957
|
-
return Object.hasOwn ? Object.hasOwn(n, e) : n.hasOwnProperty(e);
|
|
958
|
-
}
|
|
959
|
-
const m = class m2 {
|
|
960
|
-
static callFunction(e, t, i = []) {
|
|
961
|
-
if (!t) return e(...i);
|
|
962
|
-
if (e.name && t[e.name] === e) return e.call(t, ...i);
|
|
963
|
-
m2.methodMap.has(t) || m2.methodMap.set(t, /* @__PURE__ */ new WeakMap());
|
|
964
|
-
const r = m2.methodMap.get(t);
|
|
965
|
-
if (!r.has(e)) {
|
|
966
|
-
let s = t;
|
|
967
|
-
for (; s; ) {
|
|
968
|
-
const o = Object.values(Object.getOwnPropertyDescriptors(s));
|
|
969
|
-
for (let c of o)
|
|
970
|
-
if (c.value === e)
|
|
971
|
-
return r.set(e, true), e.call(t, ...i);
|
|
972
|
-
s = Object.getPrototypeOf(s);
|
|
973
|
-
}
|
|
974
|
-
r.set(e, false);
|
|
975
|
-
}
|
|
976
|
-
return r.get(e) ? e.call(t, ...i) : e(...i);
|
|
977
|
-
}
|
|
853
|
+
const C = class C {
|
|
978
854
|
};
|
|
979
|
-
|
|
980
|
-
let
|
|
981
|
-
function
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
855
|
+
C.Map = /* @__PURE__ */ new Map();
|
|
856
|
+
let c = C;
|
|
857
|
+
function v(n, e, t, r, i = true) {
|
|
858
|
+
r = r ?? n[e], t = t ?? e + "";
|
|
859
|
+
const o = r == null ? void 0 : r.uiConfig;
|
|
860
|
+
let s;
|
|
861
|
+
if (o)
|
|
862
|
+
s = o;
|
|
863
|
+
else {
|
|
864
|
+
const a = T(r);
|
|
865
|
+
a === "folder" ? s = U(t, r, {}, "folder", i) : a && (s = {
|
|
866
|
+
type: a,
|
|
867
|
+
label: t,
|
|
868
|
+
property: [n, e]
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
return s && !s.label && (s.label = t), s;
|
|
872
|
+
}
|
|
873
|
+
function _(n) {
|
|
874
|
+
if (!n) return [];
|
|
875
|
+
let e = n.constructor || Object;
|
|
876
|
+
e === Array && (e = Object);
|
|
877
|
+
const t = [], r = [];
|
|
878
|
+
for (; e && e !== Object; )
|
|
879
|
+
r.push(e), e = Object.getPrototypeOf(e);
|
|
880
|
+
if (!r.length || Array.isArray(n)) {
|
|
881
|
+
const i = typeof n == "object" ? Object.keys(n) : Array.isArray(n) ? n.map((o, s) => s) : [];
|
|
882
|
+
for (const o of i) {
|
|
883
|
+
const s = n[o];
|
|
884
|
+
if (s == null) continue;
|
|
885
|
+
const a = v(n, o, o + "", s, true);
|
|
886
|
+
a && t.push(a);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return r.reverse().forEach((i) => {
|
|
890
|
+
var o;
|
|
891
|
+
(o = c.Map.get(i)) == null || o.forEach(({ params: s, propKey: a, uiType: u }) => {
|
|
892
|
+
let d;
|
|
893
|
+
if (u || (d = () => v(n, a)), d || (d = {
|
|
894
|
+
property: [n, a],
|
|
895
|
+
type: u || "input"
|
|
896
|
+
// ...params,
|
|
897
|
+
// ...extraParams,
|
|
898
|
+
}), s) {
|
|
899
|
+
const y2 = typeof s.params == "function" ? s.params(n) : s.params || {}, p = { ...s };
|
|
900
|
+
if (delete p.params, typeof d == "function") {
|
|
901
|
+
const m = d;
|
|
902
|
+
d = () => {
|
|
903
|
+
const l = m();
|
|
904
|
+
return l && Object.assign(l, { ...p, ...y2 });
|
|
905
|
+
};
|
|
906
|
+
} else
|
|
907
|
+
Object.assign(d, { ...p, ...y2 });
|
|
995
908
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
909
|
+
t.push(d);
|
|
910
|
+
});
|
|
911
|
+
}), t;
|
|
912
|
+
}
|
|
913
|
+
function U(n, e, t = {}, r = "folder", i = false) {
|
|
914
|
+
return {
|
|
915
|
+
type: r,
|
|
916
|
+
label: n,
|
|
917
|
+
children: i ? [() => _(e)] : _(e),
|
|
918
|
+
uuid: xt(),
|
|
919
|
+
...t
|
|
1000
920
|
};
|
|
1001
921
|
}
|
|
1002
|
-
function
|
|
1003
|
-
|
|
1004
|
-
|
|
922
|
+
function T(n) {
|
|
923
|
+
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
|
+
}
|
|
925
|
+
function B(n) {
|
|
926
|
+
return (e, t) => {
|
|
927
|
+
const r = e.constructor;
|
|
928
|
+
if (r === Object) throw new Error("Not possible to use uiConfig decorator on an object, use class instead");
|
|
929
|
+
c.Map.has(r) || c.Map.set(r, []), n(e, t, c.Map.get(r));
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function h(n, e) {
|
|
933
|
+
return B((t, r, i) => {
|
|
934
|
+
const o = i.findIndex((s) => s.propKey === r);
|
|
935
|
+
if (o && o < 0)
|
|
936
|
+
i.push({
|
|
937
|
+
params: e || {},
|
|
938
|
+
propKey: r,
|
|
939
|
+
uiType: n
|
|
940
|
+
});
|
|
941
|
+
else
|
|
942
|
+
throw new Error(`Property ${r} already has a uiConfig decorator`);
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function b(n, e, t = "panel") {
|
|
946
|
+
return (r) => class extends r {
|
|
947
|
+
constructor() {
|
|
948
|
+
super(...arguments), this.uiConfig = U(Fe(n, this) || "", this, {}, t);
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
function N(n, e, t) {
|
|
953
|
+
return Array.isArray(e) && typeof e[0] == "string" && (e = e.map((r) => ({ label: r, value: r }))), h("dropdown", { label: n, children: e, params: t });
|
|
954
|
+
}
|
|
955
|
+
function H(n, e) {
|
|
956
|
+
return h("number", { label: n, params: e });
|
|
957
|
+
}
|
|
958
|
+
function G$1(n, e) {
|
|
959
|
+
return h("checkbox", { label: n, params: e });
|
|
960
|
+
}
|
|
961
|
+
function X(n, e) {
|
|
962
|
+
return b(n, e, "folder");
|
|
1005
963
|
}
|
|
1006
964
|
var __defProp$2 = Object.defineProperty;
|
|
1007
965
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1023,23 +981,23 @@
|
|
|
1023
981
|
}
|
|
1024
982
|
};
|
|
1025
983
|
__decorateClass$2([
|
|
1026
|
-
|
|
984
|
+
G$1()
|
|
1027
985
|
], exports2.BasicSVGRenderer.prototype, "autoClear", 2);
|
|
1028
986
|
__decorateClass$2([
|
|
1029
|
-
|
|
987
|
+
G$1()
|
|
1030
988
|
], exports2.BasicSVGRenderer.prototype, "sortObjects", 2);
|
|
1031
989
|
__decorateClass$2([
|
|
1032
|
-
|
|
990
|
+
G$1()
|
|
1033
991
|
], exports2.BasicSVGRenderer.prototype, "sortElements", 2);
|
|
1034
992
|
__decorateClass$2([
|
|
1035
|
-
|
|
993
|
+
H()
|
|
1036
994
|
], exports2.BasicSVGRenderer.prototype, "overdraw", 2);
|
|
1037
995
|
__decorateClass$2([
|
|
1038
|
-
|
|
1039
|
-
|
|
996
|
+
N(void 0, ["low", "high"]),
|
|
997
|
+
Ke(exports2.BasicSVGRenderer.prototype._refresh)
|
|
1040
998
|
], exports2.BasicSVGRenderer.prototype, "quality", 2);
|
|
1041
999
|
exports2.BasicSVGRenderer = __decorateClass$2([
|
|
1042
|
-
|
|
1000
|
+
X("Basic SVG Renderer")
|
|
1043
1001
|
], exports2.BasicSVGRenderer);
|
|
1044
1002
|
var __defProp$1 = Object.defineProperty;
|
|
1045
1003
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
@@ -1064,7 +1022,7 @@
|
|
|
1064
1022
|
this._lastStyles = void 0;
|
|
1065
1023
|
this.autoRender = true;
|
|
1066
1024
|
this._viewerListeners = {
|
|
1067
|
-
postRender: (
|
|
1025
|
+
postRender: (_2) => {
|
|
1068
1026
|
if (this.autoRender) this.render();
|
|
1069
1027
|
}
|
|
1070
1028
|
};
|
|
@@ -1165,14 +1123,14 @@
|
|
|
1165
1123
|
/* MeshIntersection */
|
|
1166
1124
|
]);
|
|
1167
1125
|
class ViewEdge {
|
|
1168
|
-
constructor(a,
|
|
1126
|
+
constructor(a, b2, nature, halfedge) {
|
|
1169
1127
|
this.meshes = new Array();
|
|
1170
1128
|
this.faceAngle = Infinity;
|
|
1171
1129
|
this.isBack = false;
|
|
1172
1130
|
this.isConcave = false;
|
|
1173
1131
|
this.faces = new Array();
|
|
1174
1132
|
this.a = a;
|
|
1175
|
-
this.b =
|
|
1133
|
+
this.b = b2;
|
|
1176
1134
|
this.nature = nature;
|
|
1177
1135
|
this.halfedge = halfedge;
|
|
1178
1136
|
}
|
|
@@ -1306,26 +1264,26 @@
|
|
|
1306
1264
|
}
|
|
1307
1265
|
return false;
|
|
1308
1266
|
}
|
|
1309
|
-
function vectors3Equal(a,
|
|
1310
|
-
return Math.abs(a.x -
|
|
1267
|
+
function vectors3Equal(a, b2, tolerance = 1e-10) {
|
|
1268
|
+
return Math.abs(a.x - b2.x) < tolerance && Math.abs(a.y - b2.y) < tolerance && Math.abs(a.z - b2.z) < tolerance;
|
|
1311
1269
|
}
|
|
1312
|
-
function vectors2Equal(a,
|
|
1313
|
-
return Math.abs(a.x -
|
|
1270
|
+
function vectors2Equal(a, b2, tolerance = 1e-10) {
|
|
1271
|
+
return Math.abs(a.x - b2.x) < tolerance && Math.abs(a.y - b2.y) < tolerance;
|
|
1314
1272
|
}
|
|
1315
1273
|
const _matrix$3 = new three.Matrix4();
|
|
1316
|
-
function orient3D$2(a,
|
|
1274
|
+
function orient3D$2(a, b2, c2, d, epsilon = 1e-10) {
|
|
1317
1275
|
_matrix$3.set(
|
|
1318
1276
|
a.x,
|
|
1319
1277
|
a.y,
|
|
1320
1278
|
a.z,
|
|
1321
1279
|
1,
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1280
|
+
b2.x,
|
|
1281
|
+
b2.y,
|
|
1282
|
+
b2.z,
|
|
1325
1283
|
1,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1284
|
+
c2.x,
|
|
1285
|
+
c2.y,
|
|
1286
|
+
c2.z,
|
|
1329
1287
|
1,
|
|
1330
1288
|
d.x,
|
|
1331
1289
|
d.y,
|
|
@@ -1340,11 +1298,11 @@
|
|
|
1340
1298
|
}
|
|
1341
1299
|
return 0;
|
|
1342
1300
|
}
|
|
1343
|
-
function frontSide$1(a,
|
|
1344
|
-
return orient3D$2(d,
|
|
1301
|
+
function frontSide$1(a, b2, c2, d, epsilon = 1e-10) {
|
|
1302
|
+
return orient3D$2(d, b2, c2, a, epsilon) > 0;
|
|
1345
1303
|
}
|
|
1346
|
-
function sameSide(a,
|
|
1347
|
-
return orient3D$2(a,
|
|
1304
|
+
function sameSide(a, b2, c2, d, e, epsilon = 1e-10) {
|
|
1305
|
+
return orient3D$2(a, b2, c2, d, epsilon) > 0 === orient3D$2(a, b2, c2, e, epsilon) > 0;
|
|
1348
1306
|
}
|
|
1349
1307
|
function round(num, divider = 100) {
|
|
1350
1308
|
return Math.round(num * divider) / divider;
|
|
@@ -2103,7 +2061,7 @@
|
|
|
2103
2061
|
var wasmBinary;
|
|
2104
2062
|
if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
|
|
2105
2063
|
legacyModuleProp("wasmBinary", "wasmBinary");
|
|
2106
|
-
|
|
2064
|
+
Module["noExitRuntime"] || true;
|
|
2107
2065
|
legacyModuleProp("noExitRuntime", "noExitRuntime");
|
|
2108
2066
|
if (typeof WebAssembly != "object") {
|
|
2109
2067
|
abort("no native wasm support detected");
|
|
@@ -2261,9 +2219,6 @@
|
|
|
2261
2219
|
var __ATINIT__ = [];
|
|
2262
2220
|
var __ATPOSTRUN__ = [];
|
|
2263
2221
|
var runtimeInitialized = false;
|
|
2264
|
-
function keepRuntimeAlive() {
|
|
2265
|
-
return noExitRuntime;
|
|
2266
|
-
}
|
|
2267
2222
|
function preRun() {
|
|
2268
2223
|
if (Module["preRun"]) {
|
|
2269
2224
|
if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
|
|
@@ -3011,7 +2966,7 @@
|
|
|
3011
2966
|
bytes[i] = decoded.charCodeAt(i);
|
|
3012
2967
|
}
|
|
3013
2968
|
return bytes;
|
|
3014
|
-
} catch (
|
|
2969
|
+
} catch (_2) {
|
|
3015
2970
|
throw new Error("Converting base64 string to bytes failed.");
|
|
3016
2971
|
}
|
|
3017
2972
|
}
|
|
@@ -3396,10 +3351,6 @@
|
|
|
3396
3351
|
procExit(status);
|
|
3397
3352
|
}
|
|
3398
3353
|
function procExit(code) {
|
|
3399
|
-
if (!keepRuntimeAlive()) {
|
|
3400
|
-
if (Module["onExit"]) Module["onExit"](code);
|
|
3401
|
-
ABORT = true;
|
|
3402
|
-
}
|
|
3403
3354
|
quit_(code, new ExitStatus(code));
|
|
3404
3355
|
}
|
|
3405
3356
|
if (Module["preInit"]) {
|
|
@@ -3708,16 +3659,16 @@
|
|
|
3708
3659
|
async function computePolygons(viewmap, info = new PolygonsInfo()) {
|
|
3709
3660
|
const { chains, polygons } = viewmap;
|
|
3710
3661
|
const Arr2D = await Arr2DPromise;
|
|
3711
|
-
const visibleChains = chains.filter((
|
|
3662
|
+
const visibleChains = chains.filter((c2) => c2.visibility === ChainVisibility.Visible);
|
|
3712
3663
|
const points = new Arr2D.PointList();
|
|
3713
|
-
let a,
|
|
3664
|
+
let a, b2;
|
|
3714
3665
|
for (const chain of visibleChains) {
|
|
3715
3666
|
a = new Arr2D.Point(chain.vertices[0].pos2d.x, chain.vertices[0].pos2d.y);
|
|
3716
3667
|
for (let i = 1; i < chain.vertices.length; i++) {
|
|
3717
|
-
|
|
3668
|
+
b2 = new Arr2D.Point(chain.vertices[i].pos2d.x, chain.vertices[i].pos2d.y);
|
|
3718
3669
|
points.push_back(a);
|
|
3719
|
-
points.push_back(
|
|
3720
|
-
a =
|
|
3670
|
+
points.push_back(b2);
|
|
3671
|
+
a = b2;
|
|
3721
3672
|
}
|
|
3722
3673
|
}
|
|
3723
3674
|
const builder = new Arr2D.ArrangementBuilder();
|
|
@@ -3882,7 +3833,6 @@
|
|
|
3882
3833
|
for (const polygon of polygons) {
|
|
3883
3834
|
imagePointToNDC(polygon.insidePoint, _vec2, renderSize);
|
|
3884
3835
|
_raycaster$1.setFromCamera(_vec2, camera);
|
|
3885
|
-
_raycaster$1.firstHitOnly = true;
|
|
3886
3836
|
const intersections = _raycaster$1.intersectObjects(threeMeshes, false);
|
|
3887
3837
|
if (intersections.length > 0) {
|
|
3888
3838
|
const intersection = intersections[0];
|
|
@@ -3953,7 +3903,6 @@
|
|
|
3953
3903
|
}
|
|
3954
3904
|
_rayOrigin.lerpVectors(edge.a.pos3d, edge.b.pos3d, 0.5);
|
|
3955
3905
|
_rayDirection.subVectors(camera.position, _rayOrigin).normalize();
|
|
3956
|
-
_raycaster.firstHitOnly = false;
|
|
3957
3906
|
_raycaster.set(_rayOrigin, _rayDirection);
|
|
3958
3907
|
chain.raycastPoint.lerpVectors(edge.a.pos2d, edge.b.pos2d, 0.5);
|
|
3959
3908
|
const intersections = _raycaster.intersectObjects(objects, false);
|
|
@@ -3976,22 +3925,22 @@
|
|
|
3976
3925
|
_tmp1.subVectors(tri.a, tri.b);
|
|
3977
3926
|
_tmp2.subVectors(tri.a, tri.c);
|
|
3978
3927
|
_tmp1.cross(_tmp2);
|
|
3979
|
-
return _tmp1.x > -
|
|
3928
|
+
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;
|
|
3980
3929
|
}
|
|
3981
|
-
function orient3D$1(a,
|
|
3982
|
-
_matrix4.set(a.x, a.y, a.z, 1,
|
|
3930
|
+
function orient3D$1(a, b2, c2, d) {
|
|
3931
|
+
_matrix4.set(a.x, a.y, a.z, 1, b2.x, b2.y, b2.z, 1, c2.x, c2.y, c2.z, 1, d.x, d.y, d.z, 1);
|
|
3983
3932
|
const det = _matrix4.determinant();
|
|
3984
|
-
if (det < -
|
|
3933
|
+
if (det < -EPSILON$1)
|
|
3985
3934
|
return -1;
|
|
3986
3935
|
else if (det > EPSILON$1)
|
|
3987
3936
|
return 1;
|
|
3988
3937
|
else
|
|
3989
3938
|
return 0;
|
|
3990
3939
|
}
|
|
3991
|
-
function orient2D(a,
|
|
3992
|
-
_matrix3.set(a.x, a.y, 1,
|
|
3940
|
+
function orient2D(a, b2, c2) {
|
|
3941
|
+
_matrix3.set(a.x, a.y, 1, b2.x, b2.y, 1, c2.x, c2.y, 1);
|
|
3993
3942
|
const det = _matrix3.determinant();
|
|
3994
|
-
if (det < -
|
|
3943
|
+
if (det < -EPSILON$1)
|
|
3995
3944
|
return -1;
|
|
3996
3945
|
else if (det > EPSILON$1)
|
|
3997
3946
|
return 1;
|
|
@@ -4076,8 +4025,8 @@
|
|
|
4076
4025
|
other.b = tmp;
|
|
4077
4026
|
}
|
|
4078
4027
|
}
|
|
4079
|
-
function intersectPlane(a,
|
|
4080
|
-
_u$1$1.subVectors(
|
|
4028
|
+
function intersectPlane(a, b2, p, n, target) {
|
|
4029
|
+
_u$1$1.subVectors(b2, a);
|
|
4081
4030
|
_v$1$1.subVectors(a, p);
|
|
4082
4031
|
const dot1 = n.dot(_u$1$1);
|
|
4083
4032
|
const dot2 = n.dot(_v$1$1);
|
|
@@ -4456,15 +4405,15 @@
|
|
|
4456
4405
|
};
|
|
4457
4406
|
}
|
|
4458
4407
|
function splitViewEdgeWithViewVertex(viewmap, edge, vertex) {
|
|
4459
|
-
const
|
|
4408
|
+
const b2 = edge.b;
|
|
4460
4409
|
const newEdge = edge.clone();
|
|
4461
4410
|
edge.b = vertex;
|
|
4462
4411
|
newEdge.a = vertex;
|
|
4463
|
-
newEdge.b =
|
|
4412
|
+
newEdge.b = b2;
|
|
4464
4413
|
vertex.viewEdges.push(edge);
|
|
4465
4414
|
vertex.viewEdges.push(newEdge);
|
|
4466
|
-
|
|
4467
|
-
|
|
4415
|
+
b2.viewEdges.remove(edge);
|
|
4416
|
+
b2.viewEdges.push(newEdge);
|
|
4468
4417
|
for (const face of newEdge.faces) {
|
|
4469
4418
|
face.viewEdges.push(newEdge);
|
|
4470
4419
|
}
|
|
@@ -4512,8 +4461,8 @@
|
|
|
4512
4461
|
}
|
|
4513
4462
|
}
|
|
4514
4463
|
_dir.subVectors(line.end, line.start);
|
|
4515
|
-
intersectionViewVertices.sort((a,
|
|
4516
|
-
_dir.subVectors(
|
|
4464
|
+
intersectionViewVertices.sort((a, b2) => {
|
|
4465
|
+
_dir.subVectors(b2.pos3d, a.pos3d);
|
|
4517
4466
|
return _dir.dot(_lineDir);
|
|
4518
4467
|
});
|
|
4519
4468
|
for (let i = 0; i < intersectionViewVertices.length - 1; i++) {
|
|
@@ -4589,16 +4538,16 @@
|
|
|
4589
4538
|
this.left = null;
|
|
4590
4539
|
this.right = null;
|
|
4591
4540
|
};
|
|
4592
|
-
function DEFAULT_COMPARE(a,
|
|
4593
|
-
return a >
|
|
4541
|
+
function DEFAULT_COMPARE(a, b2) {
|
|
4542
|
+
return a > b2 ? 1 : a < b2 ? -1 : 0;
|
|
4594
4543
|
}
|
|
4595
4544
|
function splay(i, t, comparator) {
|
|
4596
4545
|
if (t === null) {
|
|
4597
4546
|
return t;
|
|
4598
4547
|
}
|
|
4599
4548
|
var l, r, y2;
|
|
4600
|
-
var
|
|
4601
|
-
l = r =
|
|
4549
|
+
var N2 = new Node();
|
|
4550
|
+
l = r = N2;
|
|
4602
4551
|
while (true) {
|
|
4603
4552
|
var cmp = comparator(i, t.key);
|
|
4604
4553
|
if (cmp < 0) {
|
|
@@ -4639,8 +4588,8 @@
|
|
|
4639
4588
|
}
|
|
4640
4589
|
l.right = t.left;
|
|
4641
4590
|
r.left = t.right;
|
|
4642
|
-
t.left =
|
|
4643
|
-
t.right =
|
|
4591
|
+
t.left = N2.right;
|
|
4592
|
+
t.right = N2.left;
|
|
4644
4593
|
return t;
|
|
4645
4594
|
}
|
|
4646
4595
|
function insert(i, data2, t, comparator, tree) {
|
|
@@ -5096,8 +5045,8 @@
|
|
|
5096
5045
|
return null;
|
|
5097
5046
|
}
|
|
5098
5047
|
function mergeLists(l1, l2, compare) {
|
|
5099
|
-
if (compare === void 0) compare = function(a,
|
|
5100
|
-
return a -
|
|
5048
|
+
if (compare === void 0) compare = function(a, b2) {
|
|
5049
|
+
return a - b2;
|
|
5101
5050
|
};
|
|
5102
5051
|
var head = {};
|
|
5103
5052
|
var p = head;
|
|
@@ -5147,10 +5096,10 @@
|
|
|
5147
5096
|
sort(keys, values, left, j, compare);
|
|
5148
5097
|
sort(keys, values, j + 1, right, compare);
|
|
5149
5098
|
}
|
|
5150
|
-
function intersectSegments$1(a,
|
|
5151
|
-
var aStart = a.from, bStart =
|
|
5099
|
+
function intersectSegments$1(a, b2) {
|
|
5100
|
+
var aStart = a.from, bStart = b2.from;
|
|
5152
5101
|
var p0_x = aStart.x, p0_y = aStart.y, p2_x = bStart.x, p2_y = bStart.y;
|
|
5153
|
-
var s1_x = a.from.x - a.to.x, s1_y = a.from.y - a.to.y, s2_x =
|
|
5102
|
+
var s1_x = a.from.x - a.to.x, s1_y = a.from.y - a.to.y, s2_x = b2.from.x - b2.to.x, s2_y = b2.from.y - b2.to.y;
|
|
5154
5103
|
var div = s1_x * s2_y - s2_x * s1_y;
|
|
5155
5104
|
var s = (s1_y * (p0_x - p2_x) - s1_x * (p0_y - p2_y)) / div;
|
|
5156
5105
|
if (s < 0 || s > 1) {
|
|
@@ -5382,59 +5331,59 @@
|
|
|
5382
5331
|
var temp5 = values[i];
|
|
5383
5332
|
values[i] = values[j];
|
|
5384
5333
|
values[j] = temp5;
|
|
5385
|
-
var
|
|
5386
|
-
var
|
|
5387
|
-
var a = boxes[
|
|
5388
|
-
var
|
|
5389
|
-
var
|
|
5390
|
-
var d = boxes[
|
|
5391
|
-
boxes[
|
|
5392
|
-
boxes[
|
|
5393
|
-
boxes[
|
|
5394
|
-
boxes[
|
|
5395
|
-
boxes[
|
|
5396
|
-
boxes[
|
|
5397
|
-
boxes[
|
|
5398
|
-
boxes[
|
|
5334
|
+
var k2 = 4 * i;
|
|
5335
|
+
var m = 4 * j;
|
|
5336
|
+
var a = boxes[k2];
|
|
5337
|
+
var b2 = boxes[k2 + 1];
|
|
5338
|
+
var c2 = boxes[k2 + 2];
|
|
5339
|
+
var d = boxes[k2 + 3];
|
|
5340
|
+
boxes[k2] = boxes[m];
|
|
5341
|
+
boxes[k2 + 1] = boxes[m + 1];
|
|
5342
|
+
boxes[k2 + 2] = boxes[m + 2];
|
|
5343
|
+
boxes[k2 + 3] = boxes[m + 3];
|
|
5344
|
+
boxes[m] = a;
|
|
5345
|
+
boxes[m + 1] = b2;
|
|
5346
|
+
boxes[m + 2] = c2;
|
|
5347
|
+
boxes[m + 3] = d;
|
|
5399
5348
|
var e = indices[i];
|
|
5400
5349
|
indices[i] = indices[j];
|
|
5401
5350
|
indices[j] = e;
|
|
5402
5351
|
}
|
|
5403
5352
|
function hilbert(x2, y2) {
|
|
5404
5353
|
var a = x2 ^ y2;
|
|
5405
|
-
var
|
|
5406
|
-
var
|
|
5354
|
+
var b2 = 65535 ^ a;
|
|
5355
|
+
var c2 = 65535 ^ (x2 | y2);
|
|
5407
5356
|
var d = x2 & (y2 ^ 65535);
|
|
5408
|
-
var A2 = a |
|
|
5409
|
-
var
|
|
5410
|
-
var
|
|
5411
|
-
var D = a &
|
|
5357
|
+
var A2 = a | b2 >> 1;
|
|
5358
|
+
var B2 = a >> 1 ^ a;
|
|
5359
|
+
var C2 = c2 >> 1 ^ b2 & d >> 1 ^ c2;
|
|
5360
|
+
var D = a & c2 >> 1 ^ d >> 1 ^ d;
|
|
5412
5361
|
a = A2;
|
|
5413
|
-
|
|
5414
|
-
|
|
5362
|
+
b2 = B2;
|
|
5363
|
+
c2 = C2;
|
|
5415
5364
|
d = D;
|
|
5416
|
-
A2 = a & a >> 2 ^
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
D ^=
|
|
5365
|
+
A2 = a & a >> 2 ^ b2 & b2 >> 2;
|
|
5366
|
+
B2 = a & b2 >> 2 ^ b2 & (a ^ b2) >> 2;
|
|
5367
|
+
C2 ^= a & c2 >> 2 ^ b2 & d >> 2;
|
|
5368
|
+
D ^= b2 & c2 >> 2 ^ (a ^ b2) & d >> 2;
|
|
5420
5369
|
a = A2;
|
|
5421
|
-
|
|
5422
|
-
|
|
5370
|
+
b2 = B2;
|
|
5371
|
+
c2 = C2;
|
|
5423
5372
|
d = D;
|
|
5424
|
-
A2 = a & a >> 4 ^
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
D ^=
|
|
5373
|
+
A2 = a & a >> 4 ^ b2 & b2 >> 4;
|
|
5374
|
+
B2 = a & b2 >> 4 ^ b2 & (a ^ b2) >> 4;
|
|
5375
|
+
C2 ^= a & c2 >> 4 ^ b2 & d >> 4;
|
|
5376
|
+
D ^= b2 & c2 >> 4 ^ (a ^ b2) & d >> 4;
|
|
5428
5377
|
a = A2;
|
|
5429
|
-
|
|
5430
|
-
|
|
5378
|
+
b2 = B2;
|
|
5379
|
+
c2 = C2;
|
|
5431
5380
|
d = D;
|
|
5432
|
-
|
|
5433
|
-
D ^=
|
|
5434
|
-
a =
|
|
5435
|
-
|
|
5381
|
+
C2 ^= a & c2 >> 8 ^ b2 & d >> 8;
|
|
5382
|
+
D ^= b2 & c2 >> 8 ^ (a ^ b2) & d >> 8;
|
|
5383
|
+
a = C2 ^ C2 >> 1;
|
|
5384
|
+
b2 = D ^ D >> 1;
|
|
5436
5385
|
var i0 = x2 ^ y2;
|
|
5437
|
-
var i1 =
|
|
5386
|
+
var i1 = b2 | 65535 ^ (i0 | a);
|
|
5438
5387
|
i0 = (i0 | i0 << 8) & 16711935;
|
|
5439
5388
|
i0 = (i0 | i0 << 4) & 252645135;
|
|
5440
5389
|
i0 = (i0 | i0 << 2) & 858993459;
|
|
@@ -5537,8 +5486,8 @@
|
|
|
5537
5486
|
const { viewEdges } = viewmap;
|
|
5538
5487
|
const interAlgorithm = bush([...viewEdges]);
|
|
5539
5488
|
let intersections = interAlgorithm.run();
|
|
5540
|
-
intersections = intersections.filter(({ segments: [a,
|
|
5541
|
-
return !a.isConnectedTo(
|
|
5489
|
+
intersections = intersections.filter(({ segments: [a, b2] }) => {
|
|
5490
|
+
return !a.isConnectedTo(b2) && (VisibilityIndicatingNatures.has(a.nature) || VisibilityIndicatingNatures.has(b2.nature));
|
|
5542
5491
|
});
|
|
5543
5492
|
const cutMap = /* @__PURE__ */ new Map();
|
|
5544
5493
|
for (const intersection of intersections) {
|
|
@@ -5651,7 +5600,7 @@
|
|
|
5651
5600
|
}
|
|
5652
5601
|
}
|
|
5653
5602
|
if (farthestHalfedge && otherVertex) {
|
|
5654
|
-
const
|
|
5603
|
+
const c2 = camera.position;
|
|
5655
5604
|
const p = vertex.position;
|
|
5656
5605
|
const e = otherVertex.position;
|
|
5657
5606
|
const boundaryFace = farthestHalfedge.twin.face;
|
|
@@ -5660,7 +5609,7 @@
|
|
|
5660
5609
|
if (halfedge.face !== boundaryFace) {
|
|
5661
5610
|
const q = halfedge.next.vertex.position;
|
|
5662
5611
|
const r = halfedge.next.vertex.position;
|
|
5663
|
-
if (!sameSide(p, q, r,
|
|
5612
|
+
if (!sameSide(p, q, r, c2, e) && sameSide(c2, p, q, e, r) && sameSide(c2, p, r, e, q)) {
|
|
5664
5613
|
return true;
|
|
5665
5614
|
}
|
|
5666
5615
|
}
|
|
@@ -5760,7 +5709,7 @@
|
|
|
5760
5709
|
};
|
|
5761
5710
|
if (this.skipActions) res();
|
|
5762
5711
|
else {
|
|
5763
|
-
actions[idx].process().catch((
|
|
5712
|
+
actions[idx].process().catch((_2) => {
|
|
5764
5713
|
}).then(res);
|
|
5765
5714
|
}
|
|
5766
5715
|
} else {
|
|
@@ -5895,18 +5844,18 @@
|
|
|
5895
5844
|
return actions;
|
|
5896
5845
|
}
|
|
5897
5846
|
visibleChains() {
|
|
5898
|
-
return this.chains.filter((
|
|
5847
|
+
return this.chains.filter((c2) => c2.visibility === ChainVisibility.Visible);
|
|
5899
5848
|
}
|
|
5900
5849
|
hiddenChains() {
|
|
5901
|
-
return this.chains.filter((
|
|
5850
|
+
return this.chains.filter((c2) => c2.visibility === ChainVisibility.Hidden);
|
|
5902
5851
|
}
|
|
5903
5852
|
}
|
|
5904
5853
|
const methods$1 = {};
|
|
5905
5854
|
const names = [];
|
|
5906
|
-
function registerMethods(name,
|
|
5855
|
+
function registerMethods(name, m) {
|
|
5907
5856
|
if (Array.isArray(name)) {
|
|
5908
5857
|
for (const _name of name) {
|
|
5909
|
-
registerMethods(_name,
|
|
5858
|
+
registerMethods(_name, m);
|
|
5910
5859
|
}
|
|
5911
5860
|
return;
|
|
5912
5861
|
}
|
|
@@ -5916,8 +5865,8 @@
|
|
|
5916
5865
|
}
|
|
5917
5866
|
return;
|
|
5918
5867
|
}
|
|
5919
|
-
addMethodNames(Object.getOwnPropertyNames(
|
|
5920
|
-
methods$1[name] = Object.assign(methods$1[name] || {},
|
|
5868
|
+
addMethodNames(Object.getOwnPropertyNames(m));
|
|
5869
|
+
methods$1[name] = Object.assign(methods$1[name] || {}, m);
|
|
5921
5870
|
}
|
|
5922
5871
|
function getMethodsFor(name) {
|
|
5923
5872
|
return methods$1[name] || {};
|
|
@@ -5952,12 +5901,12 @@
|
|
|
5952
5901
|
return d % 360 * Math.PI / 180;
|
|
5953
5902
|
}
|
|
5954
5903
|
function camelCase(s) {
|
|
5955
|
-
return s.toLowerCase().replace(/-(.)/g, function(
|
|
5904
|
+
return s.toLowerCase().replace(/-(.)/g, function(m, g) {
|
|
5956
5905
|
return g.toUpperCase();
|
|
5957
5906
|
});
|
|
5958
5907
|
}
|
|
5959
5908
|
function unCamelCase(s) {
|
|
5960
|
-
return s.replace(/([A-Z])/g, function(
|
|
5909
|
+
return s.replace(/([A-Z])/g, function(m, g) {
|
|
5961
5910
|
return "-" + g.toLowerCase();
|
|
5962
5911
|
});
|
|
5963
5912
|
}
|
|
@@ -6206,8 +6155,8 @@
|
|
|
6206
6155
|
}
|
|
6207
6156
|
function removeClass(name) {
|
|
6208
6157
|
if (this.hasClass(name)) {
|
|
6209
|
-
this.attr("class", this.classes().filter(function(
|
|
6210
|
-
return
|
|
6158
|
+
this.attr("class", this.classes().filter(function(c2) {
|
|
6159
|
+
return c2 !== name;
|
|
6211
6160
|
}).join(" "));
|
|
6212
6161
|
}
|
|
6213
6162
|
return this;
|
|
@@ -6297,15 +6246,15 @@
|
|
|
6297
6246
|
registerMethods("Dom", {
|
|
6298
6247
|
data
|
|
6299
6248
|
});
|
|
6300
|
-
function remember(
|
|
6249
|
+
function remember(k2, v2) {
|
|
6301
6250
|
if (typeof arguments[0] === "object") {
|
|
6302
|
-
for (const key in
|
|
6303
|
-
this.remember(key,
|
|
6251
|
+
for (const key in k2) {
|
|
6252
|
+
this.remember(key, k2[key]);
|
|
6304
6253
|
}
|
|
6305
6254
|
} else if (arguments.length === 1) {
|
|
6306
|
-
return this.memory()[
|
|
6255
|
+
return this.memory()[k2];
|
|
6307
6256
|
} else {
|
|
6308
|
-
this.memory()[
|
|
6257
|
+
this.memory()[k2] = v2;
|
|
6309
6258
|
}
|
|
6310
6259
|
return this;
|
|
6311
6260
|
}
|
|
@@ -6344,7 +6293,7 @@
|
|
|
6344
6293
|
}
|
|
6345
6294
|
return true;
|
|
6346
6295
|
}
|
|
6347
|
-
function getParameters(a,
|
|
6296
|
+
function getParameters(a, b2) {
|
|
6348
6297
|
const params = is(a, "rgb") ? {
|
|
6349
6298
|
_a: a.r,
|
|
6350
6299
|
_b: a.g,
|
|
@@ -6387,7 +6336,7 @@
|
|
|
6387
6336
|
_c: 0,
|
|
6388
6337
|
space: "rgb"
|
|
6389
6338
|
};
|
|
6390
|
-
params.space =
|
|
6339
|
+
params.space = b2 || params.space;
|
|
6391
6340
|
return params;
|
|
6392
6341
|
}
|
|
6393
6342
|
function cieSpace(space) {
|
|
@@ -6429,40 +6378,40 @@
|
|
|
6429
6378
|
} = Math;
|
|
6430
6379
|
if (mode === "vibrant") {
|
|
6431
6380
|
const l = (81 - 57) * random() + 57;
|
|
6432
|
-
const
|
|
6433
|
-
const
|
|
6434
|
-
const color = new Color(l,
|
|
6381
|
+
const c2 = (83 - 45) * random() + 45;
|
|
6382
|
+
const h2 = 360 * random();
|
|
6383
|
+
const color = new Color(l, c2, h2, "lch");
|
|
6435
6384
|
return color;
|
|
6436
6385
|
} else if (mode === "sine") {
|
|
6437
6386
|
t = t == null ? random() : t;
|
|
6438
6387
|
const r = round2(80 * sin(2 * pi * t / 0.5 + 0.01) + 150);
|
|
6439
6388
|
const g = round2(50 * sin(2 * pi * t / 0.5 + 4.6) + 200);
|
|
6440
|
-
const
|
|
6441
|
-
const color = new Color(r, g,
|
|
6389
|
+
const b2 = round2(100 * sin(2 * pi * t / 0.5 + 2.3) + 150);
|
|
6390
|
+
const color = new Color(r, g, b2);
|
|
6442
6391
|
return color;
|
|
6443
6392
|
} else if (mode === "pastel") {
|
|
6444
6393
|
const l = (94 - 86) * random() + 86;
|
|
6445
|
-
const
|
|
6446
|
-
const
|
|
6447
|
-
const color = new Color(l,
|
|
6394
|
+
const c2 = (26 - 9) * random() + 9;
|
|
6395
|
+
const h2 = 360 * random();
|
|
6396
|
+
const color = new Color(l, c2, h2, "lch");
|
|
6448
6397
|
return color;
|
|
6449
6398
|
} else if (mode === "dark") {
|
|
6450
6399
|
const l = 10 + 10 * random();
|
|
6451
|
-
const
|
|
6452
|
-
const
|
|
6453
|
-
const color = new Color(l,
|
|
6400
|
+
const c2 = (125 - 75) * random() + 86;
|
|
6401
|
+
const h2 = 360 * random();
|
|
6402
|
+
const color = new Color(l, c2, h2, "lch");
|
|
6454
6403
|
return color;
|
|
6455
6404
|
} else if (mode === "rgb") {
|
|
6456
6405
|
const r = 255 * random();
|
|
6457
6406
|
const g = 255 * random();
|
|
6458
|
-
const
|
|
6459
|
-
const color = new Color(r, g,
|
|
6407
|
+
const b2 = 255 * random();
|
|
6408
|
+
const color = new Color(r, g, b2);
|
|
6460
6409
|
return color;
|
|
6461
6410
|
} else if (mode === "lab") {
|
|
6462
6411
|
const l = 100 * random();
|
|
6463
6412
|
const a = 256 * random() - 128;
|
|
6464
|
-
const
|
|
6465
|
-
const color = new Color(l, a,
|
|
6413
|
+
const b2 = 256 * random() - 128;
|
|
6414
|
+
const color = new Color(l, a, b2, "lab");
|
|
6466
6415
|
return color;
|
|
6467
6416
|
} else if (mode === "grey") {
|
|
6468
6417
|
const grey = 255 * random();
|
|
@@ -6482,15 +6431,15 @@
|
|
|
6482
6431
|
_b,
|
|
6483
6432
|
_c
|
|
6484
6433
|
} = this.rgb();
|
|
6485
|
-
const [r, g,
|
|
6486
|
-
const
|
|
6487
|
-
if (
|
|
6434
|
+
const [r, g, b2] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6435
|
+
const k2 = Math.min(1 - r, 1 - g, 1 - b2);
|
|
6436
|
+
if (k2 === 1) {
|
|
6488
6437
|
return new Color(0, 0, 0, 1, "cmyk");
|
|
6489
6438
|
}
|
|
6490
|
-
const
|
|
6491
|
-
const
|
|
6492
|
-
const y2 = (1 -
|
|
6493
|
-
const color = new Color(
|
|
6439
|
+
const c2 = (1 - r - k2) / (1 - k2);
|
|
6440
|
+
const m = (1 - g - k2) / (1 - k2);
|
|
6441
|
+
const y2 = (1 - b2 - k2) / (1 - k2);
|
|
6442
|
+
const color = new Color(c2, m, y2, k2, "cmyk");
|
|
6494
6443
|
return color;
|
|
6495
6444
|
}
|
|
6496
6445
|
hsl() {
|
|
@@ -6499,18 +6448,18 @@
|
|
|
6499
6448
|
_b,
|
|
6500
6449
|
_c
|
|
6501
6450
|
} = this.rgb();
|
|
6502
|
-
const [r, g,
|
|
6503
|
-
const max = Math.max(r, g,
|
|
6504
|
-
const min = Math.min(r, g,
|
|
6451
|
+
const [r, g, b2] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6452
|
+
const max = Math.max(r, g, b2);
|
|
6453
|
+
const min = Math.min(r, g, b2);
|
|
6505
6454
|
const l = (max + min) / 2;
|
|
6506
6455
|
const isGrey = max === min;
|
|
6507
6456
|
const delta = max - min;
|
|
6508
6457
|
const s = isGrey ? 0 : l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
|
|
6509
|
-
const
|
|
6510
|
-
const color = new Color(360 *
|
|
6458
|
+
const h2 = 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;
|
|
6459
|
+
const color = new Color(360 * h2, 100 * s, 100 * l, "hsl");
|
|
6511
6460
|
return color;
|
|
6512
6461
|
}
|
|
6513
|
-
init(a = 0,
|
|
6462
|
+
init(a = 0, b2 = 0, c2 = 0, d = 0, space = "rgb") {
|
|
6514
6463
|
a = !a ? 0 : a;
|
|
6515
6464
|
if (this.space) {
|
|
6516
6465
|
for (const component in this.space) {
|
|
@@ -6522,13 +6471,13 @@
|
|
|
6522
6471
|
d = typeof d === "string" ? 0 : d;
|
|
6523
6472
|
Object.assign(this, {
|
|
6524
6473
|
_a: a,
|
|
6525
|
-
_b:
|
|
6526
|
-
_c:
|
|
6474
|
+
_b: b2,
|
|
6475
|
+
_c: c2,
|
|
6527
6476
|
_d: d,
|
|
6528
6477
|
space
|
|
6529
6478
|
});
|
|
6530
6479
|
} else if (a instanceof Array) {
|
|
6531
|
-
this.space =
|
|
6480
|
+
this.space = b2 || (typeof a[3] === "string" ? a[3] : a[4]) || "rgb";
|
|
6532
6481
|
Object.assign(this, {
|
|
6533
6482
|
_a: a[0],
|
|
6534
6483
|
_b: a[1],
|
|
@@ -6536,7 +6485,7 @@
|
|
|
6536
6485
|
_d: a[3] || 0
|
|
6537
6486
|
});
|
|
6538
6487
|
} else if (a instanceof Object) {
|
|
6539
|
-
const values = getParameters(a,
|
|
6488
|
+
const values = getParameters(a, b2);
|
|
6540
6489
|
Object.assign(this, values);
|
|
6541
6490
|
} else if (typeof a === "string") {
|
|
6542
6491
|
if (isRgb.test(a)) {
|
|
@@ -6603,23 +6552,23 @@
|
|
|
6603
6552
|
} = this.xyz();
|
|
6604
6553
|
const l = 116 * y2 - 16;
|
|
6605
6554
|
const a = 500 * (x2 - y2);
|
|
6606
|
-
const
|
|
6607
|
-
const color = new Color(l, a,
|
|
6555
|
+
const b2 = 200 * (y2 - z);
|
|
6556
|
+
const color = new Color(l, a, b2, "lab");
|
|
6608
6557
|
return color;
|
|
6609
6558
|
}
|
|
6610
6559
|
lch() {
|
|
6611
6560
|
const {
|
|
6612
6561
|
l,
|
|
6613
6562
|
a,
|
|
6614
|
-
b
|
|
6563
|
+
b: b2
|
|
6615
6564
|
} = this.lab();
|
|
6616
|
-
const
|
|
6617
|
-
let
|
|
6618
|
-
if (
|
|
6619
|
-
|
|
6620
|
-
|
|
6565
|
+
const c2 = Math.sqrt(a ** 2 + b2 ** 2);
|
|
6566
|
+
let h2 = 180 * Math.atan2(b2, a) / Math.PI;
|
|
6567
|
+
if (h2 < 0) {
|
|
6568
|
+
h2 *= -1;
|
|
6569
|
+
h2 = 360 - h2;
|
|
6621
6570
|
}
|
|
6622
|
-
const color = new Color(l,
|
|
6571
|
+
const color = new Color(l, c2, h2, "lch");
|
|
6623
6572
|
return color;
|
|
6624
6573
|
}
|
|
6625
6574
|
/*
|
|
@@ -6638,20 +6587,20 @@
|
|
|
6638
6587
|
let {
|
|
6639
6588
|
l,
|
|
6640
6589
|
a,
|
|
6641
|
-
b:
|
|
6590
|
+
b: b3
|
|
6642
6591
|
} = this;
|
|
6643
6592
|
if (this.space === "lch") {
|
|
6644
6593
|
const {
|
|
6645
|
-
c,
|
|
6646
|
-
h
|
|
6594
|
+
c: c2,
|
|
6595
|
+
h: h2
|
|
6647
6596
|
} = this;
|
|
6648
6597
|
const dToR = Math.PI / 180;
|
|
6649
|
-
a =
|
|
6650
|
-
|
|
6598
|
+
a = c2 * Math.cos(dToR * h2);
|
|
6599
|
+
b3 = c2 * Math.sin(dToR * h2);
|
|
6651
6600
|
}
|
|
6652
6601
|
const yL = (l + 16) / 116;
|
|
6653
6602
|
const xL = a / 500 + yL;
|
|
6654
|
-
const zL = yL -
|
|
6603
|
+
const zL = yL - b3 / 200;
|
|
6655
6604
|
const ct = 16 / 116;
|
|
6656
6605
|
const mx = 8856e-6;
|
|
6657
6606
|
const nm = 7.787;
|
|
@@ -6666,16 +6615,16 @@
|
|
|
6666
6615
|
const bd = 31308e-7;
|
|
6667
6616
|
const r = rU > bd ? 1.055 * pow(rU, 1 / 2.4) - 0.055 : 12.92 * rU;
|
|
6668
6617
|
const g = gU > bd ? 1.055 * pow(gU, 1 / 2.4) - 0.055 : 12.92 * gU;
|
|
6669
|
-
const
|
|
6670
|
-
const color = new Color(255 * r, 255 * g, 255 *
|
|
6618
|
+
const b2 = bU > bd ? 1.055 * pow(bU, 1 / 2.4) - 0.055 : 12.92 * bU;
|
|
6619
|
+
const color = new Color(255 * r, 255 * g, 255 * b2);
|
|
6671
6620
|
return color;
|
|
6672
6621
|
} else if (this.space === "hsl") {
|
|
6673
6622
|
let {
|
|
6674
|
-
h,
|
|
6623
|
+
h: h2,
|
|
6675
6624
|
s,
|
|
6676
6625
|
l
|
|
6677
6626
|
} = this;
|
|
6678
|
-
|
|
6627
|
+
h2 /= 360;
|
|
6679
6628
|
s /= 100;
|
|
6680
6629
|
l /= 100;
|
|
6681
6630
|
if (s === 0) {
|
|
@@ -6685,22 +6634,22 @@
|
|
|
6685
6634
|
}
|
|
6686
6635
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
6687
6636
|
const p = 2 * l - q;
|
|
6688
|
-
const r = 255 * hueToRgb(p, q,
|
|
6689
|
-
const g = 255 * hueToRgb(p, q,
|
|
6690
|
-
const
|
|
6691
|
-
const color = new Color(r, g,
|
|
6637
|
+
const r = 255 * hueToRgb(p, q, h2 + 1 / 3);
|
|
6638
|
+
const g = 255 * hueToRgb(p, q, h2);
|
|
6639
|
+
const b2 = 255 * hueToRgb(p, q, h2 - 1 / 3);
|
|
6640
|
+
const color = new Color(r, g, b2);
|
|
6692
6641
|
return color;
|
|
6693
6642
|
} else if (this.space === "cmyk") {
|
|
6694
6643
|
const {
|
|
6695
|
-
c,
|
|
6696
|
-
m
|
|
6644
|
+
c: c2,
|
|
6645
|
+
m,
|
|
6697
6646
|
y: y2,
|
|
6698
|
-
k
|
|
6647
|
+
k: k2
|
|
6699
6648
|
} = this;
|
|
6700
|
-
const r = 255 * (1 - Math.min(1,
|
|
6701
|
-
const g = 255 * (1 - Math.min(1,
|
|
6702
|
-
const
|
|
6703
|
-
const color = new Color(r, g,
|
|
6649
|
+
const r = 255 * (1 - Math.min(1, c2 * (1 - k2) + k2));
|
|
6650
|
+
const g = 255 * (1 - Math.min(1, m * (1 - k2) + k2));
|
|
6651
|
+
const b2 = 255 * (1 - Math.min(1, y2 * (1 - k2) + k2));
|
|
6652
|
+
const color = new Color(r, g, b2);
|
|
6704
6653
|
return color;
|
|
6705
6654
|
} else {
|
|
6706
6655
|
return this;
|
|
@@ -6717,8 +6666,8 @@
|
|
|
6717
6666
|
return [_a, _b, _c, _d, space];
|
|
6718
6667
|
}
|
|
6719
6668
|
toHex() {
|
|
6720
|
-
const [r, g,
|
|
6721
|
-
return `#${r}${g}${
|
|
6669
|
+
const [r, g, b2] = this._clamped().map(componentHex);
|
|
6670
|
+
return `#${r}${g}${b2}`;
|
|
6722
6671
|
}
|
|
6723
6672
|
toRgb() {
|
|
6724
6673
|
const [rV, gV, bV] = this._clamped();
|
|
@@ -6734,10 +6683,10 @@
|
|
|
6734
6683
|
_b: g255,
|
|
6735
6684
|
_c: b255
|
|
6736
6685
|
} = this.rgb();
|
|
6737
|
-
const [r, g,
|
|
6686
|
+
const [r, g, b2] = [r255, g255, b255].map((v2) => v2 / 255);
|
|
6738
6687
|
const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
|
6739
6688
|
const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
|
6740
|
-
const bL =
|
|
6689
|
+
const bL = b2 > 0.04045 ? Math.pow((b2 + 0.055) / 1.055, 2.4) : b2 / 12.92;
|
|
6741
6690
|
const xU = (rL * 0.4124 + gL * 0.3576 + bL * 0.1805) / 0.95047;
|
|
6742
6691
|
const yU = (rL * 0.2126 + gL * 0.7152 + bL * 0.0722) / 1;
|
|
6743
6692
|
const zU = (rL * 0.0193 + gL * 0.1192 + bL * 0.9505) / 1.08883;
|
|
@@ -6799,28 +6748,28 @@
|
|
|
6799
6748
|
toArray() {
|
|
6800
6749
|
return [this.x, this.y];
|
|
6801
6750
|
}
|
|
6802
|
-
transform(
|
|
6803
|
-
return this.clone().transformO(
|
|
6751
|
+
transform(m) {
|
|
6752
|
+
return this.clone().transformO(m);
|
|
6804
6753
|
}
|
|
6805
6754
|
// Transform point with matrix
|
|
6806
|
-
transformO(
|
|
6807
|
-
if (!Matrix.isMatrixLike(
|
|
6808
|
-
|
|
6755
|
+
transformO(m) {
|
|
6756
|
+
if (!Matrix.isMatrixLike(m)) {
|
|
6757
|
+
m = new Matrix(m);
|
|
6809
6758
|
}
|
|
6810
6759
|
const {
|
|
6811
6760
|
x: x2,
|
|
6812
6761
|
y: y2
|
|
6813
6762
|
} = this;
|
|
6814
|
-
this.x =
|
|
6815
|
-
this.y =
|
|
6763
|
+
this.x = m.a * x2 + m.c * y2 + m.e;
|
|
6764
|
+
this.y = m.b * x2 + m.d * y2 + m.f;
|
|
6816
6765
|
return this;
|
|
6817
6766
|
}
|
|
6818
6767
|
}
|
|
6819
6768
|
function point(x2, y2) {
|
|
6820
6769
|
return new Point(x2, y2).transformO(this.screenCTM().inverseO());
|
|
6821
6770
|
}
|
|
6822
|
-
function closeEnough(a,
|
|
6823
|
-
return Math.abs(
|
|
6771
|
+
function closeEnough(a, b2, threshold) {
|
|
6772
|
+
return Math.abs(b2 - a) < 1e-6;
|
|
6824
6773
|
}
|
|
6825
6774
|
class Matrix {
|
|
6826
6775
|
constructor(...args) {
|
|
@@ -6881,14 +6830,14 @@
|
|
|
6881
6830
|
// left matrix, right matrix, target matrix which is overwritten
|
|
6882
6831
|
static matrixMultiply(l, r, o) {
|
|
6883
6832
|
const a = l.a * r.a + l.c * r.b;
|
|
6884
|
-
const
|
|
6885
|
-
const
|
|
6833
|
+
const b2 = l.b * r.a + l.d * r.b;
|
|
6834
|
+
const c2 = l.a * r.c + l.c * r.d;
|
|
6886
6835
|
const d = l.b * r.c + l.d * r.d;
|
|
6887
6836
|
const e = l.e + l.a * r.e + l.c * r.f;
|
|
6888
6837
|
const f = l.f + l.b * r.e + l.d * r.f;
|
|
6889
6838
|
o.a = a;
|
|
6890
|
-
o.b =
|
|
6891
|
-
o.c =
|
|
6839
|
+
o.b = b2;
|
|
6840
|
+
o.c = c2;
|
|
6892
6841
|
o.d = d;
|
|
6893
6842
|
o.e = e;
|
|
6894
6843
|
o.f = f;
|
|
@@ -6910,20 +6859,20 @@
|
|
|
6910
6859
|
// Decomposes this matrix into its affine parameters
|
|
6911
6860
|
decompose(cx2 = 0, cy2 = 0) {
|
|
6912
6861
|
const a = this.a;
|
|
6913
|
-
const
|
|
6914
|
-
const
|
|
6862
|
+
const b2 = this.b;
|
|
6863
|
+
const c2 = this.c;
|
|
6915
6864
|
const d = this.d;
|
|
6916
6865
|
const e = this.e;
|
|
6917
6866
|
const f = this.f;
|
|
6918
|
-
const determinant = a * d -
|
|
6867
|
+
const determinant = a * d - b2 * c2;
|
|
6919
6868
|
const ccw = determinant > 0 ? 1 : -1;
|
|
6920
|
-
const sx = ccw * Math.sqrt(a * a +
|
|
6921
|
-
const thetaRad = Math.atan2(ccw *
|
|
6869
|
+
const sx = ccw * Math.sqrt(a * a + b2 * b2);
|
|
6870
|
+
const thetaRad = Math.atan2(ccw * b2, ccw * a);
|
|
6922
6871
|
const theta = 180 / Math.PI * thetaRad;
|
|
6923
6872
|
const ct = Math.cos(thetaRad);
|
|
6924
6873
|
const st = Math.sin(thetaRad);
|
|
6925
|
-
const lam = (a *
|
|
6926
|
-
const sy =
|
|
6874
|
+
const lam = (a * c2 + b2 * d) / determinant;
|
|
6875
|
+
const sy = c2 * sx / (lam * a - b2) || d * sx / (lam * b2 + a);
|
|
6927
6876
|
const tx = e - cx2 + cx2 * ct * sx + cy2 * (lam * ct * sx - st * sy);
|
|
6928
6877
|
const ty = f - cy2 + cx2 * st * sx + cy2 * (lam * st * sx + ct * sy);
|
|
6929
6878
|
return {
|
|
@@ -6976,16 +6925,16 @@
|
|
|
6976
6925
|
// Inverses matrix
|
|
6977
6926
|
inverseO() {
|
|
6978
6927
|
const a = this.a;
|
|
6979
|
-
const
|
|
6980
|
-
const
|
|
6928
|
+
const b2 = this.b;
|
|
6929
|
+
const c2 = this.c;
|
|
6981
6930
|
const d = this.d;
|
|
6982
6931
|
const e = this.e;
|
|
6983
6932
|
const f = this.f;
|
|
6984
|
-
const det = a * d -
|
|
6933
|
+
const det = a * d - b2 * c2;
|
|
6985
6934
|
if (!det) throw new Error("Cannot invert " + this);
|
|
6986
6935
|
const na = d / det;
|
|
6987
|
-
const nb = -
|
|
6988
|
-
const nc = -
|
|
6936
|
+
const nb = -b2 / det;
|
|
6937
|
+
const nc = -c2 / det;
|
|
6989
6938
|
const nd = a / det;
|
|
6990
6939
|
const ne = -(na * e + nc * f);
|
|
6991
6940
|
const nf = -(nb * e + nd * f);
|
|
@@ -7024,16 +6973,16 @@
|
|
|
7024
6973
|
const sin = Math.sin(r);
|
|
7025
6974
|
const {
|
|
7026
6975
|
a,
|
|
7027
|
-
b,
|
|
7028
|
-
c,
|
|
6976
|
+
b: b2,
|
|
6977
|
+
c: c2,
|
|
7029
6978
|
d,
|
|
7030
6979
|
e,
|
|
7031
6980
|
f
|
|
7032
6981
|
} = this;
|
|
7033
|
-
this.a = a * cos -
|
|
7034
|
-
this.b =
|
|
7035
|
-
this.c =
|
|
7036
|
-
this.d = d * cos +
|
|
6982
|
+
this.a = a * cos - b2 * sin;
|
|
6983
|
+
this.b = b2 * cos + a * sin;
|
|
6984
|
+
this.c = c2 * cos - d * sin;
|
|
6985
|
+
this.d = d * cos + c2 * sin;
|
|
7037
6986
|
this.e = e * cos - f * sin + cy2 * sin - cx2 * cos + cx2;
|
|
7038
6987
|
this.f = f * cos + e * sin - cx2 * sin - cy2 * cos + cy2;
|
|
7039
6988
|
return this;
|
|
@@ -7050,15 +6999,15 @@
|
|
|
7050
6999
|
}
|
|
7051
7000
|
const {
|
|
7052
7001
|
a,
|
|
7053
|
-
b,
|
|
7054
|
-
c,
|
|
7002
|
+
b: b2,
|
|
7003
|
+
c: c2,
|
|
7055
7004
|
d,
|
|
7056
7005
|
e,
|
|
7057
7006
|
f
|
|
7058
7007
|
} = this;
|
|
7059
7008
|
this.a = a * x2;
|
|
7060
|
-
this.b =
|
|
7061
|
-
this.c =
|
|
7009
|
+
this.b = b2 * y2;
|
|
7010
|
+
this.c = c2 * x2;
|
|
7062
7011
|
this.d = d * y2;
|
|
7063
7012
|
this.e = e * x2 - cx2 * x2 + cx2;
|
|
7064
7013
|
this.f = f * y2 - cy2 * y2 + cy2;
|
|
@@ -7071,14 +7020,14 @@
|
|
|
7071
7020
|
shearO(lx, cx2 = 0, cy2 = 0) {
|
|
7072
7021
|
const {
|
|
7073
7022
|
a,
|
|
7074
|
-
b,
|
|
7075
|
-
c,
|
|
7023
|
+
b: b2,
|
|
7024
|
+
c: c2,
|
|
7076
7025
|
d,
|
|
7077
7026
|
e,
|
|
7078
7027
|
f
|
|
7079
7028
|
} = this;
|
|
7080
|
-
this.a = a +
|
|
7081
|
-
this.c =
|
|
7029
|
+
this.a = a + b2 * lx;
|
|
7030
|
+
this.c = c2 + d * lx;
|
|
7082
7031
|
this.e = e + f * lx - cy2 * lx;
|
|
7083
7032
|
return this;
|
|
7084
7033
|
}
|
|
@@ -7098,16 +7047,16 @@
|
|
|
7098
7047
|
const ly = Math.tan(y2);
|
|
7099
7048
|
const {
|
|
7100
7049
|
a,
|
|
7101
|
-
b,
|
|
7102
|
-
c,
|
|
7050
|
+
b: b2,
|
|
7051
|
+
c: c2,
|
|
7103
7052
|
d,
|
|
7104
7053
|
e,
|
|
7105
7054
|
f
|
|
7106
7055
|
} = this;
|
|
7107
|
-
this.a = a +
|
|
7108
|
-
this.b =
|
|
7109
|
-
this.c =
|
|
7110
|
-
this.d = d +
|
|
7056
|
+
this.a = a + b2 * lx;
|
|
7057
|
+
this.b = b2 + a * ly;
|
|
7058
|
+
this.c = c2 + d * lx;
|
|
7059
|
+
this.d = d + c2 * ly;
|
|
7111
7060
|
this.e = e + f * lx - cy2 * lx;
|
|
7112
7061
|
this.f = f + e * ly - cx2 * ly;
|
|
7113
7062
|
return this;
|
|
@@ -7175,9 +7124,9 @@
|
|
|
7175
7124
|
function screenCTM() {
|
|
7176
7125
|
if (typeof this.isRoot === "function" && !this.isRoot()) {
|
|
7177
7126
|
const rect = this.rect(1, 1);
|
|
7178
|
-
const
|
|
7127
|
+
const m = rect.node.getScreenCTM();
|
|
7179
7128
|
rect.remove();
|
|
7180
|
-
return new Matrix(
|
|
7129
|
+
return new Matrix(m);
|
|
7181
7130
|
}
|
|
7182
7131
|
return new Matrix(this.node.getScreenCTM());
|
|
7183
7132
|
}
|
|
@@ -7195,8 +7144,8 @@
|
|
|
7195
7144
|
};
|
|
7196
7145
|
}
|
|
7197
7146
|
if (!parser.nodes.svg.node.parentNode) {
|
|
7198
|
-
const
|
|
7199
|
-
parser.nodes.svg.addTo(
|
|
7147
|
+
const b2 = globals.document.body || globals.document.documentElement;
|
|
7148
|
+
parser.nodes.svg.addTo(b2);
|
|
7200
7149
|
}
|
|
7201
7150
|
return parser.nodes;
|
|
7202
7151
|
}
|
|
@@ -7250,9 +7199,9 @@
|
|
|
7250
7199
|
toString() {
|
|
7251
7200
|
return this.x + " " + this.y + " " + this.width + " " + this.height;
|
|
7252
7201
|
}
|
|
7253
|
-
transform(
|
|
7254
|
-
if (!(
|
|
7255
|
-
|
|
7202
|
+
transform(m) {
|
|
7203
|
+
if (!(m instanceof Matrix)) {
|
|
7204
|
+
m = new Matrix(m);
|
|
7256
7205
|
}
|
|
7257
7206
|
let xMin = Infinity;
|
|
7258
7207
|
let xMax = -Infinity;
|
|
@@ -7260,7 +7209,7 @@
|
|
|
7260
7209
|
let yMax = -Infinity;
|
|
7261
7210
|
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)];
|
|
7262
7211
|
pts.forEach(function(p) {
|
|
7263
|
-
p = p.transform(
|
|
7212
|
+
p = p.transform(m);
|
|
7264
7213
|
xMin = Math.min(xMin, p.x);
|
|
7265
7214
|
xMax = Math.max(xMax, p.x);
|
|
7266
7215
|
yMin = Math.min(yMin, p.y);
|
|
@@ -8027,8 +7976,8 @@
|
|
|
8027
7976
|
reference(attr2) {
|
|
8028
7977
|
attr2 = this.attr(attr2);
|
|
8029
7978
|
if (!attr2) return null;
|
|
8030
|
-
const
|
|
8031
|
-
return
|
|
7979
|
+
const m = (attr2 + "").match(reference);
|
|
7980
|
+
return m ? makeInstance(m[1]) : null;
|
|
8032
7981
|
}
|
|
8033
7982
|
// Get parent document
|
|
8034
7983
|
root() {
|
|
@@ -8082,19 +8031,19 @@
|
|
|
8082
8031
|
return a === "color" ? t : t + "-" + a;
|
|
8083
8032
|
}
|
|
8084
8033
|
};
|
|
8085
|
-
["fill", "stroke"].forEach(function(
|
|
8034
|
+
["fill", "stroke"].forEach(function(m) {
|
|
8086
8035
|
const extension = {};
|
|
8087
8036
|
let i;
|
|
8088
|
-
extension[
|
|
8037
|
+
extension[m] = function(o) {
|
|
8089
8038
|
if (typeof o === "undefined") {
|
|
8090
|
-
return this.attr(
|
|
8039
|
+
return this.attr(m);
|
|
8091
8040
|
}
|
|
8092
8041
|
if (typeof o === "string" || o instanceof Color || Color.isRgb(o) || o instanceof Element) {
|
|
8093
|
-
this.attr(
|
|
8042
|
+
this.attr(m, o);
|
|
8094
8043
|
} else {
|
|
8095
|
-
for (i = sugar[
|
|
8096
|
-
if (o[sugar[
|
|
8097
|
-
this.attr(sugar.prefix(
|
|
8044
|
+
for (i = sugar[m].length - 1; i >= 0; i--) {
|
|
8045
|
+
if (o[sugar[m][i]] != null) {
|
|
8046
|
+
this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]);
|
|
8098
8047
|
}
|
|
8099
8048
|
}
|
|
8100
8049
|
}
|
|
@@ -8104,11 +8053,11 @@
|
|
|
8104
8053
|
});
|
|
8105
8054
|
registerMethods(["Element", "Runner"], {
|
|
8106
8055
|
// Let the user set the matrix directly
|
|
8107
|
-
matrix: function(mat,
|
|
8056
|
+
matrix: function(mat, b2, c2, d, e, f) {
|
|
8108
8057
|
if (mat == null) {
|
|
8109
8058
|
return new Matrix(this);
|
|
8110
8059
|
}
|
|
8111
|
-
return this.attr("transform", new Matrix(mat,
|
|
8060
|
+
return this.attr("transform", new Matrix(mat, b2, c2, d, e, f));
|
|
8112
8061
|
},
|
|
8113
8062
|
// Map rotation to transform
|
|
8114
8063
|
rotate: function(angle, cx2, cy2) {
|
|
@@ -8399,9 +8348,9 @@
|
|
|
8399
8348
|
super(nodeOrNew(type + "Gradient", typeof type === "string" ? null : type), attrs2);
|
|
8400
8349
|
}
|
|
8401
8350
|
// custom attr to handle transform
|
|
8402
|
-
attr(a,
|
|
8351
|
+
attr(a, b2, c2) {
|
|
8403
8352
|
if (a === "transform") a = "gradientTransform";
|
|
8404
|
-
return super.attr(a,
|
|
8353
|
+
return super.attr(a, b2, c2);
|
|
8405
8354
|
}
|
|
8406
8355
|
bbox() {
|
|
8407
8356
|
return new Box();
|
|
@@ -8448,9 +8397,9 @@
|
|
|
8448
8397
|
super(nodeOrNew("pattern", node), attrs2);
|
|
8449
8398
|
}
|
|
8450
8399
|
// custom attr to handle transform
|
|
8451
|
-
attr(a,
|
|
8400
|
+
attr(a, b2, c2) {
|
|
8452
8401
|
if (a === "transform") a = "patternTransform";
|
|
8453
|
-
return super.attr(a,
|
|
8402
|
+
return super.attr(a, b2, c2);
|
|
8454
8403
|
}
|
|
8455
8404
|
bbox() {
|
|
8456
8405
|
return new Box();
|
|
@@ -8613,18 +8562,18 @@
|
|
|
8613
8562
|
}
|
|
8614
8563
|
return array2.join(" ");
|
|
8615
8564
|
}
|
|
8616
|
-
transform(
|
|
8617
|
-
return this.clone().transformO(
|
|
8565
|
+
transform(m) {
|
|
8566
|
+
return this.clone().transformO(m);
|
|
8618
8567
|
}
|
|
8619
8568
|
// transform points with matrix (similar to Point.transform)
|
|
8620
|
-
transformO(
|
|
8621
|
-
if (!Matrix.isMatrixLike(
|
|
8622
|
-
|
|
8569
|
+
transformO(m) {
|
|
8570
|
+
if (!Matrix.isMatrixLike(m)) {
|
|
8571
|
+
m = new Matrix(m);
|
|
8623
8572
|
}
|
|
8624
8573
|
for (let i = this.length; i--; ) {
|
|
8625
8574
|
const [x2, y2] = this[i];
|
|
8626
|
-
this[i][0] =
|
|
8627
|
-
this[i][1] =
|
|
8575
|
+
this[i][0] = m.a * x2 + m.c * y2 + m.e;
|
|
8576
|
+
this[i][1] = m.b * x2 + m.d * y2 + m.f;
|
|
8628
8577
|
}
|
|
8629
8578
|
return this;
|
|
8630
8579
|
}
|
|
@@ -8637,12 +8586,12 @@
|
|
|
8637
8586
|
return y2 == null ? this.bbox().y : this.move(this.bbox().x, y2);
|
|
8638
8587
|
}
|
|
8639
8588
|
function width$1(width2) {
|
|
8640
|
-
const
|
|
8641
|
-
return width2 == null ?
|
|
8589
|
+
const b2 = this.bbox();
|
|
8590
|
+
return width2 == null ? b2.width : this.size(width2, b2.height);
|
|
8642
8591
|
}
|
|
8643
8592
|
function height$1(height2) {
|
|
8644
|
-
const
|
|
8645
|
-
return height2 == null ?
|
|
8593
|
+
const b2 = this.bbox();
|
|
8594
|
+
return height2 == null ? b2.height : this.size(b2.width, height2);
|
|
8646
8595
|
}
|
|
8647
8596
|
var pointed = {
|
|
8648
8597
|
__proto__: null,
|
|
@@ -8754,10 +8703,10 @@
|
|
|
8754
8703
|
}
|
|
8755
8704
|
});
|
|
8756
8705
|
register(Marker, "Marker");
|
|
8757
|
-
function makeSetterGetter(
|
|
8706
|
+
function makeSetterGetter(k2, f) {
|
|
8758
8707
|
return function(v2) {
|
|
8759
|
-
if (v2 == null) return this[
|
|
8760
|
-
this[
|
|
8708
|
+
if (v2 == null) return this[k2];
|
|
8709
|
+
this[k2] = v2;
|
|
8761
8710
|
if (f) f.call(this);
|
|
8762
8711
|
return this;
|
|
8763
8712
|
};
|
|
@@ -8848,11 +8797,11 @@
|
|
|
8848
8797
|
super();
|
|
8849
8798
|
this.stepper = fn;
|
|
8850
8799
|
}
|
|
8851
|
-
done(
|
|
8852
|
-
return
|
|
8800
|
+
done(c2) {
|
|
8801
|
+
return c2.done;
|
|
8853
8802
|
}
|
|
8854
|
-
step(current, target, dt,
|
|
8855
|
-
return this.stepper(current, target, dt,
|
|
8803
|
+
step(current, target, dt, c2) {
|
|
8804
|
+
return this.stepper(current, target, dt, c2);
|
|
8856
8805
|
}
|
|
8857
8806
|
}
|
|
8858
8807
|
function recalculate() {
|
|
@@ -8871,19 +8820,19 @@
|
|
|
8871
8820
|
super();
|
|
8872
8821
|
this.duration(duration).overshoot(overshoot);
|
|
8873
8822
|
}
|
|
8874
|
-
step(current, target, dt,
|
|
8823
|
+
step(current, target, dt, c2) {
|
|
8875
8824
|
if (typeof current === "string") return current;
|
|
8876
|
-
|
|
8825
|
+
c2.done = dt === Infinity;
|
|
8877
8826
|
if (dt === Infinity) return target;
|
|
8878
8827
|
if (dt === 0) return current;
|
|
8879
8828
|
if (dt > 100) dt = 16;
|
|
8880
8829
|
dt /= 1e3;
|
|
8881
|
-
const velocity =
|
|
8830
|
+
const velocity = c2.velocity || 0;
|
|
8882
8831
|
const acceleration = -this.d * velocity - this.k * (current - target);
|
|
8883
8832
|
const newPosition = current + velocity * dt + acceleration * dt * dt / 2;
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
return
|
|
8833
|
+
c2.velocity = velocity + acceleration * dt;
|
|
8834
|
+
c2.done = Math.abs(target - newPosition) + Math.abs(velocity) < 2e-3;
|
|
8835
|
+
return c2.done ? target : newPosition;
|
|
8887
8836
|
}
|
|
8888
8837
|
}
|
|
8889
8838
|
extend(Spring, {
|
|
@@ -8895,22 +8844,22 @@
|
|
|
8895
8844
|
super();
|
|
8896
8845
|
this.p(p).i(i).d(d).windup(windup);
|
|
8897
8846
|
}
|
|
8898
|
-
step(current, target, dt,
|
|
8847
|
+
step(current, target, dt, c2) {
|
|
8899
8848
|
if (typeof current === "string") return current;
|
|
8900
|
-
|
|
8849
|
+
c2.done = dt === Infinity;
|
|
8901
8850
|
if (dt === Infinity) return target;
|
|
8902
8851
|
if (dt === 0) return current;
|
|
8903
8852
|
const p = target - current;
|
|
8904
|
-
let i = (
|
|
8905
|
-
const d = (p - (
|
|
8853
|
+
let i = (c2.integral || 0) + p * dt;
|
|
8854
|
+
const d = (p - (c2.error || 0)) / dt;
|
|
8906
8855
|
const windup = this._windup;
|
|
8907
8856
|
if (windup !== false) {
|
|
8908
8857
|
i = Math.max(-windup, Math.min(i, windup));
|
|
8909
8858
|
}
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
return
|
|
8859
|
+
c2.error = p;
|
|
8860
|
+
c2.integral = i;
|
|
8861
|
+
c2.done = Math.abs(p) < 1e-3;
|
|
8862
|
+
return c2.done ? target : current + (this.P * p + this.I * i + this.D * d);
|
|
8914
8863
|
}
|
|
8915
8864
|
}
|
|
8916
8865
|
extend(PID, {
|
|
@@ -8932,70 +8881,70 @@
|
|
|
8932
8881
|
Z: 0
|
|
8933
8882
|
};
|
|
8934
8883
|
const pathHandlers = {
|
|
8935
|
-
M: function(
|
|
8936
|
-
p.x = p0.x =
|
|
8937
|
-
p.y = p0.y =
|
|
8884
|
+
M: function(c2, p, p0) {
|
|
8885
|
+
p.x = p0.x = c2[0];
|
|
8886
|
+
p.y = p0.y = c2[1];
|
|
8938
8887
|
return ["M", p.x, p.y];
|
|
8939
8888
|
},
|
|
8940
|
-
L: function(
|
|
8941
|
-
p.x =
|
|
8942
|
-
p.y =
|
|
8943
|
-
return ["L",
|
|
8889
|
+
L: function(c2, p) {
|
|
8890
|
+
p.x = c2[0];
|
|
8891
|
+
p.y = c2[1];
|
|
8892
|
+
return ["L", c2[0], c2[1]];
|
|
8944
8893
|
},
|
|
8945
|
-
H: function(
|
|
8946
|
-
p.x =
|
|
8947
|
-
return ["H",
|
|
8894
|
+
H: function(c2, p) {
|
|
8895
|
+
p.x = c2[0];
|
|
8896
|
+
return ["H", c2[0]];
|
|
8948
8897
|
},
|
|
8949
|
-
V: function(
|
|
8950
|
-
p.y =
|
|
8951
|
-
return ["V",
|
|
8898
|
+
V: function(c2, p) {
|
|
8899
|
+
p.y = c2[0];
|
|
8900
|
+
return ["V", c2[0]];
|
|
8952
8901
|
},
|
|
8953
|
-
C: function(
|
|
8954
|
-
p.x =
|
|
8955
|
-
p.y =
|
|
8956
|
-
return ["C",
|
|
8902
|
+
C: function(c2, p) {
|
|
8903
|
+
p.x = c2[4];
|
|
8904
|
+
p.y = c2[5];
|
|
8905
|
+
return ["C", c2[0], c2[1], c2[2], c2[3], c2[4], c2[5]];
|
|
8957
8906
|
},
|
|
8958
|
-
S: function(
|
|
8959
|
-
p.x =
|
|
8960
|
-
p.y =
|
|
8961
|
-
return ["S",
|
|
8907
|
+
S: function(c2, p) {
|
|
8908
|
+
p.x = c2[2];
|
|
8909
|
+
p.y = c2[3];
|
|
8910
|
+
return ["S", c2[0], c2[1], c2[2], c2[3]];
|
|
8962
8911
|
},
|
|
8963
|
-
Q: function(
|
|
8964
|
-
p.x =
|
|
8965
|
-
p.y =
|
|
8966
|
-
return ["Q",
|
|
8912
|
+
Q: function(c2, p) {
|
|
8913
|
+
p.x = c2[2];
|
|
8914
|
+
p.y = c2[3];
|
|
8915
|
+
return ["Q", c2[0], c2[1], c2[2], c2[3]];
|
|
8967
8916
|
},
|
|
8968
|
-
T: function(
|
|
8969
|
-
p.x =
|
|
8970
|
-
p.y =
|
|
8971
|
-
return ["T",
|
|
8917
|
+
T: function(c2, p) {
|
|
8918
|
+
p.x = c2[0];
|
|
8919
|
+
p.y = c2[1];
|
|
8920
|
+
return ["T", c2[0], c2[1]];
|
|
8972
8921
|
},
|
|
8973
|
-
Z: function(
|
|
8922
|
+
Z: function(c2, p, p0) {
|
|
8974
8923
|
p.x = p0.x;
|
|
8975
8924
|
p.y = p0.y;
|
|
8976
8925
|
return ["Z"];
|
|
8977
8926
|
},
|
|
8978
|
-
A: function(
|
|
8979
|
-
p.x =
|
|
8980
|
-
p.y =
|
|
8981
|
-
return ["A",
|
|
8927
|
+
A: function(c2, p) {
|
|
8928
|
+
p.x = c2[5];
|
|
8929
|
+
p.y = c2[6];
|
|
8930
|
+
return ["A", c2[0], c2[1], c2[2], c2[3], c2[4], c2[5], c2[6]];
|
|
8982
8931
|
}
|
|
8983
8932
|
};
|
|
8984
8933
|
const mlhvqtcsaz = "mlhvqtcsaz".split("");
|
|
8985
8934
|
for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {
|
|
8986
8935
|
pathHandlers[mlhvqtcsaz[i]] = /* @__PURE__ */ function(i2) {
|
|
8987
|
-
return function(
|
|
8988
|
-
if (i2 === "H")
|
|
8989
|
-
else if (i2 === "V")
|
|
8936
|
+
return function(c2, p, p0) {
|
|
8937
|
+
if (i2 === "H") c2[0] = c2[0] + p.x;
|
|
8938
|
+
else if (i2 === "V") c2[0] = c2[0] + p.y;
|
|
8990
8939
|
else if (i2 === "A") {
|
|
8991
|
-
|
|
8992
|
-
|
|
8940
|
+
c2[5] = c2[5] + p.x;
|
|
8941
|
+
c2[6] = c2[6] + p.y;
|
|
8993
8942
|
} else {
|
|
8994
|
-
for (let j = 0, jl =
|
|
8995
|
-
|
|
8943
|
+
for (let j = 0, jl = c2.length; j < jl; ++j) {
|
|
8944
|
+
c2[j] = c2[j] + (j % 2 ? p.y : p.x);
|
|
8996
8945
|
}
|
|
8997
8946
|
}
|
|
8998
|
-
return pathHandlers[i2](
|
|
8947
|
+
return pathHandlers[i2](c2, p, p0);
|
|
8999
8948
|
};
|
|
9000
8949
|
}(mlhvqtcsaz[i].toUpperCase());
|
|
9001
8950
|
}
|
|
@@ -9384,8 +9333,8 @@
|
|
|
9384
9333
|
originX: 0,
|
|
9385
9334
|
originY: 0
|
|
9386
9335
|
};
|
|
9387
|
-
const sortByKey = (a,
|
|
9388
|
-
return a[0] <
|
|
9336
|
+
const sortByKey = (a, b2) => {
|
|
9337
|
+
return a[0] < b2[0] ? -1 : a[0] > b2[0] ? 1 : 0;
|
|
9389
9338
|
};
|
|
9390
9339
|
class ObjectBag {
|
|
9391
9340
|
constructor(...args) {
|
|
@@ -9831,7 +9780,7 @@
|
|
|
9831
9780
|
};
|
|
9832
9781
|
this._lastRunnerId = runner.id;
|
|
9833
9782
|
this._runners.push(runnerInfo);
|
|
9834
|
-
this._runners.sort((a,
|
|
9783
|
+
this._runners.sort((a, b2) => a.start - b2.start);
|
|
9835
9784
|
this._runnerIds = this._runners.map((info) => info.runner.id);
|
|
9836
9785
|
this.updateTime()._continue();
|
|
9837
9786
|
return this;
|
|
@@ -9895,8 +9844,8 @@
|
|
|
9895
9844
|
}
|
|
9896
9845
|
this._lastStepTime = this._time;
|
|
9897
9846
|
this.fire("time", this._time);
|
|
9898
|
-
for (let
|
|
9899
|
-
const runnerInfo = this._runners[
|
|
9847
|
+
for (let k2 = this._runners.length; k2--; ) {
|
|
9848
|
+
const runnerInfo = this._runners[k2];
|
|
9900
9849
|
const runner = runnerInfo.runner;
|
|
9901
9850
|
const dtToStart = this._time - runnerInfo.start;
|
|
9902
9851
|
if (dtToStart <= 0) {
|
|
@@ -10393,7 +10342,7 @@
|
|
|
10393
10342
|
}
|
|
10394
10343
|
}
|
|
10395
10344
|
});
|
|
10396
|
-
const difference = (a,
|
|
10345
|
+
const difference = (a, b2) => a.filter((x2) => !b2.includes(x2));
|
|
10397
10346
|
extend(Runner, {
|
|
10398
10347
|
attr(a, v2) {
|
|
10399
10348
|
return this.styleAttr("attr", a, v2);
|
|
@@ -10628,9 +10577,9 @@
|
|
|
10628
10577
|
return this._queueNumber("height", height2);
|
|
10629
10578
|
},
|
|
10630
10579
|
// Add animatable plot
|
|
10631
|
-
plot(a,
|
|
10580
|
+
plot(a, b2, c2, d) {
|
|
10632
10581
|
if (arguments.length === 4) {
|
|
10633
|
-
return this.plot([a,
|
|
10582
|
+
return this.plot([a, b2, c2, d]);
|
|
10634
10583
|
}
|
|
10635
10584
|
if (this._tryRetarget("plot", a)) return this;
|
|
10636
10585
|
const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a);
|
|
@@ -11041,8 +10990,8 @@
|
|
|
11041
10990
|
} catch (e) {
|
|
11042
10991
|
return;
|
|
11043
10992
|
}
|
|
11044
|
-
const
|
|
11045
|
-
const matrix =
|
|
10993
|
+
const m = new Matrix(child);
|
|
10994
|
+
const matrix = m.translate(dx2, dy2).transform(m.inverse());
|
|
11046
10995
|
const p = new Point(bbox2.x, bbox2.y).transform(matrix);
|
|
11047
10996
|
child.move(p.x, p.y);
|
|
11048
10997
|
});
|
|
@@ -11395,7 +11344,7 @@
|
|
|
11395
11344
|
case "rect": {
|
|
11396
11345
|
let {
|
|
11397
11346
|
width: w,
|
|
11398
|
-
height:
|
|
11347
|
+
height: h2,
|
|
11399
11348
|
rx: rx2,
|
|
11400
11349
|
ry: ry2,
|
|
11401
11350
|
x: x2,
|
|
@@ -11406,17 +11355,17 @@
|
|
|
11406
11355
|
rx2 = rx2 || ry2;
|
|
11407
11356
|
ry2 = ry2 || rx2;
|
|
11408
11357
|
if (rx2 > w / 2) rx2 = w / 2;
|
|
11409
|
-
if (ry2 >
|
|
11358
|
+
if (ry2 > h2 / 2) ry2 = h2 / 2;
|
|
11410
11359
|
if (rx2 && ry2) {
|
|
11411
11360
|
d = [
|
|
11412
11361
|
["M", rx2 + x2, y2],
|
|
11413
11362
|
["h", w - 2 * rx2],
|
|
11414
11363
|
["a", rx2, ry2, 0, 0, 1, rx2, ry2],
|
|
11415
|
-
["v",
|
|
11364
|
+
["v", h2 - 2 * ry2],
|
|
11416
11365
|
["a", rx2, ry2, 0, 0, 1, -rx2, ry2],
|
|
11417
11366
|
["h", -w + 2 * rx2],
|
|
11418
11367
|
["a", rx2, ry2, 0, 0, 1, -rx2, -ry2],
|
|
11419
|
-
["v", -
|
|
11368
|
+
["v", -h2 + 2 * ry2],
|
|
11420
11369
|
["a", rx2, ry2, 0, 0, 1, rx2, -ry2],
|
|
11421
11370
|
["z"]
|
|
11422
11371
|
];
|
|
@@ -11424,9 +11373,9 @@
|
|
|
11424
11373
|
d = [
|
|
11425
11374
|
["M", x2, y2],
|
|
11426
11375
|
["h", w],
|
|
11427
|
-
["v",
|
|
11376
|
+
["v", h2],
|
|
11428
11377
|
["h", -w],
|
|
11429
|
-
["v", -
|
|
11378
|
+
["v", -h2],
|
|
11430
11379
|
["z"]
|
|
11431
11380
|
];
|
|
11432
11381
|
}
|
|
@@ -11669,7 +11618,7 @@
|
|
|
11669
11618
|
}
|
|
11670
11619
|
}
|
|
11671
11620
|
if (img) {
|
|
11672
|
-
const patternAndImages = svg2.defs().children().filter((
|
|
11621
|
+
const patternAndImages = svg2.defs().children().filter((c2) => c2 instanceof Pattern && c2.children().length === 1).map((c2) => [c2, c2.children()[0]]);
|
|
11673
11622
|
patternAndImages.forEach(([pattern, image]) => {
|
|
11674
11623
|
pattern.x(0);
|
|
11675
11624
|
pattern.y(0);
|
|
@@ -11754,8 +11703,8 @@
|
|
|
11754
11703
|
super(options);
|
|
11755
11704
|
}
|
|
11756
11705
|
async draw(svg2, viewmap) {
|
|
11757
|
-
const chains = viewmap.chains.filter((
|
|
11758
|
-
const meshes = Array.from(viewmap.meshes).filter((
|
|
11706
|
+
const chains = viewmap.chains.filter((c2) => c2.visibility === ChainVisibility.Visible);
|
|
11707
|
+
const meshes = Array.from(viewmap.meshes).filter((m) => m.drawVisibleContours);
|
|
11759
11708
|
const group = new G({ id: "visible-contours" });
|
|
11760
11709
|
drawChains(group, meshes, chains, this.options);
|
|
11761
11710
|
svg2.add(group);
|
|
@@ -11776,9 +11725,9 @@
|
|
|
11776
11725
|
}
|
|
11777
11726
|
async draw(svg2, viewmap) {
|
|
11778
11727
|
const chains = viewmap.chains.filter(
|
|
11779
|
-
(
|
|
11728
|
+
(c2) => c2.visibility === ChainVisibility.Hidden
|
|
11780
11729
|
);
|
|
11781
|
-
const meshes = Array.from(viewmap.meshes).filter((
|
|
11730
|
+
const meshes = Array.from(viewmap.meshes).filter((m) => m.drawHiddenContours);
|
|
11782
11731
|
const group = new G({ id: "hidden-contours" });
|
|
11783
11732
|
svg2.add(group);
|
|
11784
11733
|
drawChains(group, meshes, chains, this.options);
|
|
@@ -11791,13 +11740,13 @@
|
|
|
11791
11740
|
(n1, n2) => (styles[n1].drawOrder ?? 0) - (styles[n2].drawOrder ?? 0)
|
|
11792
11741
|
);
|
|
11793
11742
|
for (const mesh of meshes) {
|
|
11794
|
-
const objectChains = chains.filter((
|
|
11743
|
+
const objectChains = chains.filter((c2) => c2.object === mesh);
|
|
11795
11744
|
const objectGroup = new G({ id: mesh.name });
|
|
11796
11745
|
parent.add(objectGroup);
|
|
11797
11746
|
for (const nature of ViewEdgesNatures) {
|
|
11798
11747
|
if ((_a = styles[nature]) == null ? void 0 : _a.enabled) {
|
|
11799
11748
|
const strokeStyle = { ...defaultStyle, ...styles[nature] };
|
|
11800
|
-
const natureChains = objectChains.filter((
|
|
11749
|
+
const natureChains = objectChains.filter((c2) => c2.nature === nature);
|
|
11801
11750
|
const natureGroup = new G({ id: nature });
|
|
11802
11751
|
objectGroup.add(natureGroup);
|
|
11803
11752
|
for (const chain of natureChains) {
|
|
@@ -11844,19 +11793,19 @@
|
|
|
11844
11793
|
}
|
|
11845
11794
|
const EPSILON = 1e-10;
|
|
11846
11795
|
const _matrix = new three.Matrix4();
|
|
11847
|
-
function orient3D(a,
|
|
11796
|
+
function orient3D(a, b2, c2, d) {
|
|
11848
11797
|
_matrix.set(
|
|
11849
11798
|
a.x,
|
|
11850
11799
|
a.y,
|
|
11851
11800
|
a.z,
|
|
11852
11801
|
1,
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11802
|
+
b2.x,
|
|
11803
|
+
b2.y,
|
|
11804
|
+
b2.z,
|
|
11856
11805
|
1,
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11806
|
+
c2.x,
|
|
11807
|
+
c2.y,
|
|
11808
|
+
c2.z,
|
|
11860
11809
|
1,
|
|
11861
11810
|
d.x,
|
|
11862
11811
|
d.y,
|
|
@@ -11866,13 +11815,13 @@
|
|
|
11866
11815
|
const det = _matrix.determinant();
|
|
11867
11816
|
if (det > EPSILON) {
|
|
11868
11817
|
return 1;
|
|
11869
|
-
} else if (det < -
|
|
11818
|
+
} else if (det < -EPSILON) {
|
|
11870
11819
|
return -1;
|
|
11871
11820
|
}
|
|
11872
11821
|
return 0;
|
|
11873
11822
|
}
|
|
11874
|
-
function frontSide(a,
|
|
11875
|
-
return orient3D(d,
|
|
11823
|
+
function frontSide(a, b2, c2, d) {
|
|
11824
|
+
return orient3D(d, b2, c2, a);
|
|
11876
11825
|
}
|
|
11877
11826
|
const _u$1 = new three.Vector3();
|
|
11878
11827
|
const _v = new three.Vector3();
|
|
@@ -12125,15 +12074,15 @@
|
|
|
12125
12074
|
if (!g) {
|
|
12126
12075
|
return false;
|
|
12127
12076
|
}
|
|
12128
|
-
const
|
|
12077
|
+
const b2 = halfIn.next;
|
|
12129
12078
|
const d = halfOut.prev;
|
|
12130
|
-
const
|
|
12079
|
+
const h2 = g.next;
|
|
12131
12080
|
halfIn.next = halfOut;
|
|
12132
12081
|
halfOut.prev = halfIn;
|
|
12133
|
-
g.next =
|
|
12134
|
-
|
|
12135
|
-
d.next =
|
|
12136
|
-
|
|
12082
|
+
g.next = b2;
|
|
12083
|
+
b2.prev = g;
|
|
12084
|
+
d.next = h2;
|
|
12085
|
+
h2.prev = d;
|
|
12137
12086
|
return true;
|
|
12138
12087
|
}
|
|
12139
12088
|
const _u = new three.Vector3();
|
|
@@ -12403,10 +12352,10 @@
|
|
|
12403
12352
|
}
|
|
12404
12353
|
let found = false;
|
|
12405
12354
|
const loop = h1.nextLoop();
|
|
12406
|
-
let
|
|
12407
|
-
while (!found && !
|
|
12408
|
-
found =
|
|
12409
|
-
|
|
12355
|
+
let h3 = loop.next();
|
|
12356
|
+
while (!found && !h3.done) {
|
|
12357
|
+
found = h3.value === h2;
|
|
12358
|
+
h3 = loop.next();
|
|
12410
12359
|
}
|
|
12411
12360
|
if (!found) {
|
|
12412
12361
|
face.halfedge = h1;
|
|
@@ -12415,8 +12364,8 @@
|
|
|
12415
12364
|
newFace = new Face(h2);
|
|
12416
12365
|
struct.faces.push(newFace);
|
|
12417
12366
|
}
|
|
12418
|
-
for (const
|
|
12419
|
-
|
|
12367
|
+
for (const h32 of h2.nextLoop()) {
|
|
12368
|
+
h32.face = newFace;
|
|
12420
12369
|
}
|
|
12421
12370
|
}
|
|
12422
12371
|
return h1;
|
|
@@ -12424,22 +12373,22 @@
|
|
|
12424
12373
|
function splitEdge(struct, halfedge, position2, tolerance = 1e-10) {
|
|
12425
12374
|
const twin = halfedge.twin;
|
|
12426
12375
|
const A2 = halfedge.vertex;
|
|
12427
|
-
const
|
|
12376
|
+
const B2 = twin.vertex;
|
|
12428
12377
|
if (A2.matchesPosition(position2, tolerance)) {
|
|
12429
12378
|
return A2;
|
|
12430
12379
|
}
|
|
12431
|
-
if (
|
|
12432
|
-
return
|
|
12380
|
+
if (B2.matchesPosition(position2, tolerance)) {
|
|
12381
|
+
return B2;
|
|
12433
12382
|
}
|
|
12434
12383
|
const newVertex = new Vertex();
|
|
12435
12384
|
newVertex.position.copy(position2);
|
|
12436
12385
|
const newHalfedge = new Halfedge(newVertex);
|
|
12437
|
-
const newTwin = new Halfedge(
|
|
12386
|
+
const newTwin = new Halfedge(B2);
|
|
12438
12387
|
newHalfedge.twin = newTwin;
|
|
12439
12388
|
newTwin.twin = newHalfedge;
|
|
12440
12389
|
A2.halfedge = halfedge;
|
|
12441
12390
|
newVertex.halfedge = newHalfedge;
|
|
12442
|
-
|
|
12391
|
+
B2.halfedge = newTwin;
|
|
12443
12392
|
newHalfedge.face = halfedge.face;
|
|
12444
12393
|
newTwin.face = twin.face;
|
|
12445
12394
|
newHalfedge.next = halfedge.next;
|
|
@@ -12742,7 +12691,7 @@
|
|
|
12742
12691
|
rangeBoundaries.add(Math.max(drawRangeStart, groupStart));
|
|
12743
12692
|
rangeBoundaries.add(Math.min(drawRangeEnd, groupEnd));
|
|
12744
12693
|
}
|
|
12745
|
-
const sortedBoundaries = Array.from(rangeBoundaries.values()).sort((a,
|
|
12694
|
+
const sortedBoundaries = Array.from(rangeBoundaries.values()).sort((a, b2) => a - b2);
|
|
12746
12695
|
for (let i = 0; i < sortedBoundaries.length - 1; i++) {
|
|
12747
12696
|
const start = sortedBoundaries[i];
|
|
12748
12697
|
const end = sortedBoundaries[i + 1];
|
|
@@ -12758,7 +12707,7 @@
|
|
|
12758
12707
|
return false;
|
|
12759
12708
|
}
|
|
12760
12709
|
const vertexCount = getTriCount(geometry);
|
|
12761
|
-
const groups = getRootIndexRanges(geometry).sort((a,
|
|
12710
|
+
const groups = getRootIndexRanges(geometry).sort((a, b2) => a.offset - b2.offset);
|
|
12762
12711
|
const finalGroup = groups[groups.length - 1];
|
|
12763
12712
|
finalGroup.count = Math.min(vertexCount - finalGroup.offset, finalGroup.count);
|
|
12764
12713
|
let total = 0;
|
|
@@ -12856,22 +12805,22 @@
|
|
|
12856
12805
|
ci = ci * stride + bufferOffset;
|
|
12857
12806
|
}
|
|
12858
12807
|
for (let el = 0; el < 3; el++) {
|
|
12859
|
-
let a,
|
|
12808
|
+
let a, b2, c2;
|
|
12860
12809
|
if (normalized) {
|
|
12861
12810
|
a = posAttr[getters[el]](ai);
|
|
12862
|
-
|
|
12863
|
-
|
|
12811
|
+
b2 = posAttr[getters[el]](bi);
|
|
12812
|
+
c2 = posAttr[getters[el]](ci);
|
|
12864
12813
|
} else {
|
|
12865
12814
|
a = posArr[ai + el];
|
|
12866
|
-
|
|
12867
|
-
|
|
12815
|
+
b2 = posArr[bi + el];
|
|
12816
|
+
c2 = posArr[ci + el];
|
|
12868
12817
|
}
|
|
12869
12818
|
let min = a;
|
|
12870
|
-
if (
|
|
12871
|
-
if (
|
|
12819
|
+
if (b2 < min) min = b2;
|
|
12820
|
+
if (c2 < min) min = c2;
|
|
12872
12821
|
let max = a;
|
|
12873
|
-
if (
|
|
12874
|
-
if (
|
|
12822
|
+
if (b2 > max) max = b2;
|
|
12823
|
+
if (c2 > max) max = c2;
|
|
12875
12824
|
const halfExtents = (max - min) / 2;
|
|
12876
12825
|
const el2 = el * 2;
|
|
12877
12826
|
triangleBounds[tri6 + el2 + 0] = min + halfExtents;
|
|
@@ -12904,15 +12853,15 @@
|
|
|
12904
12853
|
function copyBounds(source, target) {
|
|
12905
12854
|
target.set(source);
|
|
12906
12855
|
}
|
|
12907
|
-
function unionBounds(a,
|
|
12856
|
+
function unionBounds(a, b2, target) {
|
|
12908
12857
|
let aVal, bVal;
|
|
12909
12858
|
for (let d = 0; d < 3; d++) {
|
|
12910
12859
|
const d3 = d + 3;
|
|
12911
12860
|
aVal = a[d];
|
|
12912
|
-
bVal =
|
|
12861
|
+
bVal = b2[d];
|
|
12913
12862
|
target[d] = aVal < bVal ? aVal : bVal;
|
|
12914
12863
|
aVal = a[d3];
|
|
12915
|
-
bVal =
|
|
12864
|
+
bVal = b2[d3];
|
|
12916
12865
|
target[d3] = aVal > bVal ? aVal : bVal;
|
|
12917
12866
|
}
|
|
12918
12867
|
}
|
|
@@ -12937,7 +12886,7 @@
|
|
|
12937
12886
|
return 2 * (d0 * d1 + d1 * d2 + d2 * d0);
|
|
12938
12887
|
}
|
|
12939
12888
|
const BIN_COUNT = 32;
|
|
12940
|
-
const binsSort = (a,
|
|
12889
|
+
const binsSort = (a, b2) => a.candidate - b2.candidate;
|
|
12941
12890
|
const sahBins = new Array(BIN_COUNT).fill().map(() => {
|
|
12942
12891
|
return {
|
|
12943
12892
|
count: 0,
|
|
@@ -12974,10 +12923,10 @@
|
|
|
12974
12923
|
if (count < BIN_COUNT / 4) {
|
|
12975
12924
|
const truncatedBins = [...sahBins];
|
|
12976
12925
|
truncatedBins.length = count;
|
|
12977
|
-
let
|
|
12978
|
-
for (let
|
|
12979
|
-
const bin = truncatedBins[
|
|
12980
|
-
bin.candidate = triangleBounds[
|
|
12926
|
+
let b2 = 0;
|
|
12927
|
+
for (let c2 = cStart; c2 < cEnd; c2 += 6, b2++) {
|
|
12928
|
+
const bin = truncatedBins[b2];
|
|
12929
|
+
bin.candidate = triangleBounds[c2 + 2 * a];
|
|
12981
12930
|
bin.count = 0;
|
|
12982
12931
|
const {
|
|
12983
12932
|
bounds,
|
|
@@ -12992,7 +12941,7 @@
|
|
|
12992
12941
|
bounds[d] = Infinity;
|
|
12993
12942
|
bounds[d + 3] = -Infinity;
|
|
12994
12943
|
}
|
|
12995
|
-
expandByTriangleBounds(
|
|
12944
|
+
expandByTriangleBounds(c2, triangleBounds, bounds);
|
|
12996
12945
|
}
|
|
12997
12946
|
truncatedBins.sort(binsSort);
|
|
12998
12947
|
let splitCount = count;
|
|
@@ -13003,14 +12952,14 @@
|
|
|
13003
12952
|
splitCount--;
|
|
13004
12953
|
}
|
|
13005
12954
|
}
|
|
13006
|
-
for (let
|
|
13007
|
-
const center2 = triangleBounds[
|
|
12955
|
+
for (let c2 = cStart; c2 < cEnd; c2 += 6) {
|
|
12956
|
+
const center2 = triangleBounds[c2 + 2 * a];
|
|
13008
12957
|
for (let bi = 0; bi < splitCount; bi++) {
|
|
13009
12958
|
const bin = truncatedBins[bi];
|
|
13010
12959
|
if (center2 >= bin.candidate) {
|
|
13011
|
-
expandByTriangleBounds(
|
|
12960
|
+
expandByTriangleBounds(c2, triangleBounds, bin.rightCacheBounds);
|
|
13012
12961
|
} else {
|
|
13013
|
-
expandByTriangleBounds(
|
|
12962
|
+
expandByTriangleBounds(c2, triangleBounds, bin.leftCacheBounds);
|
|
13014
12963
|
bin.count++;
|
|
13015
12964
|
}
|
|
13016
12965
|
}
|
|
@@ -13047,14 +12996,14 @@
|
|
|
13047
12996
|
bounds[d + 3] = -Infinity;
|
|
13048
12997
|
}
|
|
13049
12998
|
}
|
|
13050
|
-
for (let
|
|
13051
|
-
const triCenter = triangleBounds[
|
|
12999
|
+
for (let c2 = cStart; c2 < cEnd; c2 += 6) {
|
|
13000
|
+
const triCenter = triangleBounds[c2 + 2 * a];
|
|
13052
13001
|
const relativeCenter = triCenter - axisLeft;
|
|
13053
13002
|
let binIndex = ~~(relativeCenter / binWidth);
|
|
13054
13003
|
if (binIndex >= BIN_COUNT) binIndex = BIN_COUNT - 1;
|
|
13055
13004
|
const bin = sahBins[binIndex];
|
|
13056
13005
|
bin.count++;
|
|
13057
|
-
expandByTriangleBounds(
|
|
13006
|
+
expandByTriangleBounds(c2, triangleBounds, bin.bounds);
|
|
13058
13007
|
}
|
|
13059
13008
|
const lastBin = sahBins[BIN_COUNT - 1];
|
|
13060
13009
|
copyBounds(lastBin.bounds, lastBin.rightCacheBounds);
|
|
@@ -13503,17 +13452,17 @@
|
|
|
13503
13452
|
const lineTemp = new threepipe.Line3();
|
|
13504
13453
|
return function sphereIntersectTriangle2(sphere, triangle3) {
|
|
13505
13454
|
const { radius, center: center2 } = sphere;
|
|
13506
|
-
const { a, b, c } = triangle3;
|
|
13455
|
+
const { a, b: b2, c: c2 } = triangle3;
|
|
13507
13456
|
lineTemp.start = a;
|
|
13508
|
-
lineTemp.end =
|
|
13457
|
+
lineTemp.end = b2;
|
|
13509
13458
|
const closestPoint1 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13510
13459
|
if (closestPoint1.distanceTo(center2) <= radius) return true;
|
|
13511
13460
|
lineTemp.start = a;
|
|
13512
|
-
lineTemp.end =
|
|
13461
|
+
lineTemp.end = c2;
|
|
13513
13462
|
const closestPoint2 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13514
13463
|
if (closestPoint2.distanceTo(center2) <= radius) return true;
|
|
13515
|
-
lineTemp.start =
|
|
13516
|
-
lineTemp.end =
|
|
13464
|
+
lineTemp.start = b2;
|
|
13465
|
+
lineTemp.end = c2;
|
|
13517
13466
|
const closestPoint3 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13518
13467
|
if (closestPoint3.distanceTo(center2) <= radius) return true;
|
|
13519
13468
|
const plane = triangle3.getPlane(planeTemp);
|
|
@@ -13546,8 +13495,8 @@
|
|
|
13546
13495
|
}
|
|
13547
13496
|
update() {
|
|
13548
13497
|
const a = this.a;
|
|
13549
|
-
const
|
|
13550
|
-
const
|
|
13498
|
+
const b2 = this.b;
|
|
13499
|
+
const c2 = this.c;
|
|
13551
13500
|
const points = this.points;
|
|
13552
13501
|
const satAxes = this.satAxes;
|
|
13553
13502
|
const satBounds = this.satBounds;
|
|
@@ -13557,15 +13506,15 @@
|
|
|
13557
13506
|
sab0.setFromPoints(axis0, points);
|
|
13558
13507
|
const axis1 = satAxes[1];
|
|
13559
13508
|
const sab1 = satBounds[1];
|
|
13560
|
-
axis1.subVectors(a,
|
|
13509
|
+
axis1.subVectors(a, b2);
|
|
13561
13510
|
sab1.setFromPoints(axis1, points);
|
|
13562
13511
|
const axis2 = satAxes[2];
|
|
13563
13512
|
const sab2 = satBounds[2];
|
|
13564
|
-
axis2.subVectors(
|
|
13513
|
+
axis2.subVectors(b2, c2);
|
|
13565
13514
|
sab2.setFromPoints(axis2, points);
|
|
13566
13515
|
const axis3 = satAxes[3];
|
|
13567
13516
|
const sab3 = satBounds[3];
|
|
13568
|
-
axis3.subVectors(
|
|
13517
|
+
axis3.subVectors(c2, a);
|
|
13569
13518
|
sab3.setFromPoints(axis3, points);
|
|
13570
13519
|
this.sphere.setFromPoints(this.points);
|
|
13571
13520
|
this.plane.setFromNormalAndCoplanarPoint(axis0, a);
|
|
@@ -14329,28 +14278,28 @@
|
|
|
14329
14278
|
point: point2.clone()
|
|
14330
14279
|
};
|
|
14331
14280
|
}
|
|
14332
|
-
function checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a,
|
|
14281
|
+
function checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b2, c2, side) {
|
|
14333
14282
|
_vA.fromBufferAttribute(position2, a);
|
|
14334
|
-
_vB.fromBufferAttribute(position2,
|
|
14335
|
-
_vC.fromBufferAttribute(position2,
|
|
14283
|
+
_vB.fromBufferAttribute(position2, b2);
|
|
14284
|
+
_vC.fromBufferAttribute(position2, c2);
|
|
14336
14285
|
const intersection = checkIntersection(ray2, _vA, _vB, _vC, _intersectionPoint, side);
|
|
14337
14286
|
if (intersection) {
|
|
14338
14287
|
if (uv) {
|
|
14339
14288
|
_uvA.fromBufferAttribute(uv, a);
|
|
14340
|
-
_uvB.fromBufferAttribute(uv,
|
|
14341
|
-
_uvC.fromBufferAttribute(uv,
|
|
14289
|
+
_uvB.fromBufferAttribute(uv, b2);
|
|
14290
|
+
_uvC.fromBufferAttribute(uv, c2);
|
|
14342
14291
|
intersection.uv = threepipe.Triangle.getInterpolation(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new threepipe.Vector2());
|
|
14343
14292
|
}
|
|
14344
14293
|
if (uv1) {
|
|
14345
14294
|
_uvA.fromBufferAttribute(uv1, a);
|
|
14346
|
-
_uvB.fromBufferAttribute(uv1,
|
|
14347
|
-
_uvC.fromBufferAttribute(uv1,
|
|
14295
|
+
_uvB.fromBufferAttribute(uv1, b2);
|
|
14296
|
+
_uvC.fromBufferAttribute(uv1, c2);
|
|
14348
14297
|
intersection.uv1 = threepipe.Triangle.getInterpolation(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new threepipe.Vector2());
|
|
14349
14298
|
}
|
|
14350
14299
|
if (normal) {
|
|
14351
14300
|
_normalA.fromBufferAttribute(normal, a);
|
|
14352
|
-
_normalB.fromBufferAttribute(normal,
|
|
14353
|
-
_normalC.fromBufferAttribute(normal,
|
|
14301
|
+
_normalB.fromBufferAttribute(normal, b2);
|
|
14302
|
+
_normalC.fromBufferAttribute(normal, c2);
|
|
14354
14303
|
intersection.normal = threepipe.Triangle.getInterpolation(_intersectionPoint, _vA, _vB, _vC, _normalA, _normalB, _normalC, new threepipe.Vector3());
|
|
14355
14304
|
if (intersection.normal.dot(ray2.direction) > 0) {
|
|
14356
14305
|
intersection.normal.multiplyScalar(-1);
|
|
@@ -14358,8 +14307,8 @@
|
|
|
14358
14307
|
}
|
|
14359
14308
|
const face = {
|
|
14360
14309
|
a,
|
|
14361
|
-
b,
|
|
14362
|
-
c,
|
|
14310
|
+
b: b2,
|
|
14311
|
+
c: c2,
|
|
14363
14312
|
normal: new threepipe.Vector3(),
|
|
14364
14313
|
materialIndex: 0
|
|
14365
14314
|
};
|
|
@@ -14372,16 +14321,16 @@
|
|
|
14372
14321
|
function intersectTri(geo, side, ray2, tri, intersections) {
|
|
14373
14322
|
const triOffset = tri * 3;
|
|
14374
14323
|
let a = triOffset + 0;
|
|
14375
|
-
let
|
|
14376
|
-
let
|
|
14324
|
+
let b2 = triOffset + 1;
|
|
14325
|
+
let c2 = triOffset + 2;
|
|
14377
14326
|
const index = geo.index;
|
|
14378
14327
|
if (geo.index) {
|
|
14379
14328
|
a = index.getX(a);
|
|
14380
|
-
|
|
14381
|
-
|
|
14329
|
+
b2 = index.getX(b2);
|
|
14330
|
+
c2 = index.getX(c2);
|
|
14382
14331
|
}
|
|
14383
14332
|
const { position: position2, normal, uv, uv1 } = geo.attributes;
|
|
14384
|
-
const intersection = checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a,
|
|
14333
|
+
const intersection = checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b2, c2, side);
|
|
14385
14334
|
if (intersection) {
|
|
14386
14335
|
intersection.faceIndex = tri;
|
|
14387
14336
|
if (intersections) intersections.push(intersection);
|
|
@@ -16149,7 +16098,7 @@
|
|
|
16149
16098
|
this._meshes = /* @__PURE__ */ new Map();
|
|
16150
16099
|
this._rendering = false;
|
|
16151
16100
|
this._viewerListeners = {
|
|
16152
|
-
postRender: (
|
|
16101
|
+
postRender: (_2) => {
|
|
16153
16102
|
if (this.autoRender) this.render();
|
|
16154
16103
|
}
|
|
16155
16104
|
};
|