qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/EllipsoidTangentPlane-4d138...

2 lines
3.0 KiB
JavaScript
Raw Permalink Normal View History

2023-11-07 10:04:37 +08:00
define(["exports","./AxisAlignedBoundingBox-8774439c","./Cartesian2-bd414876","./Cartesian3-e0307675","./Matrix4-4c545f70","./Check-741c5f3c","./defaultValue-81eec7ed","./IntersectionTests-80510c7b","./Plane-bc8b6777","./Transforms-5b829630"],(function(t,n,e,i,o,r,s,a,l,c){"use strict";const d=new o.Cartesian4;function p(t,n){t=(n=s.defaultValue(n,e.Ellipsoid.WGS84)).scaleToGeodeticSurface(t);const r=c.Transforms.eastNorthUpToFixedFrame(t,n);this._ellipsoid=n,this._origin=t,this._xAxis=i.Cartesian3.fromCartesian4(o.Matrix4.getColumn(r,0,d)),this._yAxis=i.Cartesian3.fromCartesian4(o.Matrix4.getColumn(r,1,d));const a=i.Cartesian3.fromCartesian4(o.Matrix4.getColumn(r,2,d));this._plane=l.Plane.fromPointNormal(t,a)}Object.defineProperties(p.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});const f=new n.AxisAlignedBoundingBox;p.fromPoints=function(t,e){return new p(n.AxisAlignedBoundingBox.fromPoints(t,f).center,e)};const u=new a.Ray,h=new i.Cartesian3;p.prototype.projectPointOntoPlane=function(t,n){const o=u;o.origin=t,i.Cartesian3.normalize(t,o.direction);let r=a.IntersectionTests.rayPlane(o,this._plane,h);if(s.defined(r)||(i.Cartesian3.negate(o.direction,o.direction),r=a.IntersectionTests.rayPlane(o,this._plane,h)),s.defined(r)){const t=i.Cartesian3.subtract(r,this._origin,r),o=i.Cartesian3.dot(this._xAxis,t),a=i.Cartesian3.dot(this._yAxis,t);return s.defined(n)?(n.x=o,n.y=a,n):new e.Cartesian2(o,a)}},p.prototype.projectPointsOntoPlane=function(t,n){s.defined(n)||(n=[]);let e=0;const i=t.length;for(let o=0;o<i;o++){const i=this.projectPointOntoPlane(t[o],n[e]);s.defined(i)&&(n[e]=i,e++)}return n.length=e,n},p.prototype.projectPointToNearestOnPlane=function(t,n){s.defined(n)||(n=new e.Cartesian2);const o=u;o.origin=t,i.Cartesian3.clone(this._plane.normal,o.direction);let r=a.IntersectionTests.rayPlane(o,this._plane,h);s.defined(r)||(i.Cartesian3.negate(o.direction,o.direction),r=a.IntersectionTests.rayPlane(o,this._plane,h));const l=i.Cartesian3.subtract(r,this._origin,r),c=i.Cartesian3.dot(this._xAxis,l),d=i.Cartesian3.dot(this._yAxis,l);return n.x=c,n.y=d,n},p.prototype.projectPointsToNearestOnPlane=function(t,n){s.defined(n)||(n=[]);const e=t.length;n.length=e;for(let i=0;i<e;i++)n[i]=this.projectPointToNearestOnPlane(t[i],n[i]);return n};const x=new i.Cartesian3;p.prototype.projectPointOntoEllipsoid=function(t,n){s.defined(n)||(n=new i.Cartesian3);const e=this._ellipsoid,o=this._origin,r=this._xAxis,a=this._yAxis,l=x;return i.Cartesian3.multiplyByScalar(r,t.x,l),n=i.Cartesian3.add(o,l,n),i.Cartesian3.multiplyByScalar(a,t.y,l),i.Cartesian3.add(n,l,n),e.scaleToGeocentricSurface(n,n),n},p.prototype.projectPointsOntoEllipsoid=function(t,n){const e=t.length;s.defined(n)?n.length=e:n=new Array(e);for(let i=0;i<e;++i)n[i]=this.projectPointOntoEllipsoid(t[i],n[i]);return n},t.EllipsoidTangentPlane=p}));