2 lines
5.4 KiB
JavaScript
2 lines
5.4 KiB
JavaScript
|
define(["exports","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab"],(function(n,e,t,r){"use strict";function a(n,e,r){this.x=t.defaultValue(n,0),this.y=t.defaultValue(e,0),this.z=t.defaultValue(r,0)}a.fromSpherical=function(n,e){t.defined(e)||(e=new a);const r=n.clock,o=n.cone,u=t.defaultValue(n.magnitude,1),i=u*Math.sin(o);return e.x=i*Math.cos(r),e.y=i*Math.sin(r),e.z=u*Math.cos(o),e},a.fromElements=function(n,e,r,o){return t.defined(o)?(o.x=n,o.y=e,o.z=r,o):new a(n,e,r)},a.clone=function(n,e){if(t.defined(n))return t.defined(e)?(e.x=n.x,e.y=n.y,e.z=n.z,e):new a(n.x,n.y,n.z)},a.fromCartesian4=a.clone,a.packedLength=3,a.pack=function(n,e,r){return r=t.defaultValue(r,0),e[r++]=n.x,e[r++]=n.y,e[r]=n.z,e},a.unpack=function(n,e,r){return e=t.defaultValue(e,0),t.defined(r)||(r=new a),r.x=n[e++],r.y=n[e++],r.z=n[e],r},a.packArray=function(n,e){const r=n.length,o=3*r;t.defined(e)?(Array.isArray(e)||e.length===o)&&e.length!==o&&(e.length=o):e=new Array(o);for(let t=0;t<r;++t)a.pack(n[t],e,3*t);return e},a.unpackArray=function(n,e){const r=n.length;t.defined(e)?e.length=r/3:e=new Array(r/3);for(let t=0;t<r;t+=3){const r=t/3;e[r]=a.unpack(n,t,e[r])}return e},a.fromArray=a.unpack,a.maximumComponent=function(n){return Math.max(n.x,n.y,n.z)},a.minimumComponent=function(n){return Math.min(n.x,n.y,n.z)},a.minimumByComponent=function(n,e,t){return t.x=Math.min(n.x,e.x),t.y=Math.min(n.y,e.y),t.z=Math.min(n.z,e.z),t},a.maximumByComponent=function(n,e,t){return t.x=Math.max(n.x,e.x),t.y=Math.max(n.y,e.y),t.z=Math.max(n.z,e.z),t},a.magnitudeSquared=function(n){return n.x*n.x+n.y*n.y+n.z*n.z},a.magnitude=function(n){return Math.sqrt(a.magnitudeSquared(n))};const o=new a;a.distance=function(n,e){return a.subtract(n,e,o),a.magnitude(o)},a.distanceSquared=function(n,e){return a.subtract(n,e,o),a.magnitudeSquared(o)},a.normalize=function(n,e){const t=a.magnitude(n);return e.x=n.x/t,e.y=n.y/t,e.z=n.z/t,e},a.dot=function(n,e){return n.x*e.x+n.y*e.y+n.z*e.z},a.multiplyComponents=function(n,e,t){return t.x=n.x*e.x,t.y=n.y*e.y,t.z=n.z*e.z,t},a.divideComponents=function(n,e,t){return t.x=n.x/e.x,t.y=n.y/e.y,t.z=n.z/e.z,t},a.add=function(n,e,t){return t.x=n.x+e.x,t.y=n.y+e.y,t.z=n.z+e.z,t},a.subtract=function(n,e,t){return t.x=n.x-e.x,t.y=n.y-e.y,t.z=n.z-e.z,t},a.multiplyByScalar=function(n,e,t){return t.x=n.x*e,t.y=n.y*e,t.z=n.z*e,t},a.divideByScalar=function(n,e,t){return t.x=n.x/e,t.y=n.y/e,t.z=n.z/e,t},a.negate=function(n,e){return e.x=-n.x,e.y=-n.y,e.z=-n.z,e},a.abs=function(n,e){return e.x=Math.abs(n.x),e.y=Math.abs(n.y),e.z=Math.abs(n.z),e};const u=new a;a.lerp=function(n,e,t,r){return a.multiplyByScalar(e,t,u),r=a.multiplyByScalar(n,1-t,r),a.add(u,r,r)};const i=new a,c=new a;a.angleBetween=function(n,e){a.normalize(n,i),a.normalize(e,c);const t=a.dot(i,c),r=a.magnitude(a.cross(i,c,i));return Math.atan2(r,t)};const s=new a;a.mostOrthogonalAxis=function(n,e){const t=a.normalize(n,s);return a.abs(t,t),e=t.x<=t.y?t.x<=t.z?a.clone(a.UNIT_X,e):a.clone(a.UNIT_Z,e):t.y<=t.z?a.clone(a.UNIT_Y,e):a.clone(a.UNIT_Z,e)},a.projectVector=function(n,e,t){const r=a.dot(n,e)/a.dot(e,e);return a.multiplyByScalar(e,r,t)},a.equals=function(n,e){return n===e||t.defined(n)&&t.defined(e)&&n.x===e.x&&n.y===e.y&&n.z===e.z},a.equalsArray=function(n,e,t){return n.x===e[t]&&n.y===e[t+1]&&n.z===e[t+2]},a.equalsEpsilon=function(n,e,a,o){return n===e||t.defined(n)&&t.defined(e)&&r.CesiumMath.equalsEpsilon(n.x,e.x,a,o)&&r.CesiumMath.equalsEpsilon(n.y,e.y,a,o)&&r.CesiumMath.equalsEpsilon(n.z,e.z,a,o)},a.cross=function(n,e,t){const r=n.x,a=n.y,o=n.z,u=e.x,i=e.y,c=e.z,s=a*c-o*i,f=o*u-r*c,l=r*i-a*u;return t.x=s,t.y=f,t.z=l,t},a.midpoint=function(n,e,t){return t.x=.5*(n.x+e.x),t.y=.5*(n.y+e.y),t.z=.5*(n.z+e.z),t},a.fromDegrees=function(n,e,t,o,u){return n=r.CesiumMath.toRadians(n),e=r.CesiumMath.toRadians(e),a.fromRadians(n,e,t,o,u)};let f=new a,l=new a;const y=new a(40680631590769,40680631590769,40408299984661.445);a.fromRadians=function(n,e,r,o,u){r=t.defaultValue(r,0);const i=t.defined(o)?o.radiiSquared:y,c=Math.cos(e);f.x=c*Math.cos(n),f.y=c*Math.sin(n),f.z=Math.
|