2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
|
define(["exports","./Check-2514d21d","./when-d186add7","./Math-7f5f2992"],(function(e,t,n,r){"use strict";function o(e,t,r){this.x=n.u(e,0),this.y=n.u(t,0),this.z=n.u(r,0)}o.fromSpherical=function(e,r){t.o.typeOf.object("spherical",e),n.e(r)||(r=new o);var a=e.clock,i=e.cone,u=n.u(e.magnitude,1),f=u*Math.sin(i);return r.x=f*Math.cos(a),r.y=f*Math.sin(a),r.z=u*Math.cos(i),r},o.fromElements=function(e,t,r,a){return n.e(a)?(a.x=e,a.y=t,a.z=r,a):new o(e,t,r)},o.clone=function(e,t){if(n.e(e))return n.e(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new o(e.x,e.y,e.z)},o.fromCartesian4=o.clone,o.packedLength=3,o.pack=function(e,r,o){return t.o.typeOf.object("value",e),t.o.defined("array",r),o=n.u(o,0),r[o++]=e.x,r[o++]=e.y,r[o]=e.z,r},o.unpack=function(e,r,a){return t.o.defined("array",e),r=n.u(r,0),n.e(a)||(a=new o),a.x=e[r++],a.y=e[r++],a.z=e[r],a},o.packArray=function(e,r){t.o.defined("array",e);var a=e.length;n.e(r)?r.length=3*a:r=new Array(3*a);for(var i=0;i<a;++i)o.pack(e[i],r,3*i);return r},o.unpackArray=function(e,r){if(t.o.defined("array",e),t.o.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!=0)throw new t.t("array length must be a multiple of 3.");var a=e.length;n.e(r)?r.length=a/3:r=new Array(a/3);for(var i=0;i<a;i+=3){var u=i/3;r[u]=o.unpack(e,i,r[u])}return r},o.fromArray=o.unpack,o.maximumComponent=function(e){return t.o.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)},o.minimumComponent=function(e){return t.o.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)},o.minimumByComponent=function(e,n,r){return t.o.typeOf.object("first",e),t.o.typeOf.object("second",n),t.o.typeOf.object("result",r),r.x=Math.min(e.x,n.x),r.y=Math.min(e.y,n.y),r.z=Math.min(e.z,n.z),r},o.maximumByComponent=function(e,n,r){return t.o.typeOf.object("first",e),t.o.typeOf.object("second",n),t.o.typeOf.object("result",r),r.x=Math.max(e.x,n.x),r.y=Math.max(e.y,n.y),r.z=Math.max(e.z,n.z),r},o.magnitudeSquared=function(e){return t.o.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z},o.magnitude=function(e){return Math.sqrt(o.magnitudeSquared(e))};var a=new o;o.distance=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.subtract(e,n,a),o.magnitude(a)},o.distanceSquared=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),o.subtract(e,n,a),o.magnitudeSquared(a)},o.normalize=function(e,n){t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n);var r=o.magnitude(e);if(n.x=e.x/r,n.y=e.y/r,n.z=e.z/r,isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new t.t("normalized result is not a number");return n},o.dot=function(e,n){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),e.x*n.x+e.y*n.y+e.z*n.z},o.multiplyComponents=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x*n.x,r.y=e.y*n.y,r.z=e.z*n.z,r},o.divideComponents=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x/n.x,r.y=e.y/n.y,r.z=e.z/n.z,r},o.add=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x+n.x,r.y=e.y+n.y,r.z=e.z+n.z,r},o.subtract=function(e,n,r){return t.o.typeOf.object("left",e),t.o.typeOf.object("right",n),t.o.typeOf.object("result",r),r.x=e.x-n.x,r.y=e.y-n.y,r.z=e.z-n.z,r},o.multiplyByScalar=function(e,n,r){return t.o.typeOf.object("cartesian",e),t.o.typeOf.number("scalar",n),t.o.typeOf.object("result",r),r.x=e.x*n,r.y=e.y*n,r.z=e.z*n,r},o.divideByScalar=function(e,n,r){return t.o.typeOf.object("cartesian",e),t.o.typeOf.number("scalar",n),t.o.typeOf.object("result",r),r.x=e.x/n,r.y=e.y/n,r.z=e.z/n,r},o.negate=function(e,n){return t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n),n.x=-e.x,n.y=-e.y,n.z=-e.z,n},o.abs=function(e,n){return t.o.typeOf.object("cartesian",e),t.o.typeOf.object("result",n),n.x=Math.abs(e.x),n.y=Math.abs(e.y),n.z=Math.abs(e.z),n};var i=new o;o.lerp=function(e,n,r,a){return t.o.typeOf.object("start",e),t.o.typeOf.object("end",n),t.o.typeOf.number("t",r),t.o.typeOf.object("res
|