define(["exports","./Check-7b2a090c","./when-b60132fc","./Math-119be1a3"],(function(e,n,t,a){"use strict";function i(e,n,a){this.x=t.defaultValue(e,0),this.y=t.defaultValue(n,0),this.z=t.defaultValue(a,0)}i.fromSpherical=function(e,n){t.defined(n)||(n=new i);var a=e.clock,r=e.cone,u=t.defaultValue(e.magnitude,1),o=u*Math.sin(r);return n.x=o*Math.cos(a),n.y=o*Math.sin(a),n.z=u*Math.cos(r),n},i.fromElements=function(e,n,a,r){return t.defined(r)?(r.x=e,r.y=n,r.z=a,r):new i(e,n,a)},i.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.x=e.x,n.y=e.y,n.z=e.z,n):new i(e.x,e.y,e.z)},i.fromCartesian4=i.clone,i.packedLength=3,i.pack=function(e,n,a){return a=t.defaultValue(a,0),n[a++]=e.x,n[a++]=e.y,n[a]=e.z,n},i.unpack=function(e,n,a){return n=t.defaultValue(n,0),t.defined(a)||(a=new i),a.x=e[n++],a.y=e[n++],a.z=e[n],a},i.packArray=function(e,n){var a=e.length;t.defined(n)?n.length=3*a:n=new Array(3*a);for(var r=0;ra.CesiumMath.EPSILON12);return t.defined(o)?(o.x=d*b,o.y=s*E,o.z=f*O,o):new i(d*b,s*E,f*O)}function x(e,n,a){this.longitude=t.defaultValue(e,0),this.latitude=t.defaultValue(n,0),this.height=t.defaultValue(a,0)}x.fromRadians=function(e,n,a,i){return a=t.defaultValue(a,0),t.defined(i)?(i.longitude=e,i.latitude=n,i.height=a,i):new x(e,n,a)},x.fromDegrees=function(e,n,t,i){return e=a.CesiumMath.toRadians(e),n=a.CesiumMath.toRadians(n),x.fromRadians(e,n,t,i)};var g=new i,p=new i,M=new i,v=new i(1/6378137,1/6378137,1/6356752.314245179),w=new i(1/6378137,1/6378137,1/6378137),C=new i(1/40680631590769,1/40680631590769,1/40408299984661.445),q=new i(1/40680631590769,1/40680631590769,1/40680631590769),R=a.CesiumMath.EPSILON1;x.fromCartesian=function(e,n,r){var u=t.defined(n)?n.oneOverRadii:w,o=t.defined(n)?n.oneOverRadiiSquared:q,d=t.defined(n)?n._centerToleranceSquared:R;a.CesiumMath.equalsEpsilon(a.CesiumMath.Radius,6356752.314245179,a.CesiumMath.EPSILON10)&&(u=t.defined(n)?n.oneOverRadii:v,o=t.defined(n)?n.oneOverRadiiSquared:C);var s=z(e,u,o,d,p);if(t.defined(s)){var f=i.multiplyComponents(s,o,g);f=i.normalize(f,f);var l=i.subtract(e,s,M),c=Math.atan2(f.y,f.x),h=Math.asin(f.z),y=a.CesiumMath.sign(i.dot(l,e))*i.magnitude(l);return t.defined(r)?(r.longitude=c,r.latitude=h,r.height=y,r):new x(c,h,y)}},x.toCartesian=function(e,n,t){return i.fromRadians(e.longitude,e.latitude,e.height,n,t)},x.sphericalDistance=function(e,t,i,r){if(n.Check.defined("longitudeA",e),n.Check.defined("longitudeB",i),n.Check.defined("latitudeA",t),n.Check.defined("latitudeB",r),e===i&&t===r)return 0;var u=a.CesiumMath.toRadians(t),o=a.CesiumMath.toRadians(r),d=a.CesiumMath.toRadians(e),s=a.CesiumMath.toRadians(i),f=d*d+u*u,l=s*s+o*o,c=(f+l-((d-s)*(d-s)+(u-o)*(u-o)))/(2*Math.sqrt(f)*Math.sqrt(l));return c=a.CesiumMath.clamp(c,-1,1),Math.acos(c)*a.CesiumMath.Radius},x.clone=function(e,n){if(t.defined(e))return t.defined(n)?(n.longitude=e.longitude,n.latitude=e.latitude,n.height=e.height,n):new x(e.longitude,e.latitude,e.height)},x.equals=function(e,n){return e===n||t.defined(e)&&t.defined(n)&&e.longitude===n.longitude&&e.latitude===n.latitude&&e.height===n.height},x.equalsEpsilon=function(e,n,a){return e===n||t.defined(e)&&t.defined(n)&&Math.abs(e.longitude-n.longitude)<=a&&Math.abs(e.latitude-n.latitude)<=a&&Math.abs(e.height-n.height)<=a},x.ZERO=Object.freeze(new x(0,0,0)),x.prototype.clone=function(e){return x.clone(this,e)},x.prototype.equals=function(e){return x.equals(this,e)},x.prototype.equalsEpsilon=function(e,n){return x.equalsEpsilon(this,e,n)},x.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},e.Cartesian3=i,e.Cartographic=x,e.scaleToGeodeticSurface=z}));