mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-18 14:21:49 -05:00
2 lines
54 KiB
JavaScript
2 lines
54 KiB
JavaScript
|
define(["exports","./RuntimeError-608565a6","./when-229515d6","./ComponentDatatype-692a36d3"],(function(t,e,n,r){"use strict";function i(t,e,r){this.x=n.defaultValue(t,0),this.y=n.defaultValue(e,0),this.z=n.defaultValue(r,0)}i.fromSpherical=function(t,e){n.defined(e)||(e=new i);const r=t.clock,a=t.cone,u=n.defaultValue(t.magnitude,1),o=u*Math.sin(a);return e.x=o*Math.cos(r),e.y=o*Math.sin(r),e.z=u*Math.cos(a),e},i.fromElements=function(t,e,r,a){return n.defined(a)?(a.x=t,a.y=e,a.z=r,a):new i(t,e,r)},i.clone=function(t,e){if(n.defined(t))return n.defined(e)?(e.x=t.x,e.y=t.y,e.z=t.z,e):new i(t.x,t.y,t.z)},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(t,e,r){return r=n.defaultValue(r,0),e[r++]=t.x,e[r++]=t.y,e[r]=t.z,e},i.unpack=function(t,e,r){return e=n.defaultValue(e,0),n.defined(r)||(r=new i),r.x=t[e++],r.y=t[e++],r.z=t[e],r},i.packArray=function(t,r){const a=t.length,u=3*a;if(n.defined(r)){if(!Array.isArray(r)&&r.length!==u)throw new e.DeveloperError("If result is a typed array, it must have exactly array.length * 3 elements");r.length!==u&&(r.length=u)}else r=new Array(u);for(let e=0;e<a;++e)i.pack(t[e],r,3*e);return r},i.unpackArray=function(t,e){const r=t.length;n.defined(e)?e.length=r/3:e=new Array(r/3);for(let n=0;n<r;n+=3){const r=n/3;e[r]=i.unpack(t,n,e[r])}return e},i.fromArray=i.unpack,i.maximumComponent=function(t){return Math.max(t.x,t.y,t.z)},i.minimumComponent=function(t){return Math.min(t.x,t.y,t.z)},i.minimumByComponent=function(t,e,n){return n.x=Math.min(t.x,e.x),n.y=Math.min(t.y,e.y),n.z=Math.min(t.z,e.z),n},i.maximumByComponent=function(t,e,n){return n.x=Math.max(t.x,e.x),n.y=Math.max(t.y,e.y),n.z=Math.max(t.z,e.z),n},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},i.magnitude=function(t){return Math.sqrt(i.magnitudeSquared(t))};const a=new i;i.distance=function(t,e){return i.subtract(t,e,a),i.magnitude(a)},i.distanceSquared=function(t,e){return i.subtract(t,e,a),i.magnitudeSquared(a)},i.normalize=function(t,e){const n=i.magnitude(t);return e.x=t.x/n,e.y=t.y/n,e.z=t.z/n,e},i.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},i.multiplyComponents=function(t,e,n){return n.x=t.x*e.x,n.y=t.y*e.y,n.z=t.z*e.z,n},i.divideComponents=function(t,e,n){return n.x=t.x/e.x,n.y=t.y/e.y,n.z=t.z/e.z,n},i.add=function(t,e,n){return n.x=t.x+e.x,n.y=t.y+e.y,n.z=t.z+e.z,n},i.subtract=function(t,e,n){return n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z,n},i.multiplyByScalar=function(t,e,n){return n.x=t.x*e,n.y=t.y*e,n.z=t.z*e,n},i.divideByScalar=function(t,e,n){return n.x=t.x/e,n.y=t.y/e,n.z=t.z/e,n},i.negate=function(t,e){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},i.abs=function(t,e){return e.x=Math.abs(t.x),e.y=Math.abs(t.y),e.z=Math.abs(t.z),e};const u=new i;i.lerp=function(t,e,n,r){return i.multiplyByScalar(e,n,u),r=i.multiplyByScalar(t,1-n,r),i.add(u,r,r)};const o=new i,s=new i;i.angleBetween=function(t,e){i.normalize(t,o),i.normalize(e,s);const n=i.dot(o,s),r=i.magnitude(i.cross(o,s,o));return Math.atan2(r,n)};const c=new i;i.mostOrthogonalAxis=function(t,e){const n=i.normalize(t,c);return i.abs(n,n),e=n.x<=n.y?n.x<=n.z?i.clone(i.UNIT_X,e):i.clone(i.UNIT_Z,e):n.y<=n.z?i.clone(i.UNIT_Y,e):i.clone(i.UNIT_Z,e)},i.projectVector=function(t,e,n){const r=i.dot(t,e)/i.dot(e,e);return i.multiplyByScalar(e,r,n)},i.equals=function(t,e){return t===e||n.defined(t)&&n.defined(e)&&t.x===e.x&&t.y===e.y&&t.z===e.z},i.equalsArray=function(t,e,n){return t.x===e[n]&&t.y===e[n+1]&&t.z===e[n+2]},i.equalsEpsilon=function(t,e,i,a){return t===e||n.defined(t)&&n.defined(e)&&r.CesiumMath.equalsEpsilon(t.x,e.x,i,a)&&r.CesiumMath.equalsEpsilon(t.y,e.y,i,a)&&r.CesiumMath.equalsEpsilon(t.z,e.z,i,a)},i.cross=function(t,e,n){const r=t.x,i=t.y,a=t.z,u=e.x,o=e.y,s=e.z,c=i*s-a*o,l=a*u-r*s,f=r*o-i*u;return n.x=c,n.y=l,n.z=f,n},i.midpoint=function(t,e,n){return n.x=.5*(t.x+e.x),n.y=.5*(t.y+e.y),n.z=.5*(t.z+e.z),n},i.fromDegrees=function(t,e,n,a,u){return t=r.CesiumMath.toRadians(t),e=r.CesiumMath.toRadians(e),i.fromRadians(t,e,n,a,u)};let l=new i,f=new i;const d=new i(40680631590769,40680631590769,40408299984661.445);i.fromRadians=function(t,e
|