2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
define(["exports","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./Math-119be1a3","./PrimitiveType-a54dc62f"],(function(n,a,e,t,r,i){"use strict";function o(n,e){this.normal=a.Cartesian3.clone(n),this.distance=e}o.fromPointNormal=function(n,e,r){var i=-a.Cartesian3.dot(e,n);return t.defined(r)?(a.Cartesian3.clone(e,r.normal),r.distance=i,r):new o(e,i)};var s=new a.Cartesian3;o.fromCartesian4=function(n,e){var r=a.Cartesian3.fromCartesian4(n,s),i=n.w;return t.defined(e)?(a.Cartesian3.clone(r,e.normal),e.distance=i,e):new o(r,i)},o.getPointDistance=function(n,e){return a.Cartesian3.dot(n.normal,e)+n.distance};var c=new a.Cartesian3;o.projectPointOntoPlane=function(n,e,r){t.defined(r)||(r=new a.Cartesian3);var i=o.getPointDistance(n,e),s=a.Cartesian3.multiplyByScalar(n.normal,i,c);return a.Cartesian3.subtract(e,s,r)};var l=new a.Cartesian3;o.transform=function(n,e,t){return i.Matrix4.multiplyByPointAsVector(e,n.normal,s),a.Cartesian3.normalize(s,s),a.Cartesian3.multiplyByScalar(n.normal,-n.distance,l),i.Matrix4.multiplyByPoint(e,l,l),o.fromPointNormal(l,s,t)},o.clone=function(n,e){return t.defined(e)?(a.Cartesian3.clone(n.normal,e.normal),e.distance=n.distance,e):new o(n.normal,n.distance)},o.equals=function(n,e){return n.distance===e.distance&&a.Cartesian3.equals(n.normal,e.normal)},o.ORIGIN_XY_PLANE=Object.freeze(new o(a.Cartesian3.UNIT_Z,0)),o.ORIGIN_YZ_PLANE=Object.freeze(new o(a.Cartesian3.UNIT_X,0)),o.ORIGIN_ZX_PLANE=Object.freeze(new o(a.Cartesian3.UNIT_Y,0)),n.Plane=o}));
|