2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
define(["exports","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./BoundingSphere-561b54d0","./OrientedBoundingBox-f1d7843f"],(function(n,t,e,r,a,i){"use strict";var o={},u=new e.Cartesian3,s=new e.Cartesian3,C=new e.Cartesian3,d=new e.Cartesian3,c=new i.OrientedBoundingBox;function g(n,r,a,i,o){var s=e.Cartesian3.subtract(n,r,u),C=e.Cartesian3.dot(a,s),d=e.Cartesian3.dot(i,s);return t.Cartesian2.fromElements(C,d,o)}o.validOutline=function(n){var t=i.OrientedBoundingBox.fromPoints(n,c).halfAxes,r=a.Matrix3.getColumn(t,0,s),o=a.Matrix3.getColumn(t,1,C),u=a.Matrix3.getColumn(t,2,d),g=e.Cartesian3.magnitude(r),m=e.Cartesian3.magnitude(o),l=e.Cartesian3.magnitude(u);return!(0===g&&(0===m||0===l)||0===m&&0===l)},o.computeProjectTo2DArguments=function(n,t,r,o){var u,g,m=i.OrientedBoundingBox.fromPoints(n,c),l=m.halfAxes,f=a.Matrix3.getColumn(l,0,s),x=a.Matrix3.getColumn(l,1,C),B=a.Matrix3.getColumn(l,2,d),h=e.Cartesian3.magnitude(f),P=e.Cartesian3.magnitude(x),M=e.Cartesian3.magnitude(B),v=Math.min(h,P,M);return(0!==h||0!==P&&0!==M)&&(0!==P||0!==M)&&(v!==P&&v!==M||(u=f),v===h?u=x:v===M&&(g=x),v!==h&&v!==P||(g=B),e.Cartesian3.normalize(u,r),e.Cartesian3.normalize(g,o),e.Cartesian3.clone(m.center,t),!0)},o.createProjectPointsTo2DFunction=function(n,t,e){return function(r){for(var a=new Array(r.length),i=0;i<r.length;i++)a[i]=g(r[i],n,t,e);return a}},o.createProjectPointTo2DFunction=function(n,t,e){return function(r,a){return g(r,n,t,e,a)}},n.CoplanarPolygonGeometryLibrary=o}));
|