@mlightcad/geometry-engine 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/geometry-engine.js
CHANGED
|
@@ -5886,28 +5886,29 @@ class q {
|
|
|
5886
5886
|
}
|
|
5887
5887
|
}
|
|
5888
5888
|
class Kt extends et {
|
|
5889
|
-
constructor(t, s, e, n) {
|
|
5889
|
+
constructor(t, s, e, n, i) {
|
|
5890
5890
|
super();
|
|
5891
|
-
const
|
|
5892
|
-
if (
|
|
5891
|
+
const h = arguments.length;
|
|
5892
|
+
if (h < 2 || h > 5)
|
|
5893
5893
|
throw L.ILLEGAL_PARAMETERS;
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5894
|
+
if (this._degree = 3, this._closed = !1, Array.isArray(s)) {
|
|
5895
|
+
this._controlPoints = t;
|
|
5896
|
+
let r, a = 3, o = !1;
|
|
5897
|
+
if (h >= 3 && (Array.isArray(e) ? (r = e, h >= 4 && (a = n || 3), h >= 5 && (o = i)) : e !== void 0 && (a = e || 3, h >= 4 && (o = n))), e === void 0 && h >= 4 && (a = n || 3, h >= 5 && (o = i)), this._degree = a, this._closed = o, this._controlPoints.length < this._degree + 1)
|
|
5897
5898
|
throw L.ILLEGAL_PARAMETERS;
|
|
5898
5899
|
this._nurbsCurve = q.byKnotsControlPointsWeights(
|
|
5899
|
-
|
|
5900
|
+
this._degree,
|
|
5900
5901
|
s,
|
|
5901
5902
|
this._controlPoints,
|
|
5902
|
-
|
|
5903
|
+
r
|
|
5903
5904
|
);
|
|
5904
5905
|
} else {
|
|
5905
|
-
if (this._fitPoints = t, this._knotParameterization = s,
|
|
5906
|
+
if (this._fitPoints = t, this._knotParameterization = s, h >= 3 && (this._degree = e || 3), h >= 4 && (this._closed = n), this._fitPoints.length < this._degree + 1)
|
|
5906
5907
|
throw L.ILLEGAL_PARAMETERS;
|
|
5907
5908
|
const r = this.toNurbsPoints(this._fitPoints);
|
|
5908
5909
|
this._nurbsCurve = q.byPoints(
|
|
5909
5910
|
r,
|
|
5910
|
-
|
|
5911
|
+
this._degree,
|
|
5911
5912
|
this._knotParameterization
|
|
5912
5913
|
), this._controlPoints = this._nurbsCurve.controlPoints();
|
|
5913
5914
|
}
|
|
@@ -5921,33 +5922,33 @@ class Kt extends et {
|
|
|
5921
5922
|
if (this._closed)
|
|
5922
5923
|
this._nurbsCurve = q.createClosedCurve(
|
|
5923
5924
|
this._fitPoints,
|
|
5924
|
-
|
|
5925
|
+
this._degree,
|
|
5925
5926
|
this._knotParameterization
|
|
5926
5927
|
);
|
|
5927
5928
|
else {
|
|
5928
|
-
const
|
|
5929
|
+
const t = this.toNurbsPoints(this._fitPoints);
|
|
5929
5930
|
this._nurbsCurve = q.byPoints(
|
|
5930
|
-
|
|
5931
|
-
|
|
5931
|
+
t,
|
|
5932
|
+
this._degree,
|
|
5932
5933
|
this._knotParameterization
|
|
5933
5934
|
);
|
|
5934
5935
|
}
|
|
5935
5936
|
this._controlPoints = this._nurbsCurve.controlPoints();
|
|
5936
5937
|
} else if (this._controlPoints)
|
|
5937
5938
|
if (this._closed) {
|
|
5938
|
-
const
|
|
5939
|
+
const t = this._knotParameterization || "Chord";
|
|
5939
5940
|
this._nurbsCurve = q.createClosedCurve(
|
|
5940
5941
|
this._controlPoints,
|
|
5941
|
-
|
|
5942
|
-
|
|
5942
|
+
this._degree,
|
|
5943
|
+
t
|
|
5943
5944
|
), this._controlPoints = this._nurbsCurve.controlPoints();
|
|
5944
5945
|
} else {
|
|
5945
|
-
const
|
|
5946
|
+
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.weights();
|
|
5946
5947
|
this._nurbsCurve = q.byKnotsControlPointsWeights(
|
|
5947
|
-
|
|
5948
|
-
|
|
5948
|
+
this._degree,
|
|
5949
|
+
t,
|
|
5949
5950
|
this._controlPoints,
|
|
5950
|
-
|
|
5951
|
+
s
|
|
5951
5952
|
);
|
|
5952
5953
|
}
|
|
5953
5954
|
}
|
|
@@ -5961,7 +5962,7 @@ class Kt extends et {
|
|
|
5961
5962
|
* Degree of the spline to be created.
|
|
5962
5963
|
*/
|
|
5963
5964
|
get degree() {
|
|
5964
|
-
return this.
|
|
5965
|
+
return this._degree;
|
|
5965
5966
|
}
|
|
5966
5967
|
get knotParameterization() {
|
|
5967
5968
|
return this._knotParameterization;
|
|
@@ -6066,12 +6067,13 @@ class Kt extends et {
|
|
|
6066
6067
|
* Create a closed spline from fit points using AcGeNurbsCurve.createClosedCurve
|
|
6067
6068
|
* @param fitPoints - Array of fit points defining the curve
|
|
6068
6069
|
* @param parameterization - Knot parameterization type for NURBS
|
|
6070
|
+
* @param degree - Optional degree of the spline (default: 3)
|
|
6069
6071
|
* @returns A closed spline
|
|
6070
6072
|
*/
|
|
6071
|
-
static createClosedSpline(t, s = "Uniform") {
|
|
6072
|
-
if (t.length <
|
|
6073
|
-
throw new Error(
|
|
6074
|
-
return new Kt(t, s, !0);
|
|
6073
|
+
static createClosedSpline(t, s = "Uniform", e = 3) {
|
|
6074
|
+
if (t.length < e + 1)
|
|
6075
|
+
throw new Error(`At least ${e + 1} points are required for a degree ${e} closed spline`);
|
|
6076
|
+
return new Kt(t, s, e, !0);
|
|
6075
6077
|
}
|
|
6076
6078
|
}
|
|
6077
6079
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(x,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],N):(x=typeof globalThis<"u"?globalThis:x||self,N(x["geometry-engine"]={},x.common))})(this,function(x,N){"use strict";const R=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Dt=1234567;const wt=Math.PI/180,Pt=180/Math.PI;function Yt(){const u=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,e=Math.random()*4294967295|0;return(R[u&255]+R[u>>8&255]+R[u>>16&255]+R[u>>24&255]+"-"+R[t&255]+R[t>>8&255]+"-"+R[t>>16&15|64]+R[t>>24&255]+"-"+R[s&63|128]+R[s>>8&255]+"-"+R[s>>16&255]+R[s>>24&255]+R[e&255]+R[e>>8&255]+R[e>>16&255]+R[e>>24&255]).toLowerCase()}function F(u,t,s){return Math.max(t,Math.min(s,u))}function bt(u,t){return(u%t+t)%t}function Zt(u,t,s,e,n){return e+(u-t)*(n-e)/(s-t)}function Ot(u,t,s){return u!==t?(s-u)/(t-u):0}function Ct(u,t,s){return(1-s)*u+s*t}function Qt(u,t,s,e){return Ct(u,t,1-Math.exp(-s*e))}function Kt(u,t=1){return t-Math.abs(bt(u,t*2)-t)}function Ht(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*(3-2*u))}function $t(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*u*(u*(u*6-15)+10))}function Wt(u,t){return u+Math.floor(Math.random()*(t-u+1))}function vt(u,t){return u+Math.random()*(t-u)}function Jt(u){return u*(.5-Math.random())}function ts(u){u!==void 0&&(Dt=u);let t=Dt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function ss(u){return u*wt}function es(u){return u*Pt}function ns(u){return(u&u-1)===0&&u!==0}function is(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function rs(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function J(u){const t=Math.PI*2;return(u%t+t)%t}function hs(u,t,s){return u>t&&u<s||u>s&&u<t}function os(u,t,s,e=!1){return u=J(u),t=J(t),s=J(s),e?t>s?u<=t&&u>=s:u<=t||u>=s:t<s?u>=t&&u<=s:u>=t||u<=s}function St(u){return u=Math.abs(u),u<1?0:Math.ceil(Math.log10(Math.abs(u)+1))}function as(u,t=1e-7){const s=St(u);return Math.max(Math.pow(10,s)*t,t)}const B={DEG2RAD:wt,RAD2DEG:Pt,generateUUID:Yt,clamp:F,euclideanModulo:bt,mapLinear:Zt,inverseLerp:Ot,lerp:Ct,damp:Qt,pingpong:Kt,smoothstep:Ht,smootherstep:$t,randInt:Wt,randFloat:vt,randFloatSpread:Jt,seededRandom:ts,degToRad:ss,radToDeg:es,isPowerOfTwo:ns,ceilPowerOfTwo:is,floorPowerOfTwo:rs,normalizeAngle:J,isBetween:hs,isBetweenAngle:os,intPartLength:St,relativeEps:as},ot=class ot{constructor(t,s){this.x=0,this.y=0;const e=+(t!==void 0)+ +(s!==void 0);if(e!==0){if(e===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(e===1){const{x:n,y:i}=t;this.x=n,this.y=i;return}if(e===2){this.x=t,this.y=s;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new ot(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const s=this.x,e=this.y,n=t.elements;return this.x=n[0]*s+n[3]*e+n[6],this.y=n[1]*s+n[4]*e+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y;return s*s+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}rotateAround(t,s){const e=Math.cos(s),n=Math.sin(s),i=this.x-t.x,h=this.y-t.y;return this.x=i*e-h*n+t.x,this.y=i*n+h*e+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(B.relativeEps(this.x,t),B.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};ot.EMPTY=Object.freeze(new ot(0,0));let C=ot;const at=class at{constructor(t,s,e,n,i,h,r,a,o){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&h!=null&&r!=null&&a!=null&&o!=null&&this.set(t,s,e,n,i,h,r,a,o)}set(t,s,e,n,i,h,r,a,o){const c=this.elements;return c[0]=t,c[1]=n,c[2]=r,c[3]=s,c[4]=i,c[5]=a,c[6]=e,c[7]=h,c[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],this}extractBasis(t,s,e){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,h=e[0],r=e[3],a=e[6],o=e[1],c=e[4],l=e[7],d=e[2],m=e[5],y=e[8],g=n[0],p=n[3],A=n[6],b=n[1],P=n[4],w=n[7],M=n[2],E=n[5],z=n[8];return i[0]=h*g+r*b+a*M,i[3]=h*p+r*P+a*E,i[6]=h*A+r*w+a*z,i[1]=o*g+c*b+l*M,i[4]=o*p+c*P+l*E,i[7]=o*A+c*w+l*z,i[2]=d*g+m*b+y*M,i[5]=d*p+m*P+y*E,i[8]=d*A+m*w+y*z,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],h=t[4],r=t[5],a=t[6],o=t[7],c=t[8];return s*h*c-s*r*o-e*i*c+e*r*a+n*i*o-n*h*a}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],h=t[4],r=t[5],a=t[6],o=t[7],c=t[8],l=c*h-r*o,d=r*a-c*i,m=o*i-h*a,y=s*l+e*d+n*m;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/y;return t[0]=l*g,t[1]=(n*o-c*e)*g,t[2]=(r*e-n*h)*g,t[3]=d*g,t[4]=(c*s-n*a)*g,t[5]=(n*i-r*s)*g,t[6]=m*g,t[7]=(e*a-o*s)*g,t[8]=(h*s-e*i)*g,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t.elements[0]=s[0],t.elements[1]=s[3],t.elements[2]=s[6],t.elements[3]=s[1],t.elements[4]=s[4],t.elements[5]=s[7],t.elements[6]=s[2],t.elements[7]=s[5],t.elements[8]=s[8],this}setUvTransform(t,s,e,n,i,h,r){const a=Math.cos(i),o=Math.sin(i);return this.set(e*a,e*o,-e*(a*h+o*r)+h+t,-n*o,n*a,-n*(-o*h+a*r)+r+s,0,0,1),this}scale(t,s){return this.premultiply(Bt.makeScale(t,s)),this}rotate(t){return this.premultiply(Bt.makeRotation(-t)),this}translate(t,s){return this.premultiply(Bt.makeTranslation(t,s)),this}makeTranslation(t,s){return t instanceof C?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,e,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<9;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<9;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t}clone(){return new at().fromArray(this.elements)}};at.IDENTITY=Object.freeze(new at);let O=at;const Bt=new O,D=1e-6,I=2*Math.PI,ws={x:0,y:0},Et={x:0,y:0,z:0};class It{constructor(){this.equalPointTol=D,this.equalVectorTol=D}equalPoint2d(t,s){return new C(t).sub(s).length()<this.equalPointTol}equalPoint3d(t,s){return new _(t).sub(s).length()<this.equalPointTol}static equalToZero(t,s=D){return t<s&&t>-s}static equal(t,s,e=D){return Math.abs(t-s)<e}static great(t,s,e=D){return t-s>e}static less(t,s,e=D){return t-s<e}}const Rt=new It;function Tt(u,t,s=!1){const e=u.x,n=u.y;let i=!1;const h=t.length;for(let r=0,a=h-1;r<h;a=r++){const o=t[r].x,c=t[r].y,l=t[a].x,d=t[a].y;let m=c>n!=d>n;s&&(m=c>=n!=d>=n),m&&e<(l-o)*(n-c)/(d-c)+o&&(i=!i)}return i}function cs(u,t){if(u.length===0||t.length===0)return!1;const s=new U().setFromPoints(u),e=new U().setFromPoints(t);if(!s.intersectsBox(e))return!1;for(let n=0;n<u.length;){if(Tt(u[n],t,!0))return!0;n<u.length-1&&Rt.equalPoint2d(u[n+1],u[n])&&++n,++n}return!1}const ls={isPointInPolygon:Tt,isPolygonIntersect:cs};function us(u,t){const s=[],e=t-1,n=u;for(let i=0;i<=n;i++)s.push(0);for(let i=1;i<=e-n;i++)s.push(i);for(let i=0;i<=n;i++)s.push(e-n+1);return s}function ds(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let r=1;r<=s;r++){const a=t[r][0]-t[r-1][0],o=t[r][1]-t[r-1][1],c=t[r][2]-t[r-1][2],l=Math.sqrt(a*a+o*o+c*c);i+=l,n.push(i)}const h=[];for(let r=0;r<=e;r++)h.push(0);for(let r=1;r<=s-e;r++){const a=n[r]/i;h.push(a*(s-e+1))}for(let r=0;r<=e;r++)h.push(s-e+1);return h}function ms(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let r=1;r<=s;r++){const a=t[r][0]-t[r-1][0],o=t[r][1]-t[r-1][1],c=t[r][2]-t[r-1][2],l=Math.sqrt(a*a+o*o+c*c),d=Math.sqrt(l);i+=d,n.push(i)}const h=[];for(let r=0;r<=e;r++)h.push(0);for(let r=1;r<=s-e;r++){const a=n[r]/i;h.push(a*(s-e+1))}for(let r=0;r<=e;r++)h.push(s-e+1);return h}function ut(u,t,s,e){if(t===0)return s>=e[u]&&s<e[u+1]?1:0;const n=e[u+t]-e[u],i=e[u+t+1]-e[u+1],h=n>1e-10?(s-e[u])/n:0,r=i>1e-10?(e[u+t+1]-s)/i:0;return h*ut(u,t-1,s,e)+r*ut(u+1,t-1,s,e)}function tt(u,t,s,e,n){const i=e.length-1,h=t;if(u=Math.max(s[h],Math.min(s[i+1],u)),Math.abs(u-s[i+1])<1e-8)return[...e[i]];if(Math.abs(u-s[h])<1e-8)return[...e[0]];const r=[0,0,0];let a=0;for(let o=0;o<=i;o++){const c=ut(o,h,u,s),l=n[o]*c;r[0]+=e[o][0]*l,r[1]+=e[o][1]*l,r[2]+=e[o][2]*l,a+=l}if(a<1e-10){const o=s[s.length-h-1];if(Math.abs(u-o)<1e-8)return[...e[i]];if(Math.abs(u-s[h])<1e-8)return[...e[0]]}return a>1e-10&&(r[0]/=a,r[1]/=a,r[2]/=a),r}function ys(u,t,s,e){const n=u,i=t[n],h=t[t.length-n-1];let r=0;const a=1e3,o=(h-i)/a;let c=tt(i,u,t,s,e);for(let g=1;g<=a;g++){const p=i+g*o,A=tt(p,u,t,s,e),b=A[0]-c[0],P=A[1]-c[1],w=A[2]-c[2];r+=Math.sqrt(b*b+P*P+w*w),c=A}const l=tt(h,u,t,s,e),d=l[0]-c[0],m=l[1]-c[1],y=l[2]-c[2];return r+=Math.sqrt(d*d+m*m+y*y),r}function Ps(u){return u.map(t=>[...t])}class st{constructor(t=0,s=0,e=0,n=1){this._x=t,this._y=s,this._z=e,this._w=n}static slerpFlat(t,s,e,n,i,h,r){let a=e[n+0],o=e[n+1],c=e[n+2],l=e[n+3];const d=i[h+0],m=i[h+1],y=i[h+2],g=i[h+3];if(r===0){t[s+0]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l;return}if(r===1){t[s+0]=d,t[s+1]=m,t[s+2]=y,t[s+3]=g;return}if(l!==g||a!==d||o!==m||c!==y){let p=1-r;const A=a*d+o*m+c*y+l*g,b=A>=0?1:-1,P=1-A*A;if(P>Number.EPSILON){const M=Math.sqrt(P),E=Math.atan2(M,A*b);p=Math.sin(p*E)/M,r=Math.sin(r*E)/M}const w=r*b;if(a=a*p+d*w,o=o*p+m*w,c=c*p+y*w,l=l*p+g*w,p===1-r){const M=1/Math.sqrt(a*a+o*o+c*c+l*l);a*=M,o*=M,c*=M,l*=M}}t[s]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l}static multiplyQuaternionsFlat(t,s,e,n,i,h){const r=e[n],a=e[n+1],o=e[n+2],c=e[n+3],l=i[h],d=i[h+1],m=i[h+2],y=i[h+3];return t[s]=r*y+c*l+a*m-o*d,t[s+1]=a*y+c*d+o*l-r*m,t[s+2]=o*y+c*m+r*d-a*l,t[s+3]=c*y-r*l-a*d-o*m,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,e,n){return this._x=t,this._y=s,this._z=e,this._w=n,this._onChangeCallback(),this}clone(){return new st(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t.x,n=t.y,i=t.z,h=t.order,r=Math.cos,a=Math.sin,o=r(e/2),c=r(n/2),l=r(i/2),d=a(e/2),m=a(n/2),y=a(i/2);switch(h){case"XYZ":this._x=d*c*l+o*m*y,this._y=o*m*l-d*c*y,this._z=o*c*y+d*m*l,this._w=o*c*l-d*m*y;break;case"YXZ":this._x=d*c*l+o*m*y,this._y=o*m*l-d*c*y,this._z=o*c*y-d*m*l,this._w=o*c*l+d*m*y;break;case"ZXY":this._x=d*c*l-o*m*y,this._y=o*m*l+d*c*y,this._z=o*c*y+d*m*l,this._w=o*c*l-d*m*y;break;case"ZYX":this._x=d*c*l-o*m*y,this._y=o*m*l+d*c*y,this._z=o*c*y-d*m*l,this._w=o*c*l+d*m*y;break;case"YZX":this._x=d*c*l+o*m*y,this._y=o*m*l+d*c*y,this._z=o*c*y-d*m*l,this._w=o*c*l-d*m*y;break;case"XZY":this._x=d*c*l-o*m*y,this._y=o*m*l-d*c*y,this._z=o*c*y+d*m*l,this._w=o*c*l+d*m*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return s===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const e=s/2,n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,e=s[0],n=s[4],i=s[8],h=s[1],r=s[5],a=s[9],o=s[2],c=s[6],l=s[10],d=e+r+l;if(d>0){const m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(c-a)*m,this._y=(i-o)*m,this._z=(h-n)*m}else if(e>r&&e>l){const m=2*Math.sqrt(1+e-r-l);this._w=(c-a)/m,this._x=.25*m,this._y=(n+h)/m,this._z=(i+o)/m}else if(r>l){const m=2*Math.sqrt(1+r-e-l);this._w=(i-o)/m,this._x=(n+h)/m,this._y=.25*m,this._z=(a+c)/m}else{const m=2*Math.sqrt(1+l-e-r);this._w=(h-n)/m,this._x=(i+o)/m,this._y=(a+c)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let e=t.dot(s)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=e),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(F(this.dot(t),-1,1)))}rotateTowards(t,s){const e=this.angleTo(t);if(e===0)return this;const n=Math.min(1,s/e);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const e=t._x,n=t._y,i=t._z,h=t._w,r=s._x,a=s._y,o=s._z,c=s._w;return this._x=e*c+h*r+n*o-i*a,this._y=n*c+h*a+i*r-e*o,this._z=i*c+h*o+e*a-n*r,this._w=h*c-e*r-n*a-i*o,this._onChangeCallback(),this}slerp(t,s){if(s===0)return this;if(s===1)return this.copy(t);const e=this._x,n=this._y,i=this._z,h=this._w;let r=h*t._w+e*t._x+n*t._y+i*t._z;if(r<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,r=-r):this.copy(t),r>=1)return this._w=h,this._x=e,this._y=n,this._z=i,this;const a=1-r*r;if(a<=Number.EPSILON){const m=1-s;return this._w=m*h+s*this._w,this._x=m*e+s*this._x,this._y=m*n+s*this._y,this._z=m*i+s*this._z,this.normalize(),this}const o=Math.sqrt(a),c=Math.atan2(o,r),l=Math.sin((1-s)*c)/o,d=Math.sin(s*c)/o;return this._w=h*l+this._w*d,this._x=e*l+this._x*d,this._y=n*l+this._y*d,this._z=i*l+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,s,e){return this.copy(t).slerp(s,e)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(s),i*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const k=class k{constructor(t,s,e){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:i,y:h,z:r}=t;this.x=i,this.y=h,this.z=r||0;return}if(n===3){this.x=t,this.y=s,this.z=e;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}set(t,s,e){return e===void 0&&(e=this.z),this.x=t,this.y=s,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new k(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(xs.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(xs.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[3]*e+i[6]*n,this.y=i[1]*s+i[4]*e+i[7]*n,this.z=i[2]*s+i[5]*e+i[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const s=this.x,e=this.y,n=this.z,i=t.elements,h=1/(i[3]*s+i[7]*e+i[11]*n+i[15]);return this.x=(i[0]*s+i[4]*e+i[8]*n+i[12])*h,this.y=(i[1]*s+i[5]*e+i[9]*n+i[13])*h,this.z=(i[2]*s+i[6]*e+i[10]*n+i[14])*h,this}applyQuaternion(t){const s=this.x,e=this.y,n=this.z,i=t.x,h=t.y,r=t.z,a=t.w,o=2*(h*n-r*e),c=2*(r*s-i*n),l=2*(i*e-h*s);return this.x=s+a*o+h*l-r*c,this.y=e+a*c+r*o-i*l,this.z=n+a*l+i*c-h*o,this}transformDirection(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[4]*e+i[8]*n,this.y=i[1]*s+i[5]*e+i[9]*n,this.z=i[2]*s+i[6]*e+i[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this.z=Math.max(t.z,Math.min(s.z,this.z)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this.z=Math.max(t,Math.min(s,this.z)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const s=this.dot(t),e=this.length(),n=t.length();return Math.abs(s)===e*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this.z=t.z+(s.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const e=t.x,n=t.y,i=t.z,h=s.x,r=s.y,a=s.z;return this.x=n*a-i*r,this.y=i*h-e*a,this.z=e*r-n*h,this}projectOnVector(t){const s=t.lengthSq();if(s===0)return this.set(0,0,0);const e=t.dot(this)/s;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return Nt.copy(this).projectOnVector(t),this.sub(Nt)}reflect(t){return this.sub(Nt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return s*s+e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=e,this.z=n,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,s*4)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,s*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=Math.random()*2-1,e=Math.sqrt(1-s*s);return this.x=e*Math.cos(t),this.y=s,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};k.X_AXIS=Object.freeze(new k(1,0,0)),k.NEGATIVE_X_AXIS=Object.freeze(new k(-1,0,0)),k.Y_AXIS=Object.freeze(new k(0,1,0)),k.NEGATIVE_Y_AXIS=Object.freeze(new k(0,-1,0)),k.Z_AXIS=Object.freeze(new k(0,0,1)),k.NEGATIVE_Z_AXIS=Object.freeze(new k(0,0,-1));let _=k;const Nt=new _,xs=new st,ct=class ct{constructor(t,s,e,n,i,h,r,a,o,c,l,d,m,y,g,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&h!=null&&r!=null&&a!=null&&o!=null&&c!=null&&l!=null&&d!=null&&m!=null&&y!=null&&g!=null&&p!=null&&this.set(t,s,e,n,i,h,r,a,o,c,l,d,m,y,g,p)}set(t,s,e,n,i,h,r,a,o,c,l,d,m,y,g,p){const A=this.elements;return A[0]=t,A[4]=s,A[8]=e,A[12]=n,A[1]=i,A[5]=h,A[9]=r,A[13]=a,A[2]=o,A[6]=c,A[10]=l,A[14]=d,A[3]=m,A[7]=y,A[11]=g,A[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ct().fromArray(this.elements)}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],this}copyPosition(t){const s=this.elements,e=t.elements;return s[12]=e[12],s[13]=e[13],s[14]=e[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Rt.equalPoint3d(t,_.Z_AXIS))this.identity();else{const s=new _(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?s.crossVectors(_.Y_AXIS,t).normalize():s.crossVectors(_.Z_AXIS,t).normalize();const e=t.clone().cross(s).normalize();this.set(s.x,s.y,s.z,0,e.x,e.y,e.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,s,e){return t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}makeBasis(t,s,e){return this.set(t.x,s.x,e.x,0,t.y,s.y,e.y,0,t.z,s.z,e.z,0,0,0,0,1),this}extractRotation(t){const s=this.elements,e=t.elements,n=1/K.setFromMatrixColumn(t,0).length(),i=1/K.setFromMatrixColumn(t,1).length(),h=1/K.setFromMatrixColumn(t,2).length();return s[0]=e[0]*n,s[1]=e[1]*n,s[2]=e[2]*n,s[3]=0,s[4]=e[4]*i,s[5]=e[5]*i,s[6]=e[6]*i,s[7]=0,s[8]=e[8]*h,s[9]=e[9]*h,s[10]=e[10]*h,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(bs,t,Cs)}lookAt(t,s,e){const n=this.elements;return L.subVectors(t,s),L.lengthSq()===0&&(L.z=1),L.normalize(),X.crossVectors(e,L),X.lengthSq()===0&&(Math.abs(e.z)===1?L.x+=1e-4:L.z+=1e-4,L.normalize(),X.crossVectors(e,L)),X.normalize(),dt.crossVectors(L,X),n[0]=X.x,n[4]=dt.x,n[8]=L.x,n[1]=X.y,n[5]=dt.y,n[9]=L.y,n[2]=X.z,n[6]=dt.z,n[10]=L.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,h=e[0],r=e[4],a=e[8],o=e[12],c=e[1],l=e[5],d=e[9],m=e[13],y=e[2],g=e[6],p=e[10],A=e[14],b=e[3],P=e[7],w=e[11],M=e[15],E=n[0],z=n[4],T=n[8],$=n[12],W=n[1],Z=n[5],v=n[9],yt=n[13],xt=n[2],gt=n[6],_t=n[10],pt=n[14],At=n[3],zt=n[7],Mt=n[11],ft=n[15];return i[0]=h*E+r*W+a*xt+o*At,i[4]=h*z+r*Z+a*gt+o*zt,i[8]=h*T+r*v+a*_t+o*Mt,i[12]=h*$+r*yt+a*pt+o*ft,i[1]=c*E+l*W+d*xt+m*At,i[5]=c*z+l*Z+d*gt+m*zt,i[9]=c*T+l*v+d*_t+m*Mt,i[13]=c*$+l*yt+d*pt+m*ft,i[2]=y*E+g*W+p*xt+A*At,i[6]=y*z+g*Z+p*gt+A*zt,i[10]=y*T+g*v+p*_t+A*Mt,i[14]=y*$+g*yt+p*pt+A*ft,i[3]=b*E+P*W+w*xt+M*At,i[7]=b*z+P*Z+w*gt+M*zt,i[11]=b*T+P*v+w*_t+M*Mt,i[15]=b*$+P*yt+w*pt+M*ft,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[4],n=t[8],i=t[12],h=t[1],r=t[5],a=t[9],o=t[13],c=t[2],l=t[6],d=t[10],m=t[14],y=t[3],g=t[7],p=t[11],A=t[15];return y*(+i*a*l-n*o*l-i*r*d+e*o*d+n*r*m-e*a*m)+g*(+s*a*m-s*o*d+i*h*d-n*h*m+n*o*c-i*a*c)+p*(+s*o*l-s*r*m-i*h*l+e*h*m+i*r*c-e*o*c)+A*(-n*r*c-s*a*l+s*r*d+n*h*l-e*h*d+e*a*c)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,e){const n=this.elements;return t instanceof _?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=s,n[14]=e),this}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],h=t[4],r=t[5],a=t[6],o=t[7],c=t[8],l=t[9],d=t[10],m=t[11],y=t[12],g=t[13],p=t[14],A=t[15],b=l*p*o-g*d*o+g*a*m-r*p*m-l*a*A+r*d*A,P=y*d*o-c*p*o-y*a*m+h*p*m+c*a*A-h*d*A,w=c*g*o-y*l*o+y*r*m-h*g*m-c*r*A+h*l*A,M=y*l*a-c*g*a-y*r*d+h*g*d+c*r*p-h*l*p,E=s*b+e*P+n*w+i*M;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/E;return t[0]=b*z,t[1]=(g*d*i-l*p*i-g*n*m+e*p*m+l*n*A-e*d*A)*z,t[2]=(r*p*i-g*a*i+g*n*o-e*p*o-r*n*A+e*a*A)*z,t[3]=(l*a*i-r*d*i-l*n*o+e*d*o+r*n*m-e*a*m)*z,t[4]=P*z,t[5]=(c*p*i-y*d*i+y*n*m-s*p*m-c*n*A+s*d*A)*z,t[6]=(y*a*i-h*p*i-y*n*o+s*p*o+h*n*A-s*a*A)*z,t[7]=(h*d*i-c*a*i+c*n*o-s*d*o-h*n*m+s*a*m)*z,t[8]=w*z,t[9]=(y*l*i-c*g*i-y*e*m+s*g*m+c*e*A-s*l*A)*z,t[10]=(h*g*i-y*r*i+y*e*o-s*g*o-h*e*A+s*r*A)*z,t[11]=(c*r*i-h*l*i-c*e*o+s*l*o+h*e*m-s*r*m)*z,t[12]=M*z,t[13]=(c*g*n-y*l*n+y*e*d-s*g*d-c*e*p+s*l*p)*z,t[14]=(y*r*n-h*g*n-y*e*a+s*g*a+h*e*p-s*r*p)*z,t[15]=(h*l*n-c*r*n+c*e*a-s*l*a-h*e*d+s*r*d)*z,this}scale(t){const s=this.elements,e=t.x,n=t.y,i=t.z;return s[0]*=e,s[4]*=n,s[8]*=i,s[1]*=e,s[5]*=n,s[9]*=i,s[2]*=e,s[6]*=n,s[10]*=i,s[3]*=e,s[7]*=n,s[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,e,n))}makeTranslation(t,s,e){return t instanceof _?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,e,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,s,-e,0,0,e,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,0,e,0,0,1,0,0,-e,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,0,e,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const e=Math.cos(s),n=Math.sin(s),i=1-e,h=t.x,r=t.y,a=t.z,o=i*h,c=i*r;return this.set(o*h+e,o*r-n*a,o*a+n*r,0,o*r+n*a,c*r+e,c*a-n*h,0,o*a-n*r,c*a+n*h,i*a*a+e,0,0,0,0,1),this}makeScale(t,s,e){return this.set(t,0,0,0,0,s,0,0,0,0,e,0,0,0,0,1),this}makeShear(t,s,e,n,i,h){return this.set(1,e,i,0,t,1,h,0,s,n,1,0,0,0,0,1),this}compose(t,s,e){const n=this.elements,i=s.x,h=s.y,r=s.z,a=s.w,o=i+i,c=h+h,l=r+r,d=i*o,m=i*c,y=i*l,g=h*c,p=h*l,A=r*l,b=a*o,P=a*c,w=a*l,M=e.x,E=e.y,z=e.z;return n[0]=(1-(g+A))*M,n[1]=(m+w)*M,n[2]=(y-P)*M,n[3]=0,n[4]=(m-w)*E,n[5]=(1-(d+A))*E,n[6]=(p+b)*E,n[7]=0,n[8]=(y+P)*z,n[9]=(p-b)*z,n[10]=(1-(d+g))*z,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,s,e){const n=this.elements;let i=K.set(n[0],n[1],n[2]).length();const h=K.set(n[4],n[5],n[6]).length(),r=K.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],q.copy(this);const o=1/i,c=1/h,l=1/r;return q.elements[0]*=o,q.elements[1]*=o,q.elements[2]*=o,q.elements[4]*=c,q.elements[5]*=c,q.elements[6]*=c,q.elements[8]*=l,q.elements[9]*=l,q.elements[10]*=l,s.setFromRotationMatrix(q),e.x=i,e.y=h,e.z=r,this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<16;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<16;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t[s+9]=e[9],t[s+10]=e[10],t[s+11]=e[11],t[s+12]=e[12],t[s+13]=e[13],t[s+14]=e[14],t[s+15]=e[15],t}};ct.IDENTITY=Object.freeze(new ct);let Q=ct;const K=new _,q=new Q,bs=new _(0,0,0),Cs=new _(1,1,1),X=new _,dt=new _,L=new _;class j{constructor(t=void 0,s=void 0){this.min=t==null?new _(1/0,1/0,1/0):new _(t.x,t.y,t.z),this.max=s==null?new _(-1/0,-1/0,-1/0):new _(s.x,s.y,s.z)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromArray(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s+=3)this.expandByPoint(kt.fromArray(t,s));return this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=kt.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new j().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let s,e;return t.normal.x>0?(s=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(s=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(s+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(s+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(s+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(s+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),s<=-t.constant&&e>=-t.constant}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,kt).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(G[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),G[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),G[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),G[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),G[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),G[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),G[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),G[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(G),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const G=[new _,new _,new _,new _,new _,new _,new _,new _],kt=new _,gs=new C;class U{constructor(t=void 0,s=void 0){this.min=t==null?new C(1/0,1/0):new C(t.x,t.y),this.max=s==null?new C(-1/0,-1/0):new C(s.x,s.y)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=gs.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new U().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new C(0,0):new C(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new C(0,0):new C(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,gs).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const _s=new _,Ss=new _,Bs=new O;class et{constructor(t=new _(1,0,0),s=0){this.normal=t,this.constant=s}set(t,s){return this.normal.copy(t),this.constant=s,this}setComponents(t,s,e,n){return this.normal.set(t,s,e),this.constant=n,this}setFromNormalAndCoplanarPoint(t,s){return this.normal.copy(t),this.constant=-s.dot(this.normal),this}setFromCoplanarPoints(t,s,e){const n=_s.subVectors(e,s).cross(Ss.subVectors(t,s)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,s){return s.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,s){const e=s||Bs.getNormalMatrix(t),n=this.coplanarPoint(_s).applyMatrix3d(t),i=this.normal.applyMatrix3(e).normalize();return this.constant=-n.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new et().copy(this)}}class S extends C{static pointArrayToNumberArray(t){const s=new Array(t.length*2);return t.forEach((e,n)=>{e.toArray(s,n*2)}),s}}class f extends _{static pointArrayToNumberArray(t,s=!0){const e=s?3:2,n=new Array(t.length*e);return t.forEach((i,h)=>{i.toArray(n,h*e)}),n}}const ps=new Q,As=new st,lt=class lt{constructor(t=0,s=0,e=0,n=lt.DEFAULT_ORDER){this._x=t,this._y=s,this._z=e,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,s,e,n=this._order){return this._x=t,this._y=s,this._z=e,this._order=n,this._onChangeCallback(),this}clone(){return new lt(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,s=this._order,e=!0){const n=t.elements,i=n[0],h=n[4],r=n[8],a=n[1],o=n[5],c=n[9],l=n[2],d=n[6],m=n[10];switch(s){case"XYZ":this._y=Math.asin(F(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(-c,m),this._z=Math.atan2(-h,i)):(this._x=Math.atan2(d,o),this._z=0);break;case"YXZ":this._x=Math.asin(-F(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(r,m),this._z=Math.atan2(a,o)):(this._y=Math.atan2(-l,i),this._z=0);break;case"ZXY":this._x=Math.asin(F(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-l,m),this._z=Math.atan2(-h,o)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-F(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-h,o));break;case"YZX":this._z=Math.asin(F(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,o),this._y=Math.atan2(-l,i)):(this._x=0,this._y=Math.atan2(r,m));break;case"XZY":this._z=Math.asin(-F(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,o),this._y=Math.atan2(r,i)):(this._x=Math.atan2(-c,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+s)}return this._order=s,e===!0&&this._onChangeCallback(),this}setFromQuaternion(t,s,e=!0){return ps.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ps,s,e)}setFromVector3(t,s=this._order){return this.set(t.x,t.y,t.z,s)}reorder(t){return As.setFromEuler(this),this.setFromQuaternion(As,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};lt.DEFAULT_ORDER="XYZ";let Lt=lt;class zs{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ut extends zs{translate(t){return this.transform(new O().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Es extends Ut{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new U}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const s=[];for(let e=0;e<this.loops.length;++e){const i=this.loops[e].getPoints(t);s.push(i)}return s}buildHierarchy(){var r;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),e=this.sortBoundaryBoxesByAreas(s),n=new Map,i=e.length;for(let a=0;a<i;a++)n.set(e[a],{index:e[a],children:[]});const h={index:-1,children:[]};for(let a=0;a<i;a++){const o=e[a],c=t[o],l=s[o];let d=a+1;for(;d<i;d++){const m=e[d],y=t[m];if(s[m].containsBox(l)&&ls.isPointInPolygon(c[B.randInt(0,c.length-1)],y)){(r=n.get(m))==null||r.children.push(n.get(o));break}}d===i&&h.children.push(n.get(o))}return h}calculateBoundaryBoxes(t){const s=[];return t.forEach(e=>{s.push(new U().setFromPoints(e))}),s}sortBoundaryBoxesByAreas(t){const s=[];t.forEach((n,i)=>{const h=n.size,r=h.width*h.height;s.push({area:r,index:i})}),s.sort((n,i)=>n.area-i.area);const e=[];return s.forEach(n=>{e.push(n.index)}),e}}class H extends Ut{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const s=this.getUtoTmapping(t);return this.getPoint(s)}getPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}getSpacedPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPointAt(e/t));return s}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const s=[];let e,n=this.getPoint(0),i=0;s.push(0);for(let h=1;h<=t;h++)e=this.getPoint(h/t),i+=e.distanceTo(n),s.push(i),n=e;return s}getUtoTmapping(t,s){const e=this.getLengths();let n=0;const i=e.length;let h;s?h=s:h=t*e[i-1];let r=0,a=i-1,o;for(;r<=a;)if(n=Math.floor(r+(a-r)/2),o=e[n]-h,o<0)r=n+1;else if(o>0)a=n-1;else{a=n;break}if(n=a,e[n]===h)return n/(i-1);const c=e[n],d=e[n+1]-c,m=(h-c)/d;return(n+m)/(i-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const i=this.getPoint(e),h=this.getPoint(n),r=new S;return r.copy(h).sub(i).normalize(),r}getTangentAt(t){const s=this.getUtoTmapping(t);return this.getTangent(s)}}class nt extends H{constructor(t,s,e,n,i){super();const h=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(i!==void 0);if(h==3)typeof t=="object"&&typeof s=="object"&&typeof e=="object"?this.createByThreePoints(t,s,e):this.createByStartEndPointsAndBulge(t,s,e);else if(h==5){const r=t;this.center=new S(r.x,r.y),this.radius=s,this.startAngle=e,this.endAngle=n,this.clockwise=i}else throw N.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(t,s,e){const n=(z,T)=>({x:(z.x+T.x)/2,y:(z.y+T.y)/2}),i=(z,T)=>(T.y-z.y)/(T.x-z.x),h=z=>-1/z,r=n(t,s),a=n(s,e),o=i(t,s),c=i(s,e),l=h(o),d=h(c),m=(z,T,$,W)=>{const Z=(W-T)/(z-$),v=z*Z+T;return{x:Z,y:v}},y=r.y-l*r.x,g=a.y-d*a.x,p=m(l,y,d,g),A=Math.sqrt(Math.pow(t.x-p.x,2)+Math.pow(t.y-p.y,2)),b=(z,T)=>Math.atan2(z.y-T.y,z.x-T.x),P=b(t,p),w=b(s,p),M=b(e,p),E=M>P&&M<w||P>M&&P<w||w>M&&w<P;this.center=p,this.radius=A,this.startAngle=P,this.endAngle=M,this.clockwise=!E}createByStartEndPointsAndBulge(t,s,e){let n,i,h;e<0?(n=Math.atan(-e)*4,i=new C(t),h=new C(s)):(n=Math.atan(e)*4,i=new C(s),h=new C(t));const r=new C().subVectors(h,i),a=r.length(),o=new C().addVectors(i,r.multiplyScalar(.5)),c=Math.abs(a/2/Math.tan(n/2)),l=r.normalize();let d;if(n<Math.PI){const m=new C(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));d=o.add(m.multiplyScalar(-c))}else{const m=new C(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));d=o.add(m.multiplyScalar(c))}e<0?(this.startAngle=Math.atan2(i.y-d.y,i.x-d.x),this.endAngle=Math.atan2(h.y-d.y,h.x-d.x)):(this.startAngle=Math.atan2(h.y-d.y,h.x-d.x),this.endAngle=Math.atan2(i.y-d.y,i.x-d.x)),this.clockwise=e<0,this.center=d,this.radius=h.sub(d).length()}get center(){return this._center}set center(t){this._center=new S(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?B.normalizeAngle(this.startAngle-this.endAngle):B.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=B.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of s)B.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(i));const e=t.map(i=>i.x),n=t.map(i=>i.y);return new U(new S(Math.min(...e),Math.min(...n)),new S(Math.max(...e),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new nt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const s=this.center.x+this.radius*Math.cos(t),e=this.center.y+this.radius*Math.sin(t);return new S(s,e)}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;if(this.closed&&(e=I,n=0),this.clockwise)for(let i=0;i<=t;i++){const h=n-e*(i/t),r=this.getPointAtAngle(h);s.push(new S(r.x,r.y))}else for(let i=0;i<=t;i++){const h=n+e*(i/t),r=this.getPointAtAngle(h);s.push(new S(r.x,r.y))}return s}}class Is extends zs{translate(t){return this.transform(new Q().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class it extends Is{}class rt extends it{constructor(t,s){super(),this._start=new f(t),this._end=new f(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new _().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new f((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,s){return this.delta(s).multiplyScalar(t).add(this._start)}atLength(t,s=!1){if(s){const e=this.delta(Y).normalize();return new f(this._start).addScaledVector(e,t)}else{const e=this.delta(Y).normalize();return new f(this._end).addScaledVector(e,t)}}extend(t,s=!1){if(s){const e=Y.subVectors(this._start,this._end).normalize();this._start=new f(this._start).addScaledVector(e,t)}else{const e=this.delta(Y).normalize();this._end=new f(this._end).addScaledVector(e,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,s){Ms.subVectors(t,this._start),mt.subVectors(this.endPoint,this.startPoint);const e=mt.dot(mt);let i=mt.dot(Ms)/e;return s&&(i=B.clamp(i,0,1)),i}closestPointToPoint(t,s,e){const n=this.closestPointToPointParameter(t,s);return this.delta(e).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const s=this.direction,n=Y.subVectors(t,this.startPoint).dot(s);return new f().copy(s).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const s=this.direction,e=this.startPoint,i=Y.subVectors(t,e).dot(s),h=Y.copy(s).multiplyScalar(i);return new f().addVectors(e,h)}calculateBoundingBox(){const t=new f(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),s=new f(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new j(t,s)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new rt(this._start.clone(),this._end.clone())}}const Y=new _,Ms=new _,mt=new _;class ht extends it{static computeCenterPoint(t,s,e){const n=new _().addVectors(t,s).multiplyScalar(.5),i=new _().addVectors(t,e).multiplyScalar(.5),h=new _().subVectors(s,t),r=new _().subVectors(e,t),a=new _().crossVectors(h,r).normalize();if(a.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const o=new _().crossVectors(h,a).normalize(),c=new _().crossVectors(r,a).normalize(),l=o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=new rt(n,n.clone().add(l)),y=new rt(i,i.clone().add(d)),g=new _;return m.closestPointToPoint(y.startPoint,!0,g)?g:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,s,e){const n=ht.computeCenterPoint(t,s,e);if(n){const i=n.distanceTo(t),h=new _().subVectors(t,n),r=new _().subVectors(s,n),a=Math.atan2(h.y,h.x),o=Math.atan2(r.y,r.x);return new ht(n,i,a,o,_.Z_AXIS)}}constructor(t,s,e,n,i,h=_.X_AXIS){super(),this.center=t,this.radius=s,this.startAngle=e,this.endAngle=n,this.normal=i,this.refVec=h,(n-e)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=e,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new f(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return B.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new _(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)B.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,h=-1/0,r=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>h&&(h=o.y),o.z>r&&(r=o.z)}return new j({x:s,y:e,z:n},{x:i,y:h,z:r})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const h=n+e*(i/t),r=this.getPointAtAngle(h);s.push(r)}return s}transform(t){const s=qt.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),e=qt.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),s.applyMatrix3d(t),e.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(s),this.endAngle=this.getAngle(e),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ht(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(qt.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const s=this.normal,e=this.refVec,n={x:s.y*e.z-s.z*e.y,y:s.z*e.x-s.x*e.z,z:s.x*e.y-s.y*e.x},i=this.center,h=this.radius;return new f(i.x+h*(e.x*Math.cos(t)+n.x*Math.sin(t)),i.y+h*(e.y*Math.cos(t)+n.y*Math.sin(t)),i.z+h*(e.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new _(this.center).distanceTo(Et);return new et(this.normal,t)}}const qt=new _;class Vt extends H{constructor(t,s,e,n=0,i=I,h=!1,r=0){super(),this.center=t,this.majorAxisRadius=s,this.minorAxisRadius=e,(i-n)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=n,this.endAngle=i),this.clockwise=h,this.rotation=r}get center(){return this._center}set center(t){this._center=new f(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return B.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let s=1/0,e=1/0,n=-1/0,i=-1/0;for(let h=0;h<=100;h++){const r=this.getPoint(h/100);s=Math.min(s,r.x),e=Math.min(e,r.y),n=Math.max(n,r.x),i=Math.max(i,r.y)}return new U({x:s,y:e},{x:n,y:i})}get closed(){return this.deltaAngle==0}getPoint(t){const s=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;for(;e<0;)e+=s;for(;e>s;)e-=s;e<Number.EPSILON&&(n?e=0:e=s),this.clockwise===!0&&!n&&(e===s?e=-s:e=e-s);const i=this.startAngle+t*e;let h=this.center.x+this.majorAxisRadius*Math.cos(i),r=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const a=Math.cos(this.rotation),o=Math.sin(this.rotation),c=h-this.center.x,l=r-this.center.y;h=c*a-l*o+this.center.x,r=c*o+l*a+this.center.y}return new S(h,r)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new Vt(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class jt extends it{constructor(t,s,e,n,i,h=0,r=I){super(),this.center=t,this.normal=s,this.majorAxis=e,this.majorAxisRadius=n,this.minorAxisRadius=i;const a=Math.abs(r-h);Math.abs(a-I)<1e-10||Math.abs(a-2*I)<1e-10?(this.startAngle=0,this.endAngle=I):(this.startAngle=h,this.endAngle=r)}get center(){return this._center}set center(t){this._center=new f(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-I)<1e-10?I:B.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new _(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new _().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return It.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,s=this.deltaAngle/t;let e=0,n=this.getPointAtAngle(this.startAngle);for(let i=1;i<=t;i++){const h=this.startAngle+i*s,r=this.getPointAtAngle(h),a=r.x-n.x,o=r.y-n.y,c=r.z-n.z;e+=Math.sqrt(a*a+o*o+c*c),n=r}return e}calculateBoundingBox(){if(this.majorAxis.equals(_.X_AXIS)||this.majorAxis.equals(_.Y_AXIS)||this.majorAxis.isParallelTo(_.X_AXIS)||this.majorAxis.isParallelTo(_.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)B.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,h=-1/0,r=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>h&&(h=o.y),o.z>r&&(r=o.z)}return new j({x:s,y:e,z:n},{x:i,y:h,z:r})}else{let s=1/0,e=1/0,n=1/0,i=-1/0,h=-1/0,r=-1/0;for(let a=0;a<=100;a++){const o=this.startAngle+this.deltaAngle*(a/100),c=this.getPointAtAngle(o);s=Math.min(s,c.x),e=Math.min(e,c.y),n=Math.min(n,c.z),i=Math.max(i,c.x),h=Math.max(h,c.y),r=Math.max(r,c.z)}return new j({x:s,y:e,z:n},{x:i,y:h,z:r})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const h=n+e*(i/t),r=this.getPointAtAngle(h);s.push(r)}return s}getPointAtAngle(t){const s=Math.cos(t),e=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e),i=this.majorAxis.clone().multiplyScalar(s*this.majorAxisRadius).add(n);return new f(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const s=new _(t).sub(this.center),e=s.dot(this.majorAxis),n=s.dot(this.minorAxis),i=e/this.majorAxisRadius,h=n/this.minorAxisRadius;return i*i+h*h<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new jt(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new _(this.center).distanceTo(Et);return new et(this.normal,t)}}class Rs extends H{constructor(t=null,s=!1){super(),this._vertices=t||new Array,this._closed=s}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const s=this._vertices[0];return new S(s.x,s.y)}else{const s=this._vertices[t-1];return new S(s.x,s.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const s=this._vertices.length;for(let e=0;e<s;++e){const n=this._vertices[e];let i=null;if(e<s-1?i=this._vertices[e+1]:e==s-1&&this.closed&&(i=this._vertices[0]),i)if(n.bulge){const h=new nt(n,i,n.bulge);t+=h.length}else t+=new S(n.x,n.y).distanceTo(i)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,s){t<=0?this._vertices.unshift(s):this._vertices.splice(t,0,s),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const s=this._vertices[t];return new S(s.x,s.y)}calculateBoundingBox(){const t=this.getPoints(100);return new U().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,s){const e=[];return this.getPoints(t).forEach(i=>e.push(new f().set(i.x,i.y,s))),e}getPoints(t){const s=[],e=this._vertices.length;for(let n=0;n<e;++n){const i=this._vertices[n];if(i.bulge){let h=null;if(n<e-1?h=this._vertices[n+1]:n==e-1&&this.closed&&(h=this._vertices[0]),h){const a=new nt(i,h,i.bulge).getPoints(t),o=a.length;for(let c=0;c<o;++c){const l=a[c];s.push(new S(l.x,l.y))}}}else s.push(new S(i.x,i.y)),n==e-1&&this.closed&&s.push(s[0])}return s}}class Ft extends H{constructor(t,s){super(),this._start=new S(t),this._end=new S(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new S(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),s=new S(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new U(t,s)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ft(this._start.clone(),this._end.clone())}}class Ts extends H{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(s=>{t+=s.length}),t}calculateBoundingBox(){const t=this.getPoints(100),s=new U;return s.setFromPoints(t),s}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const s=[];return this.curves.forEach(e=>{e.getPoints(t).forEach(n=>{s.push(new S(n.x,n.y))})}),s}}class Gt{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,s,e,n){this.c0=t,this.c1=e,this.c2=-3*t+3*s-2*e-n,this.c3=2*t-2*s+e+n}initCatmullRom(t,s,e,n,i){this.init(s,e,i*(e-t),i*(n-s))}initNonuniformCatmullRom(t,s,e,n,i,h,r){let a=(s-t)/i-(e-t)/(i+h)+(e-s)/h,o=(e-s)/h-(n-s)/(h+r)+(n-e)/r;a*=h,o*=h,this.init(s,e,a,o)}calc(t){const s=t*t,e=s*t;return this.c0+this.c1*t+this.c2*s+this.c3*e}}class fs extends it{constructor(t=[],s=!1,e="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new _,this._px=new Gt,this._py=new Gt,this._pz=new Gt,this._points=t.map(i=>new f(i)),this._closed=s,this._curveType=e,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new f}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new f}get length(){if(this._points.length<2)return 0;let t=0;for(let s=1;s<this._points.length;s++)t+=this._points[s-1].distanceTo(this._points[s]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,s=new f){const e=s,n=this._points,i=n.length;if(i===0)return e.set(0,0,0);if(i===1)return e.copy(n[0]);const h=(i-(this._closed?0:1))*t;let r=Math.floor(h),a=h-r;this._closed?r+=r>0?0:(Math.floor(Math.abs(r)/i)+1)*i:a===0&&r===i-1&&(r=i-2,a=1);let o,c;this._closed||r>0?o=n[(r-1)%i]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),o=new f(this._tmp.x,this._tmp.y,this._tmp.z));const l=n[r%i],d=n[(r+1)%i];if(this._closed||r+2<i?c=n[(r+2)%i]:(this._tmp.subVectors(n[i-1],n[i-2]).add(n[i-1]),c=new f(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const m=this._curveType==="chordal"?.5:.25;let y=Math.pow(o.distanceToSquared(l),m),g=Math.pow(l.distanceToSquared(d),m),p=Math.pow(d.distanceToSquared(c),m);g<1e-4&&(g=1),y<1e-4&&(y=g),p<1e-4&&(p=g),this._px.initNonuniformCatmullRom(o.x,l.x,d.x,c.x,y,g,p),this._py.initNonuniformCatmullRom(o.y,l.y,d.y,c.y,y,g,p),this._pz.initNonuniformCatmullRom(o.z,l.z,d.z,c.z,y,g,p)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(o.x,l.x,d.x,c.x,this._tension),this._py.initCatmullRom(o.y,l.y,d.y,c.y,this._tension),this._pz.initCatmullRom(o.z,l.z,d.z,c.z,this._tension));return e.set(this._px.calc(a),this._py.calc(a),this._pz.calc(a)),e}getPoints(t){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}setPoints(t){this._points=t.map(s=>new f(s)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(s=>{const e=new f;return e.copy(s),e.applyMatrix3d(t),e}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new j;const t=new j;return this._points.forEach(s=>{t.expandByPoint(s)}),t}}class V{constructor(t,s,e,n){this._degree=t,this._knots=[...s],this._controlPoints=e.map(i=>({x:i.x,y:i.y,z:i.z})),this._weights=n?[...n]:new Array(e.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const s=this._controlPoints.map(e=>[e.x,e.y,e.z]);return tt(t,this._degree,this._knots,s,this._weights)}length(){const t=this._controlPoints.map(s=>[s.x,s.y,s.z]);return ys(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,s,e,n){return new V(t,s,e,n)}static byPoints(t,s,e="Uniform"){let n;switch(e){case"Chord":n=ds(s,t);break;case"SqrtChord":n=ms(s,t);break;case"Uniform":default:n=us(s,t.length);break}const i=t.map(r=>({x:r[0],y:r[1],z:r[2]})),h=new Array(i.length).fill(1);return new V(s,n,i,h)}getParameterRange(){const t=this._knots[this._degree],s=this._knots[this._knots.length-this._degree-1];return{start:t,end:s}}getPoints(t){const s=[],{start:e,end:n}=this.getParameterRange();for(let i=0;i<=t;i++){const h=e+(n-e)*(i/t);s.push(this.point(h))}return s}isClosed(t=1e-6){const{start:s,end:e}=this.getParameterRange(),n=this.point(s),i=this.point(e),h=n[0]-i[0],r=n[1]-i[1],a=n[2]-i[2];return Math.sqrt(h*h+r*r+a*a)<t}static createClosedCurve(t,s,e="Chord"){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const n=new fs(t,!0,"centripetal"),i=Math.max(50,t.length*2),r=n.getPoints(i).map(a=>[a.x,a.y,a.z]);return V.byPoints(r,s,e)}}class Xt extends it{constructor(t,s,e,n){super();const i=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0);if(i<2||i>4)throw N.AcCmErrors.ILLEGAL_PARAMETERS;const h=3;if(this._closed=n||!1,Array.isArray(s)){if(this._controlPoints=t,i>=4&&(this._closed=n),this._controlPoints.length<4)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._nurbsCurve=V.byKnotsControlPointsWeights(h,s,this._controlPoints,e)}else{if(this._fitPoints=t,this._knotParameterization=s,i>=3&&(this._closed=e),this._fitPoints.length<4)throw N.AcCmErrors.ILLEGAL_PARAMETERS;const r=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=V.byPoints(r,h,this._knotParameterization),this._controlPoints=this._nurbsCurve.controlPoints()}this._closed&&this.buildCurve()}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed)this._nurbsCurve=V.createClosedCurve(this._fitPoints,3,this._knotParameterization);else{const s=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=V.byPoints(s,3,this._knotParameterization)}this._controlPoints=this._nurbsCurve.controlPoints()}else if(this._controlPoints)if(this._closed){const s=this._knotParameterization||"Chord";this._nurbsCurve=V.createClosedCurve(this._controlPoints,3,s),this._controlPoints=this._nurbsCurve.controlPoints()}else{const s=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._nurbsCurve=V.byKnotsControlPointsWeights(3,s,this._controlPoints,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._nurbsCurve.degree()}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[s],n=this._nurbsCurve.point(e);return new f(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[t.length-s-1],n=this._nurbsCurve.point(e);return new f(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const s=this._fitPoints.length,e=t<0||t>=s?s-1:t,n=this._fitPoints[e];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const s=this._controlPoints.length,e=t<0||t>=s?s-1:t;return this._controlPoints[e]}getPoints(t=100){const s=this._nurbsCurve,e=[],n=s.knots(),i=this._nurbsCurve.degree(),h=n[i],r=n[n.length-i-1],a=(r-h)/(t-1);for(let o=0;o<t;o++){const c=o===t-1?r:h+o*a,l=s.point(c);e.push(new f(l[0],l[1],l[2]))}return e}getCurvePoints(t,s){const e=[],n=t.knots(),i=n[3],r=(n[n.length-4]-i)/(s-1);for(let a=0;a<s;a++){const o=i+a*r;e.push(t.point(o))}return e}calculateBoundingBox(){const t=this.getPoints(100);return new j().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]=[e.x,e.y,e.z||0]}),s}static createClosedSpline(t,s="Uniform"){if(t.length<4)throw new Error("At least 4 points are required for a closed spline");return new Xt(t,s,!0)}}x.AcGeArea2d=Es,x.AcGeBox2d=U,x.AcGeBox3d=j,x.AcGeCatmullRomCurve3d=fs,x.AcGeCircArc2d=nt,x.AcGeCircArc3d=ht,x.AcGeCurve2d=H,x.AcGeEllipseArc2d=Vt,x.AcGeEllipseArc3d=jt,x.AcGeEuler=Lt,x.AcGeGeometryUtil=ls,x.AcGeLine2d=Ft,x.AcGeLine3d=rt,x.AcGeLoop2d=Ts,x.AcGeMathUtil=B,x.AcGeMatrix2d=O,x.AcGeMatrix3d=Q,x.AcGeNurbsCurve=V,x.AcGePlane=et,x.AcGePoint2d=S,x.AcGePoint3d=f,x.AcGePolyline2d=Rs,x.AcGeQuaternion=st,x.AcGeShape2d=Ut,x.AcGeSpline3d=Xt,x.AcGeTol=It,x.AcGeVector2d=C,x.AcGeVector3d=_,x.DEFAULT_TOL=Rt,x.DEG2RAD=wt,x.FLOAT_TOL=D,x.ORIGIN_POINT_2D=ws,x.ORIGIN_POINT_3D=Et,x.RAD2DEG=Pt,x.TAU=I,x.basisFunction=ut,x.calculateCurveLength=ys,x.ceilPowerOfTwo=is,x.clamp=F,x.damp=Qt,x.degToRad=ss,x.euclideanModulo=bt,x.evaluateNurbsPoint=tt,x.floorPowerOfTwo=rs,x.generateChordKnots=ds,x.generateSqrtChordKnots=ms,x.generateUUID=Yt,x.generateUniformKnots=us,x.intPartLength=St,x.interpolateControlPoints=Ps,x.inverseLerp=Ot,x.isBetween=hs,x.isBetweenAngle=os,x.isPointInPolygon=Tt,x.isPolygonIntersect=cs,x.isPowerOfTwo=ns,x.lerp=Ct,x.mapLinear=Zt,x.normalizeAngle=J,x.pingpong=Kt,x.radToDeg=es,x.randFloat=vt,x.randFloatSpread=Jt,x.randInt=Wt,x.relativeEps=as,x.seededRandom=ts,x.smootherstep=$t,x.smoothstep=Ht,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(x,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],N):(x=typeof globalThis<"u"?globalThis:x||self,N(x["geometry-engine"]={},x.common))})(this,function(x,N){"use strict";const R=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Dt=1234567;const wt=Math.PI/180,Pt=180/Math.PI;function Yt(){const u=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,e=Math.random()*4294967295|0;return(R[u&255]+R[u>>8&255]+R[u>>16&255]+R[u>>24&255]+"-"+R[t&255]+R[t>>8&255]+"-"+R[t>>16&15|64]+R[t>>24&255]+"-"+R[s&63|128]+R[s>>8&255]+"-"+R[s>>16&255]+R[s>>24&255]+R[e&255]+R[e>>8&255]+R[e>>16&255]+R[e>>24&255]).toLowerCase()}function F(u,t,s){return Math.max(t,Math.min(s,u))}function bt(u,t){return(u%t+t)%t}function Zt(u,t,s,e,n){return e+(u-t)*(n-e)/(s-t)}function Ot(u,t,s){return u!==t?(s-u)/(t-u):0}function Ct(u,t,s){return(1-s)*u+s*t}function Qt(u,t,s,e){return Ct(u,t,1-Math.exp(-s*e))}function Kt(u,t=1){return t-Math.abs(bt(u,t*2)-t)}function Ht(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*(3-2*u))}function $t(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*u*(u*(u*6-15)+10))}function Wt(u,t){return u+Math.floor(Math.random()*(t-u+1))}function Jt(u,t){return u+Math.random()*(t-u)}function vt(u){return u*(.5-Math.random())}function ts(u){u!==void 0&&(Dt=u);let t=Dt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function ss(u){return u*wt}function es(u){return u*Pt}function ns(u){return(u&u-1)===0&&u!==0}function is(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function rs(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function v(u){const t=Math.PI*2;return(u%t+t)%t}function hs(u,t,s){return u>t&&u<s||u>s&&u<t}function os(u,t,s,e=!1){return u=v(u),t=v(t),s=v(s),e?t>s?u<=t&&u>=s:u<=t||u>=s:t<s?u>=t&&u<=s:u>=t||u<=s}function St(u){return u=Math.abs(u),u<1?0:Math.ceil(Math.log10(Math.abs(u)+1))}function as(u,t=1e-7){const s=St(u);return Math.max(Math.pow(10,s)*t,t)}const B={DEG2RAD:wt,RAD2DEG:Pt,generateUUID:Yt,clamp:F,euclideanModulo:bt,mapLinear:Zt,inverseLerp:Ot,lerp:Ct,damp:Qt,pingpong:Kt,smoothstep:Ht,smootherstep:$t,randInt:Wt,randFloat:Jt,randFloatSpread:vt,seededRandom:ts,degToRad:ss,radToDeg:es,isPowerOfTwo:ns,ceilPowerOfTwo:is,floorPowerOfTwo:rs,normalizeAngle:v,isBetween:hs,isBetweenAngle:os,intPartLength:St,relativeEps:as},ot=class ot{constructor(t,s){this.x=0,this.y=0;const e=+(t!==void 0)+ +(s!==void 0);if(e!==0){if(e===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(e===1){const{x:n,y:i}=t;this.x=n,this.y=i;return}if(e===2){this.x=t,this.y=s;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new ot(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const s=this.x,e=this.y,n=t.elements;return this.x=n[0]*s+n[3]*e+n[6],this.y=n[1]*s+n[4]*e+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y;return s*s+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}rotateAround(t,s){const e=Math.cos(s),n=Math.sin(s),i=this.x-t.x,h=this.y-t.y;return this.x=i*e-h*n+t.x,this.y=i*n+h*e+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(B.relativeEps(this.x,t),B.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};ot.EMPTY=Object.freeze(new ot(0,0));let C=ot;const at=class at{constructor(t,s,e,n,i,h,r,a,o){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&h!=null&&r!=null&&a!=null&&o!=null&&this.set(t,s,e,n,i,h,r,a,o)}set(t,s,e,n,i,h,r,a,o){const c=this.elements;return c[0]=t,c[1]=n,c[2]=r,c[3]=s,c[4]=i,c[5]=a,c[6]=e,c[7]=h,c[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],this}extractBasis(t,s,e){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,h=e[0],r=e[3],a=e[6],o=e[1],c=e[4],l=e[7],d=e[2],m=e[5],y=e[8],g=n[0],p=n[3],A=n[6],b=n[1],P=n[4],w=n[7],M=n[2],E=n[5],z=n[8];return i[0]=h*g+r*b+a*M,i[3]=h*p+r*P+a*E,i[6]=h*A+r*w+a*z,i[1]=o*g+c*b+l*M,i[4]=o*p+c*P+l*E,i[7]=o*A+c*w+l*z,i[2]=d*g+m*b+y*M,i[5]=d*p+m*P+y*E,i[8]=d*A+m*w+y*z,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],h=t[4],r=t[5],a=t[6],o=t[7],c=t[8];return s*h*c-s*r*o-e*i*c+e*r*a+n*i*o-n*h*a}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],h=t[4],r=t[5],a=t[6],o=t[7],c=t[8],l=c*h-r*o,d=r*a-c*i,m=o*i-h*a,y=s*l+e*d+n*m;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/y;return t[0]=l*g,t[1]=(n*o-c*e)*g,t[2]=(r*e-n*h)*g,t[3]=d*g,t[4]=(c*s-n*a)*g,t[5]=(n*i-r*s)*g,t[6]=m*g,t[7]=(e*a-o*s)*g,t[8]=(h*s-e*i)*g,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t.elements[0]=s[0],t.elements[1]=s[3],t.elements[2]=s[6],t.elements[3]=s[1],t.elements[4]=s[4],t.elements[5]=s[7],t.elements[6]=s[2],t.elements[7]=s[5],t.elements[8]=s[8],this}setUvTransform(t,s,e,n,i,h,r){const a=Math.cos(i),o=Math.sin(i);return this.set(e*a,e*o,-e*(a*h+o*r)+h+t,-n*o,n*a,-n*(-o*h+a*r)+r+s,0,0,1),this}scale(t,s){return this.premultiply(Bt.makeScale(t,s)),this}rotate(t){return this.premultiply(Bt.makeRotation(-t)),this}translate(t,s){return this.premultiply(Bt.makeTranslation(t,s)),this}makeTranslation(t,s){return t instanceof C?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,e,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<9;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<9;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t}clone(){return new at().fromArray(this.elements)}};at.IDENTITY=Object.freeze(new at);let O=at;const Bt=new O,D=1e-6,I=2*Math.PI,ws={x:0,y:0},Et={x:0,y:0,z:0};class It{constructor(){this.equalPointTol=D,this.equalVectorTol=D}equalPoint2d(t,s){return new C(t).sub(s).length()<this.equalPointTol}equalPoint3d(t,s){return new _(t).sub(s).length()<this.equalPointTol}static equalToZero(t,s=D){return t<s&&t>-s}static equal(t,s,e=D){return Math.abs(t-s)<e}static great(t,s,e=D){return t-s>e}static less(t,s,e=D){return t-s<e}}const Rt=new It;function Tt(u,t,s=!1){const e=u.x,n=u.y;let i=!1;const h=t.length;for(let r=0,a=h-1;r<h;a=r++){const o=t[r].x,c=t[r].y,l=t[a].x,d=t[a].y;let m=c>n!=d>n;s&&(m=c>=n!=d>=n),m&&e<(l-o)*(n-c)/(d-c)+o&&(i=!i)}return i}function cs(u,t){if(u.length===0||t.length===0)return!1;const s=new U().setFromPoints(u),e=new U().setFromPoints(t);if(!s.intersectsBox(e))return!1;for(let n=0;n<u.length;){if(Tt(u[n],t,!0))return!0;n<u.length-1&&Rt.equalPoint2d(u[n+1],u[n])&&++n,++n}return!1}const ls={isPointInPolygon:Tt,isPolygonIntersect:cs};function us(u,t){const s=[],e=t-1,n=u;for(let i=0;i<=n;i++)s.push(0);for(let i=1;i<=e-n;i++)s.push(i);for(let i=0;i<=n;i++)s.push(e-n+1);return s}function ds(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let r=1;r<=s;r++){const a=t[r][0]-t[r-1][0],o=t[r][1]-t[r-1][1],c=t[r][2]-t[r-1][2],l=Math.sqrt(a*a+o*o+c*c);i+=l,n.push(i)}const h=[];for(let r=0;r<=e;r++)h.push(0);for(let r=1;r<=s-e;r++){const a=n[r]/i;h.push(a*(s-e+1))}for(let r=0;r<=e;r++)h.push(s-e+1);return h}function ms(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let r=1;r<=s;r++){const a=t[r][0]-t[r-1][0],o=t[r][1]-t[r-1][1],c=t[r][2]-t[r-1][2],l=Math.sqrt(a*a+o*o+c*c),d=Math.sqrt(l);i+=d,n.push(i)}const h=[];for(let r=0;r<=e;r++)h.push(0);for(let r=1;r<=s-e;r++){const a=n[r]/i;h.push(a*(s-e+1))}for(let r=0;r<=e;r++)h.push(s-e+1);return h}function ut(u,t,s,e){if(t===0)return s>=e[u]&&s<e[u+1]?1:0;const n=e[u+t]-e[u],i=e[u+t+1]-e[u+1],h=n>1e-10?(s-e[u])/n:0,r=i>1e-10?(e[u+t+1]-s)/i:0;return h*ut(u,t-1,s,e)+r*ut(u+1,t-1,s,e)}function tt(u,t,s,e,n){const i=e.length-1,h=t;if(u=Math.max(s[h],Math.min(s[i+1],u)),Math.abs(u-s[i+1])<1e-8)return[...e[i]];if(Math.abs(u-s[h])<1e-8)return[...e[0]];const r=[0,0,0];let a=0;for(let o=0;o<=i;o++){const c=ut(o,h,u,s),l=n[o]*c;r[0]+=e[o][0]*l,r[1]+=e[o][1]*l,r[2]+=e[o][2]*l,a+=l}if(a<1e-10){const o=s[s.length-h-1];if(Math.abs(u-o)<1e-8)return[...e[i]];if(Math.abs(u-s[h])<1e-8)return[...e[0]]}return a>1e-10&&(r[0]/=a,r[1]/=a,r[2]/=a),r}function ys(u,t,s,e){const n=u,i=t[n],h=t[t.length-n-1];let r=0;const a=1e3,o=(h-i)/a;let c=tt(i,u,t,s,e);for(let g=1;g<=a;g++){const p=i+g*o,A=tt(p,u,t,s,e),b=A[0]-c[0],P=A[1]-c[1],w=A[2]-c[2];r+=Math.sqrt(b*b+P*P+w*w),c=A}const l=tt(h,u,t,s,e),d=l[0]-c[0],m=l[1]-c[1],y=l[2]-c[2];return r+=Math.sqrt(d*d+m*m+y*y),r}function Ps(u){return u.map(t=>[...t])}class st{constructor(t=0,s=0,e=0,n=1){this._x=t,this._y=s,this._z=e,this._w=n}static slerpFlat(t,s,e,n,i,h,r){let a=e[n+0],o=e[n+1],c=e[n+2],l=e[n+3];const d=i[h+0],m=i[h+1],y=i[h+2],g=i[h+3];if(r===0){t[s+0]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l;return}if(r===1){t[s+0]=d,t[s+1]=m,t[s+2]=y,t[s+3]=g;return}if(l!==g||a!==d||o!==m||c!==y){let p=1-r;const A=a*d+o*m+c*y+l*g,b=A>=0?1:-1,P=1-A*A;if(P>Number.EPSILON){const M=Math.sqrt(P),E=Math.atan2(M,A*b);p=Math.sin(p*E)/M,r=Math.sin(r*E)/M}const w=r*b;if(a=a*p+d*w,o=o*p+m*w,c=c*p+y*w,l=l*p+g*w,p===1-r){const M=1/Math.sqrt(a*a+o*o+c*c+l*l);a*=M,o*=M,c*=M,l*=M}}t[s]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l}static multiplyQuaternionsFlat(t,s,e,n,i,h){const r=e[n],a=e[n+1],o=e[n+2],c=e[n+3],l=i[h],d=i[h+1],m=i[h+2],y=i[h+3];return t[s]=r*y+c*l+a*m-o*d,t[s+1]=a*y+c*d+o*l-r*m,t[s+2]=o*y+c*m+r*d-a*l,t[s+3]=c*y-r*l-a*d-o*m,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,e,n){return this._x=t,this._y=s,this._z=e,this._w=n,this._onChangeCallback(),this}clone(){return new st(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t.x,n=t.y,i=t.z,h=t.order,r=Math.cos,a=Math.sin,o=r(e/2),c=r(n/2),l=r(i/2),d=a(e/2),m=a(n/2),y=a(i/2);switch(h){case"XYZ":this._x=d*c*l+o*m*y,this._y=o*m*l-d*c*y,this._z=o*c*y+d*m*l,this._w=o*c*l-d*m*y;break;case"YXZ":this._x=d*c*l+o*m*y,this._y=o*m*l-d*c*y,this._z=o*c*y-d*m*l,this._w=o*c*l+d*m*y;break;case"ZXY":this._x=d*c*l-o*m*y,this._y=o*m*l+d*c*y,this._z=o*c*y+d*m*l,this._w=o*c*l-d*m*y;break;case"ZYX":this._x=d*c*l-o*m*y,this._y=o*m*l+d*c*y,this._z=o*c*y-d*m*l,this._w=o*c*l+d*m*y;break;case"YZX":this._x=d*c*l+o*m*y,this._y=o*m*l+d*c*y,this._z=o*c*y-d*m*l,this._w=o*c*l-d*m*y;break;case"XZY":this._x=d*c*l-o*m*y,this._y=o*m*l-d*c*y,this._z=o*c*y+d*m*l,this._w=o*c*l+d*m*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return s===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const e=s/2,n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,e=s[0],n=s[4],i=s[8],h=s[1],r=s[5],a=s[9],o=s[2],c=s[6],l=s[10],d=e+r+l;if(d>0){const m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(c-a)*m,this._y=(i-o)*m,this._z=(h-n)*m}else if(e>r&&e>l){const m=2*Math.sqrt(1+e-r-l);this._w=(c-a)/m,this._x=.25*m,this._y=(n+h)/m,this._z=(i+o)/m}else if(r>l){const m=2*Math.sqrt(1+r-e-l);this._w=(i-o)/m,this._x=(n+h)/m,this._y=.25*m,this._z=(a+c)/m}else{const m=2*Math.sqrt(1+l-e-r);this._w=(h-n)/m,this._x=(i+o)/m,this._y=(a+c)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let e=t.dot(s)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=e),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(F(this.dot(t),-1,1)))}rotateTowards(t,s){const e=this.angleTo(t);if(e===0)return this;const n=Math.min(1,s/e);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const e=t._x,n=t._y,i=t._z,h=t._w,r=s._x,a=s._y,o=s._z,c=s._w;return this._x=e*c+h*r+n*o-i*a,this._y=n*c+h*a+i*r-e*o,this._z=i*c+h*o+e*a-n*r,this._w=h*c-e*r-n*a-i*o,this._onChangeCallback(),this}slerp(t,s){if(s===0)return this;if(s===1)return this.copy(t);const e=this._x,n=this._y,i=this._z,h=this._w;let r=h*t._w+e*t._x+n*t._y+i*t._z;if(r<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,r=-r):this.copy(t),r>=1)return this._w=h,this._x=e,this._y=n,this._z=i,this;const a=1-r*r;if(a<=Number.EPSILON){const m=1-s;return this._w=m*h+s*this._w,this._x=m*e+s*this._x,this._y=m*n+s*this._y,this._z=m*i+s*this._z,this.normalize(),this}const o=Math.sqrt(a),c=Math.atan2(o,r),l=Math.sin((1-s)*c)/o,d=Math.sin(s*c)/o;return this._w=h*l+this._w*d,this._x=e*l+this._x*d,this._y=n*l+this._y*d,this._z=i*l+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,s,e){return this.copy(t).slerp(s,e)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(s),i*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const k=class k{constructor(t,s,e){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:i,y:h,z:r}=t;this.x=i,this.y=h,this.z=r||0;return}if(n===3){this.x=t,this.y=s,this.z=e;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}set(t,s,e){return e===void 0&&(e=this.z),this.x=t,this.y=s,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new k(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(xs.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(xs.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[3]*e+i[6]*n,this.y=i[1]*s+i[4]*e+i[7]*n,this.z=i[2]*s+i[5]*e+i[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const s=this.x,e=this.y,n=this.z,i=t.elements,h=1/(i[3]*s+i[7]*e+i[11]*n+i[15]);return this.x=(i[0]*s+i[4]*e+i[8]*n+i[12])*h,this.y=(i[1]*s+i[5]*e+i[9]*n+i[13])*h,this.z=(i[2]*s+i[6]*e+i[10]*n+i[14])*h,this}applyQuaternion(t){const s=this.x,e=this.y,n=this.z,i=t.x,h=t.y,r=t.z,a=t.w,o=2*(h*n-r*e),c=2*(r*s-i*n),l=2*(i*e-h*s);return this.x=s+a*o+h*l-r*c,this.y=e+a*c+r*o-i*l,this.z=n+a*l+i*c-h*o,this}transformDirection(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[4]*e+i[8]*n,this.y=i[1]*s+i[5]*e+i[9]*n,this.z=i[2]*s+i[6]*e+i[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this.z=Math.max(t.z,Math.min(s.z,this.z)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this.z=Math.max(t,Math.min(s,this.z)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const s=this.dot(t),e=this.length(),n=t.length();return Math.abs(s)===e*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this.z=t.z+(s.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const e=t.x,n=t.y,i=t.z,h=s.x,r=s.y,a=s.z;return this.x=n*a-i*r,this.y=i*h-e*a,this.z=e*r-n*h,this}projectOnVector(t){const s=t.lengthSq();if(s===0)return this.set(0,0,0);const e=t.dot(this)/s;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return Nt.copy(this).projectOnVector(t),this.sub(Nt)}reflect(t){return this.sub(Nt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return s*s+e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=e,this.z=n,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,s*4)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,s*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=Math.random()*2-1,e=Math.sqrt(1-s*s);return this.x=e*Math.cos(t),this.y=s,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};k.X_AXIS=Object.freeze(new k(1,0,0)),k.NEGATIVE_X_AXIS=Object.freeze(new k(-1,0,0)),k.Y_AXIS=Object.freeze(new k(0,1,0)),k.NEGATIVE_Y_AXIS=Object.freeze(new k(0,-1,0)),k.Z_AXIS=Object.freeze(new k(0,0,1)),k.NEGATIVE_Z_AXIS=Object.freeze(new k(0,0,-1));let _=k;const Nt=new _,xs=new st,ct=class ct{constructor(t,s,e,n,i,h,r,a,o,c,l,d,m,y,g,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&h!=null&&r!=null&&a!=null&&o!=null&&c!=null&&l!=null&&d!=null&&m!=null&&y!=null&&g!=null&&p!=null&&this.set(t,s,e,n,i,h,r,a,o,c,l,d,m,y,g,p)}set(t,s,e,n,i,h,r,a,o,c,l,d,m,y,g,p){const A=this.elements;return A[0]=t,A[4]=s,A[8]=e,A[12]=n,A[1]=i,A[5]=h,A[9]=r,A[13]=a,A[2]=o,A[6]=c,A[10]=l,A[14]=d,A[3]=m,A[7]=y,A[11]=g,A[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ct().fromArray(this.elements)}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],this}copyPosition(t){const s=this.elements,e=t.elements;return s[12]=e[12],s[13]=e[13],s[14]=e[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Rt.equalPoint3d(t,_.Z_AXIS))this.identity();else{const s=new _(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?s.crossVectors(_.Y_AXIS,t).normalize():s.crossVectors(_.Z_AXIS,t).normalize();const e=t.clone().cross(s).normalize();this.set(s.x,s.y,s.z,0,e.x,e.y,e.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,s,e){return t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}makeBasis(t,s,e){return this.set(t.x,s.x,e.x,0,t.y,s.y,e.y,0,t.z,s.z,e.z,0,0,0,0,1),this}extractRotation(t){const s=this.elements,e=t.elements,n=1/K.setFromMatrixColumn(t,0).length(),i=1/K.setFromMatrixColumn(t,1).length(),h=1/K.setFromMatrixColumn(t,2).length();return s[0]=e[0]*n,s[1]=e[1]*n,s[2]=e[2]*n,s[3]=0,s[4]=e[4]*i,s[5]=e[5]*i,s[6]=e[6]*i,s[7]=0,s[8]=e[8]*h,s[9]=e[9]*h,s[10]=e[10]*h,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(bs,t,Cs)}lookAt(t,s,e){const n=this.elements;return L.subVectors(t,s),L.lengthSq()===0&&(L.z=1),L.normalize(),X.crossVectors(e,L),X.lengthSq()===0&&(Math.abs(e.z)===1?L.x+=1e-4:L.z+=1e-4,L.normalize(),X.crossVectors(e,L)),X.normalize(),dt.crossVectors(L,X),n[0]=X.x,n[4]=dt.x,n[8]=L.x,n[1]=X.y,n[5]=dt.y,n[9]=L.y,n[2]=X.z,n[6]=dt.z,n[10]=L.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,h=e[0],r=e[4],a=e[8],o=e[12],c=e[1],l=e[5],d=e[9],m=e[13],y=e[2],g=e[6],p=e[10],A=e[14],b=e[3],P=e[7],w=e[11],M=e[15],E=n[0],z=n[4],T=n[8],$=n[12],W=n[1],Z=n[5],J=n[9],yt=n[13],xt=n[2],gt=n[6],_t=n[10],pt=n[14],At=n[3],zt=n[7],Mt=n[11],ft=n[15];return i[0]=h*E+r*W+a*xt+o*At,i[4]=h*z+r*Z+a*gt+o*zt,i[8]=h*T+r*J+a*_t+o*Mt,i[12]=h*$+r*yt+a*pt+o*ft,i[1]=c*E+l*W+d*xt+m*At,i[5]=c*z+l*Z+d*gt+m*zt,i[9]=c*T+l*J+d*_t+m*Mt,i[13]=c*$+l*yt+d*pt+m*ft,i[2]=y*E+g*W+p*xt+A*At,i[6]=y*z+g*Z+p*gt+A*zt,i[10]=y*T+g*J+p*_t+A*Mt,i[14]=y*$+g*yt+p*pt+A*ft,i[3]=b*E+P*W+w*xt+M*At,i[7]=b*z+P*Z+w*gt+M*zt,i[11]=b*T+P*J+w*_t+M*Mt,i[15]=b*$+P*yt+w*pt+M*ft,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[4],n=t[8],i=t[12],h=t[1],r=t[5],a=t[9],o=t[13],c=t[2],l=t[6],d=t[10],m=t[14],y=t[3],g=t[7],p=t[11],A=t[15];return y*(+i*a*l-n*o*l-i*r*d+e*o*d+n*r*m-e*a*m)+g*(+s*a*m-s*o*d+i*h*d-n*h*m+n*o*c-i*a*c)+p*(+s*o*l-s*r*m-i*h*l+e*h*m+i*r*c-e*o*c)+A*(-n*r*c-s*a*l+s*r*d+n*h*l-e*h*d+e*a*c)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,e){const n=this.elements;return t instanceof _?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=s,n[14]=e),this}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],h=t[4],r=t[5],a=t[6],o=t[7],c=t[8],l=t[9],d=t[10],m=t[11],y=t[12],g=t[13],p=t[14],A=t[15],b=l*p*o-g*d*o+g*a*m-r*p*m-l*a*A+r*d*A,P=y*d*o-c*p*o-y*a*m+h*p*m+c*a*A-h*d*A,w=c*g*o-y*l*o+y*r*m-h*g*m-c*r*A+h*l*A,M=y*l*a-c*g*a-y*r*d+h*g*d+c*r*p-h*l*p,E=s*b+e*P+n*w+i*M;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/E;return t[0]=b*z,t[1]=(g*d*i-l*p*i-g*n*m+e*p*m+l*n*A-e*d*A)*z,t[2]=(r*p*i-g*a*i+g*n*o-e*p*o-r*n*A+e*a*A)*z,t[3]=(l*a*i-r*d*i-l*n*o+e*d*o+r*n*m-e*a*m)*z,t[4]=P*z,t[5]=(c*p*i-y*d*i+y*n*m-s*p*m-c*n*A+s*d*A)*z,t[6]=(y*a*i-h*p*i-y*n*o+s*p*o+h*n*A-s*a*A)*z,t[7]=(h*d*i-c*a*i+c*n*o-s*d*o-h*n*m+s*a*m)*z,t[8]=w*z,t[9]=(y*l*i-c*g*i-y*e*m+s*g*m+c*e*A-s*l*A)*z,t[10]=(h*g*i-y*r*i+y*e*o-s*g*o-h*e*A+s*r*A)*z,t[11]=(c*r*i-h*l*i-c*e*o+s*l*o+h*e*m-s*r*m)*z,t[12]=M*z,t[13]=(c*g*n-y*l*n+y*e*d-s*g*d-c*e*p+s*l*p)*z,t[14]=(y*r*n-h*g*n-y*e*a+s*g*a+h*e*p-s*r*p)*z,t[15]=(h*l*n-c*r*n+c*e*a-s*l*a-h*e*d+s*r*d)*z,this}scale(t){const s=this.elements,e=t.x,n=t.y,i=t.z;return s[0]*=e,s[4]*=n,s[8]*=i,s[1]*=e,s[5]*=n,s[9]*=i,s[2]*=e,s[6]*=n,s[10]*=i,s[3]*=e,s[7]*=n,s[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,e,n))}makeTranslation(t,s,e){return t instanceof _?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,e,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,s,-e,0,0,e,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,0,e,0,0,1,0,0,-e,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,0,e,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const e=Math.cos(s),n=Math.sin(s),i=1-e,h=t.x,r=t.y,a=t.z,o=i*h,c=i*r;return this.set(o*h+e,o*r-n*a,o*a+n*r,0,o*r+n*a,c*r+e,c*a-n*h,0,o*a-n*r,c*a+n*h,i*a*a+e,0,0,0,0,1),this}makeScale(t,s,e){return this.set(t,0,0,0,0,s,0,0,0,0,e,0,0,0,0,1),this}makeShear(t,s,e,n,i,h){return this.set(1,e,i,0,t,1,h,0,s,n,1,0,0,0,0,1),this}compose(t,s,e){const n=this.elements,i=s.x,h=s.y,r=s.z,a=s.w,o=i+i,c=h+h,l=r+r,d=i*o,m=i*c,y=i*l,g=h*c,p=h*l,A=r*l,b=a*o,P=a*c,w=a*l,M=e.x,E=e.y,z=e.z;return n[0]=(1-(g+A))*M,n[1]=(m+w)*M,n[2]=(y-P)*M,n[3]=0,n[4]=(m-w)*E,n[5]=(1-(d+A))*E,n[6]=(p+b)*E,n[7]=0,n[8]=(y+P)*z,n[9]=(p-b)*z,n[10]=(1-(d+g))*z,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,s,e){const n=this.elements;let i=K.set(n[0],n[1],n[2]).length();const h=K.set(n[4],n[5],n[6]).length(),r=K.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],q.copy(this);const o=1/i,c=1/h,l=1/r;return q.elements[0]*=o,q.elements[1]*=o,q.elements[2]*=o,q.elements[4]*=c,q.elements[5]*=c,q.elements[6]*=c,q.elements[8]*=l,q.elements[9]*=l,q.elements[10]*=l,s.setFromRotationMatrix(q),e.x=i,e.y=h,e.z=r,this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<16;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<16;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t[s+9]=e[9],t[s+10]=e[10],t[s+11]=e[11],t[s+12]=e[12],t[s+13]=e[13],t[s+14]=e[14],t[s+15]=e[15],t}};ct.IDENTITY=Object.freeze(new ct);let Q=ct;const K=new _,q=new Q,bs=new _(0,0,0),Cs=new _(1,1,1),X=new _,dt=new _,L=new _;class j{constructor(t=void 0,s=void 0){this.min=t==null?new _(1/0,1/0,1/0):new _(t.x,t.y,t.z),this.max=s==null?new _(-1/0,-1/0,-1/0):new _(s.x,s.y,s.z)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromArray(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s+=3)this.expandByPoint(kt.fromArray(t,s));return this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=kt.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new j().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let s,e;return t.normal.x>0?(s=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(s=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(s+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(s+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(s+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(s+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),s<=-t.constant&&e>=-t.constant}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,kt).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(G[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),G[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),G[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),G[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),G[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),G[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),G[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),G[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(G),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const G=[new _,new _,new _,new _,new _,new _,new _,new _],kt=new _,gs=new C;class U{constructor(t=void 0,s=void 0){this.min=t==null?new C(1/0,1/0):new C(t.x,t.y),this.max=s==null?new C(-1/0,-1/0):new C(s.x,s.y)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=gs.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new U().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new C(0,0):new C(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new C(0,0):new C(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,gs).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const _s=new _,Ss=new _,Bs=new O;class et{constructor(t=new _(1,0,0),s=0){this.normal=t,this.constant=s}set(t,s){return this.normal.copy(t),this.constant=s,this}setComponents(t,s,e,n){return this.normal.set(t,s,e),this.constant=n,this}setFromNormalAndCoplanarPoint(t,s){return this.normal.copy(t),this.constant=-s.dot(this.normal),this}setFromCoplanarPoints(t,s,e){const n=_s.subVectors(e,s).cross(Ss.subVectors(t,s)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,s){return s.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,s){const e=s||Bs.getNormalMatrix(t),n=this.coplanarPoint(_s).applyMatrix3d(t),i=this.normal.applyMatrix3(e).normalize();return this.constant=-n.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new et().copy(this)}}class S extends C{static pointArrayToNumberArray(t){const s=new Array(t.length*2);return t.forEach((e,n)=>{e.toArray(s,n*2)}),s}}class f extends _{static pointArrayToNumberArray(t,s=!0){const e=s?3:2,n=new Array(t.length*e);return t.forEach((i,h)=>{i.toArray(n,h*e)}),n}}const ps=new Q,As=new st,lt=class lt{constructor(t=0,s=0,e=0,n=lt.DEFAULT_ORDER){this._x=t,this._y=s,this._z=e,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,s,e,n=this._order){return this._x=t,this._y=s,this._z=e,this._order=n,this._onChangeCallback(),this}clone(){return new lt(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,s=this._order,e=!0){const n=t.elements,i=n[0],h=n[4],r=n[8],a=n[1],o=n[5],c=n[9],l=n[2],d=n[6],m=n[10];switch(s){case"XYZ":this._y=Math.asin(F(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(-c,m),this._z=Math.atan2(-h,i)):(this._x=Math.atan2(d,o),this._z=0);break;case"YXZ":this._x=Math.asin(-F(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(r,m),this._z=Math.atan2(a,o)):(this._y=Math.atan2(-l,i),this._z=0);break;case"ZXY":this._x=Math.asin(F(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-l,m),this._z=Math.atan2(-h,o)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-F(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-h,o));break;case"YZX":this._z=Math.asin(F(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,o),this._y=Math.atan2(-l,i)):(this._x=0,this._y=Math.atan2(r,m));break;case"XZY":this._z=Math.asin(-F(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,o),this._y=Math.atan2(r,i)):(this._x=Math.atan2(-c,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+s)}return this._order=s,e===!0&&this._onChangeCallback(),this}setFromQuaternion(t,s,e=!0){return ps.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ps,s,e)}setFromVector3(t,s=this._order){return this.set(t.x,t.y,t.z,s)}reorder(t){return As.setFromEuler(this),this.setFromQuaternion(As,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};lt.DEFAULT_ORDER="XYZ";let Lt=lt;class zs{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ut extends zs{translate(t){return this.transform(new O().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Es extends Ut{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new U}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const s=[];for(let e=0;e<this.loops.length;++e){const i=this.loops[e].getPoints(t);s.push(i)}return s}buildHierarchy(){var r;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),e=this.sortBoundaryBoxesByAreas(s),n=new Map,i=e.length;for(let a=0;a<i;a++)n.set(e[a],{index:e[a],children:[]});const h={index:-1,children:[]};for(let a=0;a<i;a++){const o=e[a],c=t[o],l=s[o];let d=a+1;for(;d<i;d++){const m=e[d],y=t[m];if(s[m].containsBox(l)&&ls.isPointInPolygon(c[B.randInt(0,c.length-1)],y)){(r=n.get(m))==null||r.children.push(n.get(o));break}}d===i&&h.children.push(n.get(o))}return h}calculateBoundaryBoxes(t){const s=[];return t.forEach(e=>{s.push(new U().setFromPoints(e))}),s}sortBoundaryBoxesByAreas(t){const s=[];t.forEach((n,i)=>{const h=n.size,r=h.width*h.height;s.push({area:r,index:i})}),s.sort((n,i)=>n.area-i.area);const e=[];return s.forEach(n=>{e.push(n.index)}),e}}class H extends Ut{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const s=this.getUtoTmapping(t);return this.getPoint(s)}getPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}getSpacedPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPointAt(e/t));return s}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const s=[];let e,n=this.getPoint(0),i=0;s.push(0);for(let h=1;h<=t;h++)e=this.getPoint(h/t),i+=e.distanceTo(n),s.push(i),n=e;return s}getUtoTmapping(t,s){const e=this.getLengths();let n=0;const i=e.length;let h;s?h=s:h=t*e[i-1];let r=0,a=i-1,o;for(;r<=a;)if(n=Math.floor(r+(a-r)/2),o=e[n]-h,o<0)r=n+1;else if(o>0)a=n-1;else{a=n;break}if(n=a,e[n]===h)return n/(i-1);const c=e[n],d=e[n+1]-c,m=(h-c)/d;return(n+m)/(i-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const i=this.getPoint(e),h=this.getPoint(n),r=new S;return r.copy(h).sub(i).normalize(),r}getTangentAt(t){const s=this.getUtoTmapping(t);return this.getTangent(s)}}class nt extends H{constructor(t,s,e,n,i){super();const h=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(i!==void 0);if(h==3)typeof t=="object"&&typeof s=="object"&&typeof e=="object"?this.createByThreePoints(t,s,e):this.createByStartEndPointsAndBulge(t,s,e);else if(h==5){const r=t;this.center=new S(r.x,r.y),this.radius=s,this.startAngle=e,this.endAngle=n,this.clockwise=i}else throw N.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(t,s,e){const n=(z,T)=>({x:(z.x+T.x)/2,y:(z.y+T.y)/2}),i=(z,T)=>(T.y-z.y)/(T.x-z.x),h=z=>-1/z,r=n(t,s),a=n(s,e),o=i(t,s),c=i(s,e),l=h(o),d=h(c),m=(z,T,$,W)=>{const Z=(W-T)/(z-$),J=z*Z+T;return{x:Z,y:J}},y=r.y-l*r.x,g=a.y-d*a.x,p=m(l,y,d,g),A=Math.sqrt(Math.pow(t.x-p.x,2)+Math.pow(t.y-p.y,2)),b=(z,T)=>Math.atan2(z.y-T.y,z.x-T.x),P=b(t,p),w=b(s,p),M=b(e,p),E=M>P&&M<w||P>M&&P<w||w>M&&w<P;this.center=p,this.radius=A,this.startAngle=P,this.endAngle=M,this.clockwise=!E}createByStartEndPointsAndBulge(t,s,e){let n,i,h;e<0?(n=Math.atan(-e)*4,i=new C(t),h=new C(s)):(n=Math.atan(e)*4,i=new C(s),h=new C(t));const r=new C().subVectors(h,i),a=r.length(),o=new C().addVectors(i,r.multiplyScalar(.5)),c=Math.abs(a/2/Math.tan(n/2)),l=r.normalize();let d;if(n<Math.PI){const m=new C(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));d=o.add(m.multiplyScalar(-c))}else{const m=new C(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));d=o.add(m.multiplyScalar(c))}e<0?(this.startAngle=Math.atan2(i.y-d.y,i.x-d.x),this.endAngle=Math.atan2(h.y-d.y,h.x-d.x)):(this.startAngle=Math.atan2(h.y-d.y,h.x-d.x),this.endAngle=Math.atan2(i.y-d.y,i.x-d.x)),this.clockwise=e<0,this.center=d,this.radius=h.sub(d).length()}get center(){return this._center}set center(t){this._center=new S(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?B.normalizeAngle(this.startAngle-this.endAngle):B.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=B.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of s)B.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(i));const e=t.map(i=>i.x),n=t.map(i=>i.y);return new U(new S(Math.min(...e),Math.min(...n)),new S(Math.max(...e),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new nt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const s=this.center.x+this.radius*Math.cos(t),e=this.center.y+this.radius*Math.sin(t);return new S(s,e)}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;if(this.closed&&(e=I,n=0),this.clockwise)for(let i=0;i<=t;i++){const h=n-e*(i/t),r=this.getPointAtAngle(h);s.push(new S(r.x,r.y))}else for(let i=0;i<=t;i++){const h=n+e*(i/t),r=this.getPointAtAngle(h);s.push(new S(r.x,r.y))}return s}}class Is extends zs{translate(t){return this.transform(new Q().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class it extends Is{}class rt extends it{constructor(t,s){super(),this._start=new f(t),this._end=new f(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new _().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new f((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,s){return this.delta(s).multiplyScalar(t).add(this._start)}atLength(t,s=!1){if(s){const e=this.delta(Y).normalize();return new f(this._start).addScaledVector(e,t)}else{const e=this.delta(Y).normalize();return new f(this._end).addScaledVector(e,t)}}extend(t,s=!1){if(s){const e=Y.subVectors(this._start,this._end).normalize();this._start=new f(this._start).addScaledVector(e,t)}else{const e=this.delta(Y).normalize();this._end=new f(this._end).addScaledVector(e,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,s){Ms.subVectors(t,this._start),mt.subVectors(this.endPoint,this.startPoint);const e=mt.dot(mt);let i=mt.dot(Ms)/e;return s&&(i=B.clamp(i,0,1)),i}closestPointToPoint(t,s,e){const n=this.closestPointToPointParameter(t,s);return this.delta(e).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const s=this.direction,n=Y.subVectors(t,this.startPoint).dot(s);return new f().copy(s).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const s=this.direction,e=this.startPoint,i=Y.subVectors(t,e).dot(s),h=Y.copy(s).multiplyScalar(i);return new f().addVectors(e,h)}calculateBoundingBox(){const t=new f(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),s=new f(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new j(t,s)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new rt(this._start.clone(),this._end.clone())}}const Y=new _,Ms=new _,mt=new _;class ht extends it{static computeCenterPoint(t,s,e){const n=new _().addVectors(t,s).multiplyScalar(.5),i=new _().addVectors(t,e).multiplyScalar(.5),h=new _().subVectors(s,t),r=new _().subVectors(e,t),a=new _().crossVectors(h,r).normalize();if(a.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const o=new _().crossVectors(h,a).normalize(),c=new _().crossVectors(r,a).normalize(),l=o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=new rt(n,n.clone().add(l)),y=new rt(i,i.clone().add(d)),g=new _;return m.closestPointToPoint(y.startPoint,!0,g)?g:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,s,e){const n=ht.computeCenterPoint(t,s,e);if(n){const i=n.distanceTo(t),h=new _().subVectors(t,n),r=new _().subVectors(s,n),a=Math.atan2(h.y,h.x),o=Math.atan2(r.y,r.x);return new ht(n,i,a,o,_.Z_AXIS)}}constructor(t,s,e,n,i,h=_.X_AXIS){super(),this.center=t,this.radius=s,this.startAngle=e,this.endAngle=n,this.normal=i,this.refVec=h,(n-e)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=e,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new f(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return B.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new _(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)B.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,h=-1/0,r=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>h&&(h=o.y),o.z>r&&(r=o.z)}return new j({x:s,y:e,z:n},{x:i,y:h,z:r})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const h=n+e*(i/t),r=this.getPointAtAngle(h);s.push(r)}return s}transform(t){const s=qt.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),e=qt.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),s.applyMatrix3d(t),e.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(s),this.endAngle=this.getAngle(e),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ht(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(qt.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const s=this.normal,e=this.refVec,n={x:s.y*e.z-s.z*e.y,y:s.z*e.x-s.x*e.z,z:s.x*e.y-s.y*e.x},i=this.center,h=this.radius;return new f(i.x+h*(e.x*Math.cos(t)+n.x*Math.sin(t)),i.y+h*(e.y*Math.cos(t)+n.y*Math.sin(t)),i.z+h*(e.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new _(this.center).distanceTo(Et);return new et(this.normal,t)}}const qt=new _;class Vt extends H{constructor(t,s,e,n=0,i=I,h=!1,r=0){super(),this.center=t,this.majorAxisRadius=s,this.minorAxisRadius=e,(i-n)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=n,this.endAngle=i),this.clockwise=h,this.rotation=r}get center(){return this._center}set center(t){this._center=new f(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return B.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let s=1/0,e=1/0,n=-1/0,i=-1/0;for(let h=0;h<=100;h++){const r=this.getPoint(h/100);s=Math.min(s,r.x),e=Math.min(e,r.y),n=Math.max(n,r.x),i=Math.max(i,r.y)}return new U({x:s,y:e},{x:n,y:i})}get closed(){return this.deltaAngle==0}getPoint(t){const s=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;for(;e<0;)e+=s;for(;e>s;)e-=s;e<Number.EPSILON&&(n?e=0:e=s),this.clockwise===!0&&!n&&(e===s?e=-s:e=e-s);const i=this.startAngle+t*e;let h=this.center.x+this.majorAxisRadius*Math.cos(i),r=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const a=Math.cos(this.rotation),o=Math.sin(this.rotation),c=h-this.center.x,l=r-this.center.y;h=c*a-l*o+this.center.x,r=c*o+l*a+this.center.y}return new S(h,r)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new Vt(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class jt extends it{constructor(t,s,e,n,i,h=0,r=I){super(),this.center=t,this.normal=s,this.majorAxis=e,this.majorAxisRadius=n,this.minorAxisRadius=i;const a=Math.abs(r-h);Math.abs(a-I)<1e-10||Math.abs(a-2*I)<1e-10?(this.startAngle=0,this.endAngle=I):(this.startAngle=h,this.endAngle=r)}get center(){return this._center}set center(t){this._center=new f(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:B.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-I)<1e-10?I:B.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new _(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new _().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return It.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,s=this.deltaAngle/t;let e=0,n=this.getPointAtAngle(this.startAngle);for(let i=1;i<=t;i++){const h=this.startAngle+i*s,r=this.getPointAtAngle(h),a=r.x-n.x,o=r.y-n.y,c=r.z-n.z;e+=Math.sqrt(a*a+o*o+c*c),n=r}return e}calculateBoundingBox(){if(this.majorAxis.equals(_.X_AXIS)||this.majorAxis.equals(_.Y_AXIS)||this.majorAxis.isParallelTo(_.X_AXIS)||this.majorAxis.isParallelTo(_.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)B.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,h=-1/0,r=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>h&&(h=o.y),o.z>r&&(r=o.z)}return new j({x:s,y:e,z:n},{x:i,y:h,z:r})}else{let s=1/0,e=1/0,n=1/0,i=-1/0,h=-1/0,r=-1/0;for(let a=0;a<=100;a++){const o=this.startAngle+this.deltaAngle*(a/100),c=this.getPointAtAngle(o);s=Math.min(s,c.x),e=Math.min(e,c.y),n=Math.min(n,c.z),i=Math.max(i,c.x),h=Math.max(h,c.y),r=Math.max(r,c.z)}return new j({x:s,y:e,z:n},{x:i,y:h,z:r})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const h=n+e*(i/t),r=this.getPointAtAngle(h);s.push(r)}return s}getPointAtAngle(t){const s=Math.cos(t),e=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e),i=this.majorAxis.clone().multiplyScalar(s*this.majorAxisRadius).add(n);return new f(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const s=new _(t).sub(this.center),e=s.dot(this.majorAxis),n=s.dot(this.minorAxis),i=e/this.majorAxisRadius,h=n/this.minorAxisRadius;return i*i+h*h<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new jt(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new _(this.center).distanceTo(Et);return new et(this.normal,t)}}class Rs extends H{constructor(t=null,s=!1){super(),this._vertices=t||new Array,this._closed=s}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const s=this._vertices[0];return new S(s.x,s.y)}else{const s=this._vertices[t-1];return new S(s.x,s.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const s=this._vertices.length;for(let e=0;e<s;++e){const n=this._vertices[e];let i=null;if(e<s-1?i=this._vertices[e+1]:e==s-1&&this.closed&&(i=this._vertices[0]),i)if(n.bulge){const h=new nt(n,i,n.bulge);t+=h.length}else t+=new S(n.x,n.y).distanceTo(i)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,s){t<=0?this._vertices.unshift(s):this._vertices.splice(t,0,s),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const s=this._vertices[t];return new S(s.x,s.y)}calculateBoundingBox(){const t=this.getPoints(100);return new U().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,s){const e=[];return this.getPoints(t).forEach(i=>e.push(new f().set(i.x,i.y,s))),e}getPoints(t){const s=[],e=this._vertices.length;for(let n=0;n<e;++n){const i=this._vertices[n];if(i.bulge){let h=null;if(n<e-1?h=this._vertices[n+1]:n==e-1&&this.closed&&(h=this._vertices[0]),h){const a=new nt(i,h,i.bulge).getPoints(t),o=a.length;for(let c=0;c<o;++c){const l=a[c];s.push(new S(l.x,l.y))}}}else s.push(new S(i.x,i.y)),n==e-1&&this.closed&&s.push(s[0])}return s}}class Ft extends H{constructor(t,s){super(),this._start=new S(t),this._end=new S(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new S(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),s=new S(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new U(t,s)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ft(this._start.clone(),this._end.clone())}}class Ts extends H{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(s=>{t+=s.length}),t}calculateBoundingBox(){const t=this.getPoints(100),s=new U;return s.setFromPoints(t),s}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const s=[];return this.curves.forEach(e=>{e.getPoints(t).forEach(n=>{s.push(new S(n.x,n.y))})}),s}}class Gt{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,s,e,n){this.c0=t,this.c1=e,this.c2=-3*t+3*s-2*e-n,this.c3=2*t-2*s+e+n}initCatmullRom(t,s,e,n,i){this.init(s,e,i*(e-t),i*(n-s))}initNonuniformCatmullRom(t,s,e,n,i,h,r){let a=(s-t)/i-(e-t)/(i+h)+(e-s)/h,o=(e-s)/h-(n-s)/(h+r)+(n-e)/r;a*=h,o*=h,this.init(s,e,a,o)}calc(t){const s=t*t,e=s*t;return this.c0+this.c1*t+this.c2*s+this.c3*e}}class fs extends it{constructor(t=[],s=!1,e="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new _,this._px=new Gt,this._py=new Gt,this._pz=new Gt,this._points=t.map(i=>new f(i)),this._closed=s,this._curveType=e,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new f}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new f}get length(){if(this._points.length<2)return 0;let t=0;for(let s=1;s<this._points.length;s++)t+=this._points[s-1].distanceTo(this._points[s]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,s=new f){const e=s,n=this._points,i=n.length;if(i===0)return e.set(0,0,0);if(i===1)return e.copy(n[0]);const h=(i-(this._closed?0:1))*t;let r=Math.floor(h),a=h-r;this._closed?r+=r>0?0:(Math.floor(Math.abs(r)/i)+1)*i:a===0&&r===i-1&&(r=i-2,a=1);let o,c;this._closed||r>0?o=n[(r-1)%i]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),o=new f(this._tmp.x,this._tmp.y,this._tmp.z));const l=n[r%i],d=n[(r+1)%i];if(this._closed||r+2<i?c=n[(r+2)%i]:(this._tmp.subVectors(n[i-1],n[i-2]).add(n[i-1]),c=new f(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const m=this._curveType==="chordal"?.5:.25;let y=Math.pow(o.distanceToSquared(l),m),g=Math.pow(l.distanceToSquared(d),m),p=Math.pow(d.distanceToSquared(c),m);g<1e-4&&(g=1),y<1e-4&&(y=g),p<1e-4&&(p=g),this._px.initNonuniformCatmullRom(o.x,l.x,d.x,c.x,y,g,p),this._py.initNonuniformCatmullRom(o.y,l.y,d.y,c.y,y,g,p),this._pz.initNonuniformCatmullRom(o.z,l.z,d.z,c.z,y,g,p)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(o.x,l.x,d.x,c.x,this._tension),this._py.initCatmullRom(o.y,l.y,d.y,c.y,this._tension),this._pz.initCatmullRom(o.z,l.z,d.z,c.z,this._tension));return e.set(this._px.calc(a),this._py.calc(a),this._pz.calc(a)),e}getPoints(t){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}setPoints(t){this._points=t.map(s=>new f(s)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(s=>{const e=new f;return e.copy(s),e.applyMatrix3d(t),e}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new j;const t=new j;return this._points.forEach(s=>{t.expandByPoint(s)}),t}}class V{constructor(t,s,e,n){this._degree=t,this._knots=[...s],this._controlPoints=e.map(i=>({x:i.x,y:i.y,z:i.z})),this._weights=n?[...n]:new Array(e.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const s=this._controlPoints.map(e=>[e.x,e.y,e.z]);return tt(t,this._degree,this._knots,s,this._weights)}length(){const t=this._controlPoints.map(s=>[s.x,s.y,s.z]);return ys(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,s,e,n){return new V(t,s,e,n)}static byPoints(t,s,e="Uniform"){let n;switch(e){case"Chord":n=ds(s,t);break;case"SqrtChord":n=ms(s,t);break;case"Uniform":default:n=us(s,t.length);break}const i=t.map(r=>({x:r[0],y:r[1],z:r[2]})),h=new Array(i.length).fill(1);return new V(s,n,i,h)}getParameterRange(){const t=this._knots[this._degree],s=this._knots[this._knots.length-this._degree-1];return{start:t,end:s}}getPoints(t){const s=[],{start:e,end:n}=this.getParameterRange();for(let i=0;i<=t;i++){const h=e+(n-e)*(i/t);s.push(this.point(h))}return s}isClosed(t=1e-6){const{start:s,end:e}=this.getParameterRange(),n=this.point(s),i=this.point(e),h=n[0]-i[0],r=n[1]-i[1],a=n[2]-i[2];return Math.sqrt(h*h+r*r+a*a)<t}static createClosedCurve(t,s,e="Chord"){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const n=new fs(t,!0,"centripetal"),i=Math.max(50,t.length*2),r=n.getPoints(i).map(a=>[a.x,a.y,a.z]);return V.byPoints(r,s,e)}}class Xt extends it{constructor(t,s,e,n,i){super();const h=arguments.length;if(h<2||h>5)throw N.AcCmErrors.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(s)){this._controlPoints=t;let r,a=3,o=!1;if(h>=3&&(Array.isArray(e)?(r=e,h>=4&&(a=n||3),h>=5&&(o=i)):e!==void 0&&(a=e||3,h>=4&&(o=n))),e===void 0&&h>=4&&(a=n||3,h>=5&&(o=i)),this._degree=a,this._closed=o,this._controlPoints.length<this._degree+1)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._nurbsCurve=V.byKnotsControlPointsWeights(this._degree,s,this._controlPoints,r)}else{if(this._fitPoints=t,this._knotParameterization=s,h>=3&&(this._degree=e||3),h>=4&&(this._closed=n),this._fitPoints.length<this._degree+1)throw N.AcCmErrors.ILLEGAL_PARAMETERS;const r=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=V.byPoints(r,this._degree,this._knotParameterization),this._controlPoints=this._nurbsCurve.controlPoints()}this._closed&&this.buildCurve()}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed)this._nurbsCurve=V.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=V.byPoints(t,this._degree,this._knotParameterization)}this._controlPoints=this._nurbsCurve.controlPoints()}else if(this._controlPoints)if(this._closed){const t=this._knotParameterization||"Chord";this._nurbsCurve=V.createClosedCurve(this._controlPoints,this._degree,t),this._controlPoints=this._nurbsCurve.controlPoints()}else{const t=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=V.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,s)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[s],n=this._nurbsCurve.point(e);return new f(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[t.length-s-1],n=this._nurbsCurve.point(e);return new f(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const s=this._fitPoints.length,e=t<0||t>=s?s-1:t,n=this._fitPoints[e];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const s=this._controlPoints.length,e=t<0||t>=s?s-1:t;return this._controlPoints[e]}getPoints(t=100){const s=this._nurbsCurve,e=[],n=s.knots(),i=this._nurbsCurve.degree(),h=n[i],r=n[n.length-i-1],a=(r-h)/(t-1);for(let o=0;o<t;o++){const c=o===t-1?r:h+o*a,l=s.point(c);e.push(new f(l[0],l[1],l[2]))}return e}getCurvePoints(t,s){const e=[],n=t.knots(),i=n[3],r=(n[n.length-4]-i)/(s-1);for(let a=0;a<s;a++){const o=i+a*r;e.push(t.point(o))}return e}calculateBoundingBox(){const t=this.getPoints(100);return new j().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]=[e.x,e.y,e.z||0]}),s}static createClosedSpline(t,s="Uniform",e=3){if(t.length<e+1)throw new Error(`At least ${e+1} points are required for a degree ${e} closed spline`);return new Xt(t,s,e,!0)}}x.AcGeArea2d=Es,x.AcGeBox2d=U,x.AcGeBox3d=j,x.AcGeCatmullRomCurve3d=fs,x.AcGeCircArc2d=nt,x.AcGeCircArc3d=ht,x.AcGeCurve2d=H,x.AcGeEllipseArc2d=Vt,x.AcGeEllipseArc3d=jt,x.AcGeEuler=Lt,x.AcGeGeometryUtil=ls,x.AcGeLine2d=Ft,x.AcGeLine3d=rt,x.AcGeLoop2d=Ts,x.AcGeMathUtil=B,x.AcGeMatrix2d=O,x.AcGeMatrix3d=Q,x.AcGeNurbsCurve=V,x.AcGePlane=et,x.AcGePoint2d=S,x.AcGePoint3d=f,x.AcGePolyline2d=Rs,x.AcGeQuaternion=st,x.AcGeShape2d=Ut,x.AcGeSpline3d=Xt,x.AcGeTol=It,x.AcGeVector2d=C,x.AcGeVector3d=_,x.DEFAULT_TOL=Rt,x.DEG2RAD=wt,x.FLOAT_TOL=D,x.ORIGIN_POINT_2D=ws,x.ORIGIN_POINT_3D=Et,x.RAD2DEG=Pt,x.TAU=I,x.basisFunction=ut,x.calculateCurveLength=ys,x.ceilPowerOfTwo=is,x.clamp=F,x.damp=Qt,x.degToRad=ss,x.euclideanModulo=bt,x.evaluateNurbsPoint=tt,x.floorPowerOfTwo=rs,x.generateChordKnots=ds,x.generateSqrtChordKnots=ms,x.generateUUID=Yt,x.generateUniformKnots=us,x.intPartLength=St,x.interpolateControlPoints=Ps,x.inverseLerp=Ot,x.isBetween=hs,x.isBetweenAngle=os,x.isPointInPolygon=Tt,x.isPolygonIntersect=cs,x.isPowerOfTwo=ns,x.lerp=Ct,x.mapLinear=Zt,x.normalizeAngle=v,x.pingpong=Kt,x.radToDeg=es,x.randFloat=Jt,x.randFloatSpread=vt,x.randInt=Wt,x.relativeEps=as,x.seededRandom=ts,x.smootherstep=$t,x.smoothstep=Ht,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -7,8 +7,9 @@ export declare class AcGeSpline3d extends AcGeCurve3d {
|
|
|
7
7
|
private _knotParameterization?;
|
|
8
8
|
private _controlPoints;
|
|
9
9
|
private _closed;
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
10
|
+
private _degree;
|
|
11
|
+
constructor(controlPoints: AcGePoint3dLike[], knots: number[], weights?: number[], degree?: number, closed?: boolean);
|
|
12
|
+
constructor(fitPoints: AcGePointLike[], knotParam: AcGeKnotParameterizationType, degree?: number, closed?: boolean);
|
|
12
13
|
/**
|
|
13
14
|
* Build the NURBS curve using stored data
|
|
14
15
|
*/
|
|
@@ -78,8 +79,9 @@ export declare class AcGeSpline3d extends AcGeCurve3d {
|
|
|
78
79
|
* Create a closed spline from fit points using AcGeNurbsCurve.createClosedCurve
|
|
79
80
|
* @param fitPoints - Array of fit points defining the curve
|
|
80
81
|
* @param parameterization - Knot parameterization type for NURBS
|
|
82
|
+
* @param degree - Optional degree of the spline (default: 3)
|
|
81
83
|
* @returns A closed spline
|
|
82
84
|
*/
|
|
83
|
-
static createClosedSpline(fitPoints: AcGePoint3dLike[], parameterization?: AcGeKnotParameterizationType): AcGeSpline3d;
|
|
85
|
+
static createClosedSpline(fitPoints: AcGePoint3dLike[], parameterization?: AcGeKnotParameterizationType, degree?: number): AcGeSpline3d;
|
|
84
86
|
}
|
|
85
87
|
//# sourceMappingURL=AcGeSpline3d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcGeSpline3d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE/E,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,UAAU,CAAC,CAAmB;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAA8B;IAC5D,OAAO,CAAC,cAAc,CAAmB;IACzC,OAAO,CAAC,OAAO,CAAS;
|
|
1
|
+
{"version":3,"file":"AcGeSpline3d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE/E,qBAAa,YAAa,SAAQ,WAAW;IAC3C,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,UAAU,CAAC,CAAmB;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAA8B;IAC5D,OAAO,CAAC,cAAc,CAAmB;IACzC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAQ;gBAGrB,aAAa,EAAE,eAAe,EAAE,EAChC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,MAAM,EAAE,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO;gBAGhB,SAAS,EAAE,aAAa,EAAE,EAC1B,SAAS,EAAE,4BAA4B,EACvC,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO;IAsGlB;;OAEG;IACH,OAAO,CAAC,UAAU;IA8ClB;;OAEG;IACH,OAAO,CAAC,SAAS;IAUjB;;OAEG;IACH,IAAI,MAAM,WAET;IAED,IAAI,oBAAoB,6CAEvB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,WAAW,CAM5B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,WAAW,CAM1B;IAED;;OAEG;IACH,IAAI,MAAM,WAET;IAED;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe;IAU7C;;;;;;OAMG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAM/B;;;;;OAKG;IACH,SAAS,CAAC,SAAS,GAAE,MAAY,GAAG,WAAW,EAAE;IAsBjD,cAAc,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM;IAkBnD;;OAEG;IACH,oBAAoB;IAKpB,IAAI,MAAM,IAGQ,OAAO,CADxB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAExB;IAED;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,YAAY;IAM/B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAQrB;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CACvB,SAAS,EAAE,eAAe,EAAE,EAC5B,gBAAgB,GAAE,4BAAwC,EAC1D,MAAM,GAAE,MAAU,GACjB,YAAY;CAQhB"}
|
|
@@ -19,46 +19,75 @@ import { AcGeCurve3d } from './AcGeCurve3d';
|
|
|
19
19
|
import { AcGeNurbsCurve } from './AcGeNurbsCurve';
|
|
20
20
|
var AcGeSpline3d = /** @class */ (function (_super) {
|
|
21
21
|
__extends(AcGeSpline3d, _super);
|
|
22
|
-
function AcGeSpline3d(a, b, c, d) {
|
|
22
|
+
function AcGeSpline3d(a, b, c, d, e) {
|
|
23
23
|
var _this = _super.call(this) || this;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
+(d !== undefined);
|
|
28
|
-
if (argsLength < 2 || argsLength > 4) {
|
|
24
|
+
// Count the number of arguments passed (including undefined)
|
|
25
|
+
var argsLength = arguments.length;
|
|
26
|
+
if (argsLength < 2 || argsLength > 5) {
|
|
29
27
|
throw AcCmErrors.ILLEGAL_PARAMETERS;
|
|
30
28
|
}
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
_this._closed =
|
|
29
|
+
// Default degree is 3
|
|
30
|
+
_this._degree = 3;
|
|
31
|
+
_this._closed = false;
|
|
34
32
|
if (!Array.isArray(b)) {
|
|
35
33
|
// Constructor with fit points
|
|
36
34
|
_this._fitPoints = a;
|
|
37
35
|
_this._knotParameterization = b;
|
|
38
|
-
// Handle closed
|
|
36
|
+
// Handle degree and closed parameters for fit points constructor
|
|
39
37
|
if (argsLength >= 3) {
|
|
40
|
-
_this.
|
|
38
|
+
_this._degree = c || 3;
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (argsLength >= 4) {
|
|
41
|
+
_this._closed = d;
|
|
42
|
+
}
|
|
43
|
+
// Validate minimum number of fit points for the specified degree
|
|
44
|
+
if (_this._fitPoints.length < _this._degree + 1) {
|
|
44
45
|
throw AcCmErrors.ILLEGAL_PARAMETERS;
|
|
45
46
|
}
|
|
46
47
|
var points = _this.toNurbsPoints(_this._fitPoints);
|
|
47
|
-
_this._nurbsCurve = AcGeNurbsCurve.byPoints(points,
|
|
48
|
+
_this._nurbsCurve = AcGeNurbsCurve.byPoints(points, _this._degree, _this._knotParameterization);
|
|
48
49
|
_this._controlPoints = _this._nurbsCurve.controlPoints();
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
52
|
// Constructor with control points
|
|
52
53
|
_this._controlPoints = a;
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
// Determine if c is weights or degree based on type
|
|
55
|
+
var weights = void 0;
|
|
56
|
+
var degree = 3;
|
|
57
|
+
var closed_1 = false;
|
|
58
|
+
if (argsLength >= 3) {
|
|
59
|
+
if (Array.isArray(c)) {
|
|
60
|
+
// c is weights array
|
|
61
|
+
weights = c;
|
|
62
|
+
if (argsLength >= 4) {
|
|
63
|
+
degree = d || 3;
|
|
64
|
+
}
|
|
65
|
+
if (argsLength >= 5) {
|
|
66
|
+
closed_1 = e;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (c !== undefined) {
|
|
70
|
+
// c is degree (not undefined)
|
|
71
|
+
degree = c || 3;
|
|
72
|
+
if (argsLength >= 4) {
|
|
73
|
+
closed_1 = d;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Handle case where c is undefined but d might be degree
|
|
78
|
+
if (c === undefined && argsLength >= 4) {
|
|
79
|
+
degree = d || 3;
|
|
80
|
+
if (argsLength >= 5) {
|
|
81
|
+
closed_1 = e;
|
|
82
|
+
}
|
|
56
83
|
}
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
_this._degree = degree;
|
|
85
|
+
_this._closed = closed_1;
|
|
86
|
+
// Validate minimum number of control points for the specified degree
|
|
87
|
+
if (_this._controlPoints.length < _this._degree + 1) {
|
|
59
88
|
throw AcCmErrors.ILLEGAL_PARAMETERS;
|
|
60
89
|
}
|
|
61
|
-
_this._nurbsCurve = AcGeNurbsCurve.byKnotsControlPointsWeights(
|
|
90
|
+
_this._nurbsCurve = AcGeNurbsCurve.byKnotsControlPointsWeights(_this._degree, b, _this._controlPoints, weights);
|
|
62
91
|
}
|
|
63
92
|
// Apply closed state if specified
|
|
64
93
|
if (_this._closed) {
|
|
@@ -70,17 +99,16 @@ var AcGeSpline3d = /** @class */ (function (_super) {
|
|
|
70
99
|
* Build the NURBS curve using stored data
|
|
71
100
|
*/
|
|
72
101
|
AcGeSpline3d.prototype.buildCurve = function () {
|
|
73
|
-
var degree = 3;
|
|
74
102
|
if (this._fitPoints && this._knotParameterization) {
|
|
75
103
|
// Build from fit points
|
|
76
104
|
if (this._closed) {
|
|
77
105
|
// Create closed curve from fit points
|
|
78
|
-
this._nurbsCurve = AcGeNurbsCurve.createClosedCurve(this._fitPoints,
|
|
106
|
+
this._nurbsCurve = AcGeNurbsCurve.createClosedCurve(this._fitPoints, this._degree, this._knotParameterization);
|
|
79
107
|
}
|
|
80
108
|
else {
|
|
81
109
|
// Create open curve from fit points
|
|
82
110
|
var points = this.toNurbsPoints(this._fitPoints);
|
|
83
|
-
this._nurbsCurve = AcGeNurbsCurve.byPoints(points,
|
|
111
|
+
this._nurbsCurve = AcGeNurbsCurve.byPoints(points, this._degree, this._knotParameterization);
|
|
84
112
|
}
|
|
85
113
|
this._controlPoints = this._nurbsCurve.controlPoints();
|
|
86
114
|
}
|
|
@@ -89,7 +117,7 @@ var AcGeSpline3d = /** @class */ (function (_super) {
|
|
|
89
117
|
if (this._closed) {
|
|
90
118
|
// Create closed curve from control points
|
|
91
119
|
var parameterization = this._knotParameterization || 'Chord';
|
|
92
|
-
this._nurbsCurve = AcGeNurbsCurve.createClosedCurve(this._controlPoints,
|
|
120
|
+
this._nurbsCurve = AcGeNurbsCurve.createClosedCurve(this._controlPoints, this._degree, parameterization);
|
|
93
121
|
this._controlPoints = this._nurbsCurve.controlPoints();
|
|
94
122
|
}
|
|
95
123
|
else {
|
|
@@ -97,7 +125,7 @@ var AcGeSpline3d = /** @class */ (function (_super) {
|
|
|
97
125
|
// Get knots and weights from the current NURBS curve
|
|
98
126
|
var knots = this._nurbsCurve.knots();
|
|
99
127
|
var weights = this._nurbsCurve.weights();
|
|
100
|
-
this._nurbsCurve = AcGeNurbsCurve.byKnotsControlPointsWeights(
|
|
128
|
+
this._nurbsCurve = AcGeNurbsCurve.byKnotsControlPointsWeights(this._degree, knots, this._controlPoints, weights);
|
|
101
129
|
}
|
|
102
130
|
}
|
|
103
131
|
};
|
|
@@ -117,7 +145,7 @@ var AcGeSpline3d = /** @class */ (function (_super) {
|
|
|
117
145
|
* Degree of the spline to be created.
|
|
118
146
|
*/
|
|
119
147
|
get: function () {
|
|
120
|
-
return this.
|
|
148
|
+
return this._degree;
|
|
121
149
|
},
|
|
122
150
|
enumerable: false,
|
|
123
151
|
configurable: true
|
|
@@ -275,15 +303,17 @@ var AcGeSpline3d = /** @class */ (function (_super) {
|
|
|
275
303
|
* Create a closed spline from fit points using AcGeNurbsCurve.createClosedCurve
|
|
276
304
|
* @param fitPoints - Array of fit points defining the curve
|
|
277
305
|
* @param parameterization - Knot parameterization type for NURBS
|
|
306
|
+
* @param degree - Optional degree of the spline (default: 3)
|
|
278
307
|
* @returns A closed spline
|
|
279
308
|
*/
|
|
280
|
-
AcGeSpline3d.createClosedSpline = function (fitPoints, parameterization) {
|
|
309
|
+
AcGeSpline3d.createClosedSpline = function (fitPoints, parameterization, degree) {
|
|
281
310
|
if (parameterization === void 0) { parameterization = 'Uniform'; }
|
|
282
|
-
if (
|
|
283
|
-
|
|
311
|
+
if (degree === void 0) { degree = 3; }
|
|
312
|
+
if (fitPoints.length < degree + 1) {
|
|
313
|
+
throw new Error("At least ".concat(degree + 1, " points are required for a degree ").concat(degree, " closed spline"));
|
|
284
314
|
}
|
|
285
|
-
// Create spline using the constructor with fit points and closed=true
|
|
286
|
-
return new AcGeSpline3d(fitPoints, parameterization, true);
|
|
315
|
+
// Create spline using the constructor with fit points, degree, and closed=true
|
|
316
|
+
return new AcGeSpline3d(fitPoints, parameterization, degree, true);
|
|
287
317
|
};
|
|
288
318
|
return AcGeSpline3d;
|
|
289
319
|
}(AcGeCurve3d));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcGeSpline3d.js","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EACL,SAAS,EAET,WAAW,EAGZ,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAgC,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE/E;IAAkC,gCAAW;
|
|
1
|
+
{"version":3,"file":"AcGeSpline3d.js","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],"names":[],"mappings":"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"}
|