cesium
Version:
CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.
29 lines (27 loc) • 20.6 kB
JavaScript
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.142.0
*
* Copyright 2011-2022 Cesium Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
*/
import{a as E}from"./chunk-GZABERXA.js";import{a as S,b as e}from"./chunk-WM6AKY6B.js";import{f as z}from"./chunk-6K4BWAPV.js";var m=class p{constructor(n,o,c){this.x=n??0,this.y=o??0,this.z=c??0}static fromSpherical(n,o){e.typeOf.object("spherical",n),z(o)||(o=new p);let c=n.clock,t=n.cone,y=n.magnitude??1,O=y*Math.sin(t);return o.x=O*Math.cos(c),o.y=O*Math.sin(c),o.z=y*Math.cos(t),o}static fromElements(n,o,c,t){return z(t)?(t.x=n,t.y=o,t.z=c,t):new p(n,o,c)}static clone(n,o){if(z(n))return z(o)?(o.x=n.x,o.y=n.y,o.z=n.z,o):new p(n.x,n.y,n.z)}static pack(n,o,c){return e.typeOf.object("value",n),e.defined("array",o),c=c??0,o[c++]=n.x,o[c++]=n.y,o[c]=n.z,o}static unpack(n,o,c){return e.defined("array",n),o=o??0,z(c)||(c=new p),c.x=n[o++],c.y=n[o++],c.z=n[o],c}static packArray(n,o){e.defined("array",n);let c=n.length,t=c*3;if(!z(o))o=new Array(t);else{if(!Array.isArray(o)&&o.length!==t)throw new S("If result is a typed array, it must have exactly array.length * 3 elements");o.length!==t&&(o.length=t)}for(let y=0;y<c;++y)p.pack(n[y],o,y*3);return o}static unpackArray(n,o){if(e.defined("array",n),e.typeOf.number.greaterThanOrEquals("array.length",n.length,3),n.length%3!==0)throw new S("array length must be a multiple of 3.");let c=n.length;z(o)?o.length=c/3:o=new Array(c/3);for(let t=0;t<c;t+=3){let y=t/3;o[y]=p.unpack(n,t,o[y])}return o}static maximumComponent(n){return e.typeOf.object("cartesian",n),Math.max(n.x,n.y,n.z)}static minimumComponent(n){return e.typeOf.object("cartesian",n),Math.min(n.x,n.y,n.z)}static minimumByComponent(n,o,c){return e.typeOf.object("first",n),e.typeOf.object("second",o),e.typeOf.object("result",c),c.x=Math.min(n.x,o.x),c.y=Math.min(n.y,o.y),c.z=Math.min(n.z,o.z),c}static maximumByComponent(n,o,c){return e.typeOf.object("first",n),e.typeOf.object("second",o),e.typeOf.object("result",c),c.x=Math.max(n.x,o.x),c.y=Math.max(n.y,o.y),c.z=Math.max(n.z,o.z),c}static clamp(n,o,c,t){e.typeOf.object("value",n),e.typeOf.object("min",o),e.typeOf.object("max",c),e.typeOf.object("result",t);let y=E.clamp(n.x,o.x,c.x),O=E.clamp(n.y,o.y,c.y),b=E.clamp(n.z,o.z,c.z);return t.x=y,t.y=O,t.z=b,t}static magnitudeSquared(n){return e.typeOf.object("cartesian",n),n.x*n.x+n.y*n.y+n.z*n.z}static magnitude(n){return Math.sqrt(p.magnitudeSquared(n))}static distance(n,o){return e.typeOf.object("left",n),e.typeOf.object("right",o),p.subtract(n,o,k),p.magnitude(k)}static distanceSquared(n,o){return e.typeOf.object("left",n),e.typeOf.object("right",o),p.subtract(n,o,k),p.magnitudeSquared(k)}static normalize(n,o){e.typeOf.object("cartesian",n),e.typeOf.object("result",o);let c=p.magnitude(n);if(o.x=n.x/c,o.y=n.y/c,o.z=n.z/c,isNaN(o.x)||isNaN(o.y)||isNaN(o.z))throw new S("normalized result is not a number");return o}static dot(n,o){return e.typeOf.object("left",n),e.typeOf.object("right",o),n.x*o.x+n.y*o.y+n.z*o.z}static multiplyComponents(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c.x=n.x*o.x,c.y=n.y*o.y,c.z=n.z*o.z,c}static divideComponents(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c.x=n.x/o.x,c.y=n.y/o.y,c.z=n.z/o.z,c}static add(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c.x=n.x+o.x,c.y=n.y+o.y,c.z=n.z+o.z,c}static subtract(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c.x=n.x-o.x,c.y=n.y-o.y,c.z=n.z-o.z,c}static multiplyByScalar(n,o,c){return e.typeOf.object("cartesian",n),e.typeOf.number("scalar",o),e.typeOf.object("result",c),c.x=n.x*o,c.y=n.y*o,c.z=n.z*o,c}static divideByScalar(n,o,c){return e.typeOf.object("cartesian",n),e.typeOf.number("scalar",o),e.typeOf.object("result",c),c.x=n.x/o,c.y=n.y/o,c.z=n.z/o,c}static negate(n,o){return e.typeOf.object("cartesian",n),e.typeOf.object("result",o),o.x=-n.x,o.y=-n.y,o.z=-n.z,o}static abs(n,o){return e.typeOf.object("cartesian",n),e.typeOf.object("result",o),o.x=Math.abs(n.x),o.y=Math.abs(n.y),o.z=Math.abs(n.z),o}static lerp(n,o,c,t){return e.typeOf.object("start",n),e.typeOf.object("end",o),e.typeOf.number("t",c),e.typeOf.object("result",t),p.multiplyByScalar(o,c,V),t=p.multiplyByScalar(n,1-c,t),p.add(V,t,t)}static angleBetween(n,o){e.typeOf.object("left",n),e.typeOf.object("right",o),p.normalize(n,U),p.normalize(o,L);let c=p.dot(U,L),t=p.magnitude(p.cross(U,L,U));return Math.atan2(t,c)}static mostOrthogonalAxis(n,o){e.typeOf.object("cartesian",n),e.typeOf.object("result",o);let c=p.normalize(n,I);return p.abs(c,c),c.x<=c.y?c.x<=c.z?o=p.clone(p.UNIT_X,o):o=p.clone(p.UNIT_Z,o):c.y<=c.z?o=p.clone(p.UNIT_Y,o):o=p.clone(p.UNIT_Z,o),o}static projectVector(n,o,c){e.defined("a",n),e.defined("b",o),e.defined("result",c);let t=p.dot(n,o)/p.dot(o,o);return p.multiplyByScalar(o,t,c)}static equals(n,o){return n===o||z(n)&&z(o)&&n.x===o.x&&n.y===o.y&&n.z===o.z}static equalsArray(n,o,c){return n.x===o[c]&&n.y===o[c+1]&&n.z===o[c+2]}static equalsEpsilon(n,o,c,t){return n===o||z(n)&&z(o)&&E.equalsEpsilon(n.x,o.x,c,t)&&E.equalsEpsilon(n.y,o.y,c,t)&&E.equalsEpsilon(n.z,o.z,c,t)}static cross(n,o,c){e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c);let t=n.x,y=n.y,O=n.z,b=o.x,f=o.y,j=o.z,w=y*j-O*f,M=O*b-t*j,d=t*f-y*b;return c.x=w,c.y=M,c.z=d,c}static midpoint(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c.x=(n.x+o.x)*.5,c.y=(n.y+o.y)*.5,c.z=(n.z+o.z)*.5,c}static fromDegrees(n,o,c,t,y){return e.typeOf.number("longitude",n),e.typeOf.number("latitude",o),n=E.toRadians(n),o=E.toRadians(o),p.fromRadians(n,o,c,t,y)}static fromRadians(n,o,c,t,y){e.typeOf.number("longitude",n),e.typeOf.number("latitude",o),c=c??0;let O=z(t)?t.radiiSquared:p._ellipsoidRadiiSquared,b=Math.cos(o);A.x=b*Math.cos(n),A.y=b*Math.sin(n),A.z=Math.sin(o),A=p.normalize(A,A),p.multiplyComponents(O,A,T);let f=Math.sqrt(p.dot(A,T));return T=p.divideByScalar(T,f,T),A=p.multiplyByScalar(A,c,A),z(y)||(y=new p),p.add(T,A,y)}static fromDegreesArray(n,o,c){if(e.defined("coordinates",n),n.length<2||n.length%2!==0)throw new S("the number of coordinates must be a multiple of 2 and at least 2");let t=n.length;z(c)?c.length=t/2:c=new Array(t/2);for(let y=0;y<t;y+=2){let O=n[y],b=n[y+1],f=y/2;c[f]=p.fromDegrees(O,b,0,o,c[f])}return c}static fromRadiansArray(n,o,c){if(e.defined("coordinates",n),n.length<2||n.length%2!==0)throw new S("the number of coordinates must be a multiple of 2 and at least 2");let t=n.length;z(c)?c.length=t/2:c=new Array(t/2);for(let y=0;y<t;y+=2){let O=n[y],b=n[y+1],f=y/2;c[f]=p.fromRadians(O,b,0,o,c[f])}return c}static fromDegreesArrayHeights(n,o,c){if(e.defined("coordinates",n),n.length<3||n.length%3!==0)throw new S("the number of coordinates must be a multiple of 3 and at least 3");let t=n.length;z(c)?c.length=t/3:c=new Array(t/3);for(let y=0;y<t;y+=3){let O=n[y],b=n[y+1],f=n[y+2],j=y/3;c[j]=p.fromDegrees(O,b,f,o,c[j])}return c}static fromRadiansArrayHeights(n,o,c){if(e.defined("coordinates",n),n.length<3||n.length%3!==0)throw new S("the number of coordinates must be a multiple of 3 and at least 3");let t=n.length;z(c)?c.length=t/3:c=new Array(t/3);for(let y=0;y<t;y+=3){let O=n[y],b=n[y+1],f=n[y+2],j=y/3;c[j]=p.fromRadians(O,b,f,o,c[j])}return c}clone(n){return p.clone(this,n)}equals(n){return p.equals(this,n)}equalsEpsilon(n,o,c){return p.equalsEpsilon(this,n,o,c)}toString(){return`(${this.x}, ${this.y}, ${this.z})`}};m.fromCartesian4=m.clone;m.packedLength=3;m.fromArray=m.unpack;var k=new m,V=new m,U=new m,L=new m,I=new m,A=new m,T=new m;m._ellipsoidRadiiSquared=new m(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);m.ZERO=Object.freeze(new m(0,0,0));m.ONE=Object.freeze(new m(1,1,1));m.UNIT_X=Object.freeze(new m(1,0,0));m.UNIT_Y=Object.freeze(new m(0,1,0));m.UNIT_Z=Object.freeze(new m(0,0,1));var R=m;var h=class p{constructor(n,o,c,t,y,O,b,f,j){this[0]=n??0,this[1]=t??0,this[2]=b??0,this[3]=o??0,this[4]=y??0,this[5]=f??0,this[6]=c??0,this[7]=O??0,this[8]=j??0}static pack(n,o,c){return e.typeOf.object("value",n),e.defined("array",o),c=c??0,o[c++]=n[0],o[c++]=n[1],o[c++]=n[2],o[c++]=n[3],o[c++]=n[4],o[c++]=n[5],o[c++]=n[6],o[c++]=n[7],o[c++]=n[8],o}static unpack(n,o,c){return e.defined("array",n),o=o??0,z(c)||(c=new p),c[0]=n[o++],c[1]=n[o++],c[2]=n[o++],c[3]=n[o++],c[4]=n[o++],c[5]=n[o++],c[6]=n[o++],c[7]=n[o++],c[8]=n[o++],c}static packArray(n,o){e.defined("array",n);let c=n.length,t=c*9;if(!z(o))o=new Array(t);else{if(!Array.isArray(o)&&o.length!==t)throw new S("If result is a typed array, it must have exactly array.length * 9 elements");o.length!==t&&(o.length=t)}for(let y=0;y<c;++y)p.pack(n[y],o,y*9);return o}static unpackArray(n,o){if(e.defined("array",n),e.typeOf.number.greaterThanOrEquals("array.length",n.length,9),n.length%9!==0)throw new S("array length must be a multiple of 9.");let c=n.length;z(o)?o.length=c/9:o=new Array(c/9);for(let t=0;t<c;t+=9){let y=t/9;o[y]=p.unpack(n,t,o[y])}return o}static clone(n,o){if(z(n))return z(o)?(o[0]=n[0],o[1]=n[1],o[2]=n[2],o[3]=n[3],o[4]=n[4],o[5]=n[5],o[6]=n[6],o[7]=n[7],o[8]=n[8],o):new p(n[0],n[3],n[6],n[1],n[4],n[7],n[2],n[5],n[8])}static fromColumnMajorArray(n,o){return e.defined("values",n),p.clone(n,o)}static fromRowMajorArray(n,o){return e.defined("values",n),z(o)?(o[0]=n[0],o[1]=n[3],o[2]=n[6],o[3]=n[1],o[4]=n[4],o[5]=n[7],o[6]=n[2],o[7]=n[5],o[8]=n[8],o):new p(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])}static fromQuaternion(n,o){e.typeOf.object("quaternion",n);let c=n.x*n.x,t=n.x*n.y,y=n.x*n.z,O=n.x*n.w,b=n.y*n.y,f=n.y*n.z,j=n.y*n.w,w=n.z*n.z,M=n.z*n.w,d=n.w*n.w,a=c-b-w+d,N=2*(t-M),q=2*(y+j),C=2*(t+M),i=-c+b-w+d,Z=2*(f-O),W=2*(y-j),X=2*(f+O),P=-c-b+w+d;return z(o)?(o[0]=a,o[1]=C,o[2]=W,o[3]=N,o[4]=i,o[5]=X,o[6]=q,o[7]=Z,o[8]=P,o):new p(a,N,q,C,i,Z,W,X,P)}static fromHeadingPitchRoll(n,o){e.typeOf.object("headingPitchRoll",n);let c=Math.cos(-n.pitch),t=Math.cos(-n.heading),y=Math.cos(n.roll),O=Math.sin(-n.pitch),b=Math.sin(-n.heading),f=Math.sin(n.roll),j=c*t,w=-y*b+f*O*t,M=f*b+y*O*t,d=c*b,a=y*t+f*O*b,N=-f*t+y*O*b,q=-O,C=f*c,i=y*c;return z(o)?(o[0]=j,o[1]=d,o[2]=q,o[3]=w,o[4]=a,o[5]=C,o[6]=M,o[7]=N,o[8]=i,o):new p(j,w,M,d,a,N,q,C,i)}static fromScale(n,o){return e.typeOf.object("scale",n),z(o)?(o[0]=n.x,o[1]=0,o[2]=0,o[3]=0,o[4]=n.y,o[5]=0,o[6]=0,o[7]=0,o[8]=n.z,o):new p(n.x,0,0,0,n.y,0,0,0,n.z)}static fromUniformScale(n,o){return e.typeOf.number("scale",n),z(o)?(o[0]=n,o[1]=0,o[2]=0,o[3]=0,o[4]=n,o[5]=0,o[6]=0,o[7]=0,o[8]=n,o):new p(n,0,0,0,n,0,0,0,n)}static fromCrossProduct(n,o){return e.typeOf.object("vector",n),z(o)?(o[0]=0,o[1]=n.z,o[2]=-n.y,o[3]=-n.z,o[4]=0,o[5]=n.x,o[6]=n.y,o[7]=-n.x,o[8]=0,o):new p(0,-n.z,n.y,n.z,0,-n.x,-n.y,n.x,0)}static fromRotationX(n,o){e.typeOf.number("angle",n);let c=Math.cos(n),t=Math.sin(n);return z(o)?(o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=c,o[5]=t,o[6]=0,o[7]=-t,o[8]=c,o):new p(1,0,0,0,c,-t,0,t,c)}static fromRotationY(n,o){e.typeOf.number("angle",n);let c=Math.cos(n),t=Math.sin(n);return z(o)?(o[0]=c,o[1]=0,o[2]=-t,o[3]=0,o[4]=1,o[5]=0,o[6]=t,o[7]=0,o[8]=c,o):new p(c,0,t,0,1,0,-t,0,c)}static fromRotationZ(n,o){e.typeOf.number("angle",n);let c=Math.cos(n),t=Math.sin(n);return z(o)?(o[0]=c,o[1]=t,o[2]=0,o[3]=-t,o[4]=c,o[5]=0,o[6]=0,o[7]=0,o[8]=1,o):new p(c,-t,0,t,c,0,0,0,1)}static toArray(n,o){return e.typeOf.object("matrix",n),z(o)?(o[0]=n[0],o[1]=n[1],o[2]=n[2],o[3]=n[3],o[4]=n[4],o[5]=n[5],o[6]=n[6],o[7]=n[7],o[8]=n[8],o):[n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]]}static getElementIndex(n,o){return e.typeOf.number.greaterThanOrEquals("row",o,0),e.typeOf.number.lessThanOrEquals("row",o,2),e.typeOf.number.greaterThanOrEquals("column",n,0),e.typeOf.number.lessThanOrEquals("column",n,2),n*3+o}static getColumn(n,o,c){e.typeOf.object("matrix",n),e.typeOf.number.greaterThanOrEquals("index",o,0),e.typeOf.number.lessThanOrEquals("index",o,2),e.typeOf.object("result",c);let t=o*3,y=n[t],O=n[t+1],b=n[t+2];return c.x=y,c.y=O,c.z=b,c}static setColumn(n,o,c,t){e.typeOf.object("matrix",n),e.typeOf.number.greaterThanOrEquals("index",o,0),e.typeOf.number.lessThanOrEquals("index",o,2),e.typeOf.object("cartesian",c),e.typeOf.object("result",t),t=p.clone(n,t);let y=o*3;return t[y]=c.x,t[y+1]=c.y,t[y+2]=c.z,t}static getRow(n,o,c){e.typeOf.object("matrix",n),e.typeOf.number.greaterThanOrEquals("index",o,0),e.typeOf.number.lessThanOrEquals("index",o,2),e.typeOf.object("result",c);let t=n[o],y=n[o+3],O=n[o+6];return c.x=t,c.y=y,c.z=O,c}static setRow(n,o,c,t){return e.typeOf.object("matrix",n),e.typeOf.number.greaterThanOrEquals("index",o,0),e.typeOf.number.lessThanOrEquals("index",o,2),e.typeOf.object("cartesian",c),e.typeOf.object("result",t),t=p.clone(n,t),t[o]=c.x,t[o+3]=c.y,t[o+6]=c.z,t}static setScale(n,o,c){e.typeOf.object("matrix",n),e.typeOf.object("scale",o),e.typeOf.object("result",c);let t=p.getScale(n,J),y=o.x/t.x,O=o.y/t.y,b=o.z/t.z;return c[0]=n[0]*y,c[1]=n[1]*y,c[2]=n[2]*y,c[3]=n[3]*O,c[4]=n[4]*O,c[5]=n[5]*O,c[6]=n[6]*b,c[7]=n[7]*b,c[8]=n[8]*b,c}static setUniformScale(n,o,c){e.typeOf.object("matrix",n),e.typeOf.number("scale",o),e.typeOf.object("result",c);let t=p.getScale(n,K),y=o/t.x,O=o/t.y,b=o/t.z;return c[0]=n[0]*y,c[1]=n[1]*y,c[2]=n[2]*y,c[3]=n[3]*O,c[4]=n[4]*O,c[5]=n[5]*O,c[6]=n[6]*b,c[7]=n[7]*b,c[8]=n[8]*b,c}static getScale(n,o){return e.typeOf.object("matrix",n),e.typeOf.object("result",o),o.x=R.magnitude(R.fromElements(n[0],n[1],n[2],D)),o.y=R.magnitude(R.fromElements(n[3],n[4],n[5],D)),o.z=R.magnitude(R.fromElements(n[6],n[7],n[8],D)),o}static getMaximumScale(n){return p.getScale(n,F),R.maximumComponent(F)}static setRotation(n,o,c){e.typeOf.object("matrix",n),e.typeOf.object("result",c);let t=p.getScale(n,Q);return c[0]=o[0]*t.x,c[1]=o[1]*t.x,c[2]=o[2]*t.x,c[3]=o[3]*t.y,c[4]=o[4]*t.y,c[5]=o[5]*t.y,c[6]=o[6]*t.z,c[7]=o[7]*t.z,c[8]=o[8]*t.z,c}static getRotation(n,o){e.typeOf.object("matrix",n),e.typeOf.object("result",o);let c=p.getScale(n,G);return o[0]=n[0]/c.x,o[1]=n[1]/c.x,o[2]=n[2]/c.x,o[3]=n[3]/c.y,o[4]=n[4]/c.y,o[5]=n[5]/c.y,o[6]=n[6]/c.z,o[7]=n[7]/c.z,o[8]=n[8]/c.z,o}static multiply(n,o,c){e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c);let t=n[0]*o[0]+n[3]*o[1]+n[6]*o[2],y=n[1]*o[0]+n[4]*o[1]+n[7]*o[2],O=n[2]*o[0]+n[5]*o[1]+n[8]*o[2],b=n[0]*o[3]+n[3]*o[4]+n[6]*o[5],f=n[1]*o[3]+n[4]*o[4]+n[7]*o[5],j=n[2]*o[3]+n[5]*o[4]+n[8]*o[5],w=n[0]*o[6]+n[3]*o[7]+n[6]*o[8],M=n[1]*o[6]+n[4]*o[7]+n[7]*o[8],d=n[2]*o[6]+n[5]*o[7]+n[8]*o[8];return c[0]=t,c[1]=y,c[2]=O,c[3]=b,c[4]=f,c[5]=j,c[6]=w,c[7]=M,c[8]=d,c}static add(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c[0]=n[0]+o[0],c[1]=n[1]+o[1],c[2]=n[2]+o[2],c[3]=n[3]+o[3],c[4]=n[4]+o[4],c[5]=n[5]+o[5],c[6]=n[6]+o[6],c[7]=n[7]+o[7],c[8]=n[8]+o[8],c}static subtract(n,o,c){return e.typeOf.object("left",n),e.typeOf.object("right",o),e.typeOf.object("result",c),c[0]=n[0]-o[0],c[1]=n[1]-o[1],c[2]=n[2]-o[2],c[3]=n[3]-o[3],c[4]=n[4]-o[4],c[5]=n[5]-o[5],c[6]=n[6]-o[6],c[7]=n[7]-o[7],c[8]=n[8]-o[8],c}static multiplyByVector(n,o,c){e.typeOf.object("matrix",n),e.typeOf.object("cartesian",o),e.typeOf.object("result",c);let t=o.x,y=o.y,O=o.z,b=n[0]*t+n[3]*y+n[6]*O,f=n[1]*t+n[4]*y+n[7]*O,j=n[2]*t+n[5]*y+n[8]*O;return c.x=b,c.y=f,c.z=j,c}static multiplyByScalar(n,o,c){return e.typeOf.object("matrix",n),e.typeOf.number("scalar",o),e.typeOf.object("result",c),c[0]=n[0]*o,c[1]=n[1]*o,c[2]=n[2]*o,c[3]=n[3]*o,c[4]=n[4]*o,c[5]=n[5]*o,c[6]=n[6]*o,c[7]=n[7]*o,c[8]=n[8]*o,c}static multiplyByScale(n,o,c){return e.typeOf.object("matrix",n),e.typeOf.object("scale",o),e.typeOf.object("result",c),c[0]=n[0]*o.x,c[1]=n[1]*o.x,c[2]=n[2]*o.x,c[3]=n[3]*o.y,c[4]=n[4]*o.y,c[5]=n[5]*o.y,c[6]=n[6]*o.z,c[7]=n[7]*o.z,c[8]=n[8]*o.z,c}static multiplyByUniformScale(n,o,c){return e.typeOf.object("matrix",n),e.typeOf.number("scale",o),e.typeOf.object("result",c),c[0]=n[0]*o,c[1]=n[1]*o,c[2]=n[2]*o,c[3]=n[3]*o,c[4]=n[4]*o,c[5]=n[5]*o,c[6]=n[6]*o,c[7]=n[7]*o,c[8]=n[8]*o,c}static negate(n,o){return e.typeOf.object("matrix",n),e.typeOf.object("result",o),o[0]=-n[0],o[1]=-n[1],o[2]=-n[2],o[3]=-n[3],o[4]=-n[4],o[5]=-n[5],o[6]=-n[6],o[7]=-n[7],o[8]=-n[8],o}static transpose(n,o){e.typeOf.object("matrix",n),e.typeOf.object("result",o);let c=n[0],t=n[3],y=n[6],O=n[1],b=n[4],f=n[7],j=n[2],w=n[5],M=n[8];return o[0]=c,o[1]=t,o[2]=y,o[3]=O,o[4]=b,o[5]=f,o[6]=j,o[7]=w,o[8]=M,o}static computeEigenDecomposition(n,o){e.typeOf.object("matrix",n);let c=E.EPSILON20,t=10,y=0,O=0;z(o)||(o={});let b=o.unitary=p.clone(p.IDENTITY,o.unitary),f=o.diagonal=p.clone(n,o.diagonal),j=c*v(f);for(;O<t&&x(f)>j;)_(f,B),p.transpose(B,H),p.multiply(f,B,f),p.multiply(H,f,f),p.multiply(b,B,b),++y>2&&(++O,y=0);return o}static abs(n,o){return e.typeOf.object("matrix",n),e.typeOf.object("result",o),o[0]=Math.abs(n[0]),o[1]=Math.abs(n[1]),o[2]=Math.abs(n[2]),o[3]=Math.abs(n[3]),o[4]=Math.abs(n[4]),o[5]=Math.abs(n[5]),o[6]=Math.abs(n[6]),o[7]=Math.abs(n[7]),o[8]=Math.abs(n[8]),o}static determinant(n){e.typeOf.object("matrix",n);let o=n[0],c=n[3],t=n[6],y=n[1],O=n[4],b=n[7],f=n[2],j=n[5],w=n[8];return o*(O*w-j*b)+y*(j*t-c*w)+f*(c*b-O*t)}static inverse(n,o){e.typeOf.object("matrix",n),e.typeOf.object("result",o);let c=n[0],t=n[1],y=n[2],O=n[3],b=n[4],f=n[5],j=n[6],w=n[7],M=n[8],d=p.determinant(n);if(Math.abs(d)<=E.EPSILON15)throw new S("matrix is not invertible");o[0]=b*M-w*f,o[1]=w*y-t*M,o[2]=t*f-b*y,o[3]=j*f-O*M,o[4]=c*M-j*y,o[5]=O*y-c*f,o[6]=O*w-j*b,o[7]=j*t-c*w,o[8]=c*b-O*t;let a=1/d;return p.multiplyByScalar(o,a,o)}static inverseTranspose(n,o){return e.typeOf.object("matrix",n),e.typeOf.object("result",o),p.inverse(p.transpose(n,s),o)}static equals(n,o){return n===o||z(n)&&z(o)&&n[0]===o[0]&&n[1]===o[1]&&n[2]===o[2]&&n[3]===o[3]&&n[4]===o[4]&&n[5]===o[5]&&n[6]===o[6]&&n[7]===o[7]&&n[8]===o[8]}static equalsEpsilon(n,o,c){return c=c??0,n===o||z(n)&&z(o)&&Math.abs(n[0]-o[0])<=c&&Math.abs(n[1]-o[1])<=c&&Math.abs(n[2]-o[2])<=c&&Math.abs(n[3]-o[3])<=c&&Math.abs(n[4]-o[4])<=c&&Math.abs(n[5]-o[5])<=c&&Math.abs(n[6]-o[6])<=c&&Math.abs(n[7]-o[7])<=c&&Math.abs(n[8]-o[8])<=c}get length(){return p.packedLength}clone(n){return p.clone(this,n)}equals(n){return p.equals(this,n)}static equalsArray(n,o,c){return n[0]===o[c]&&n[1]===o[c+1]&&n[2]===o[c+2]&&n[3]===o[c+3]&&n[4]===o[c+4]&&n[5]===o[c+5]&&n[6]===o[c+6]&&n[7]===o[c+7]&&n[8]===o[c+8]}equalsEpsilon(n,o){return p.equalsEpsilon(this,n,o)}toString(){return`(${this[0]}, ${this[3]}, ${this[6]})
(${this[1]}, ${this[4]}, ${this[7]})
(${this[2]}, ${this[5]}, ${this[8]})`}};h.packedLength=9;h.fromArray=h.unpack;h.IDENTITY=Object.freeze(new h(1,0,0,0,1,0,0,0,1));h.ZERO=Object.freeze(new h(0,0,0,0,0,0,0,0,0));h.COLUMN0ROW0=0;h.COLUMN0ROW1=1;h.COLUMN0ROW2=2;h.COLUMN1ROW0=3;h.COLUMN1ROW1=4;h.COLUMN1ROW2=5;h.COLUMN2ROW0=6;h.COLUMN2ROW1=7;h.COLUMN2ROW2=8;var J=new R,K=new R,D=new R,F=new R,Q=new R,G=new R,B=new h,H=new h,s=new h;function v(p){let n=0;for(let o=0;o<9;++o){let c=p[o];n+=c*c}return Math.sqrt(n)}var Y=[1,0,0],g=[2,2,1];function x(p){let n=0;for(let o=0;o<3;++o){let c=p[h.getElementIndex(g[o],Y[o])];n+=2*c*c}return Math.sqrt(n)}function _(p,n){let o=E.EPSILON15,c=0,t=1;for(let j=0;j<3;++j){let w=Math.abs(p[h.getElementIndex(g[j],Y[j])]);w>c&&(t=j,c=w)}let y=1,O=0,b=Y[t],f=g[t];if(Math.abs(p[h.getElementIndex(f,b)])>o){let j=p[h.getElementIndex(f,f)],w=p[h.getElementIndex(b,b)],M=p[h.getElementIndex(f,b)],d=(j-w)/2/M,a;d<0?a=-1/(-d+Math.sqrt(1+d*d)):a=1/(d+Math.sqrt(1+d*d)),y=1/Math.sqrt(1+a*a),O=a*y}return n=h.clone(h.IDENTITY,n),n[h.getElementIndex(b,b)]=n[h.getElementIndex(f,f)]=y,n[h.getElementIndex(f,b)]=O,n[h.getElementIndex(b,f)]=-O,n}var On=h;var $={};$.EMPTY_OBJECT=Object.freeze({});$.EMPTY_ARRAY=Object.freeze([]);var fn=$;export{R as a,On as b,fn as c};