// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../../core/mathUtils ../../core/libs/gl-matrix-2/math/vec2 ../../core/libs/gl-matrix-2/factories/vec2f64 ../../chunks/vec32 ../../core/libs/gl-matrix-2/factories/vec3f64 ../../core/libs/gl-matrix-2/math/common ../../geometry/support/plane ../3d/support/mathUtils ./geometry2dUtils".split(" "),function(h,R,p,v,e,l,x,y,S,q){function K(b,{start:a,end:f,type:c},d=l.create()){b=e.sub(z,b,a);f=e.sub(A,f,a);b=e.dot(b,f)/e.dot(f,f);return e.scaleAndAdd(d,a,f,c===q.LineType.RAY?Math.max(b,0): b)}function L({start:b,end:a,type:f},c){const d=e.sub(z,c,b);a=e.sub(A,a,b);if(f===q.LineType.RAY&&e.dot(a,d)<-x.getEpsilon())return e.distance(b,c);b=e.cross(D,a,d);return e.len(b)/e.len(a)}function M(b,a){const f=b.start,c=a.start;var d=a.end;const k=e.sub(z,b.end,f);d=e.sub(A,d,c);var m=e.sub(D,c,f),g=e.cross(N,k,d),n=e.dot(m,g);if(!t(n,0))return[];n=e.sqrLen(g);if(t(n,0))return[];m=e.cross(O,m,d);g=e.dot(m,g)/n;g=e.scaleAndAdd(P,f,k,g);return b.type===q.LineType.RAY&&(b=e.sub(H,g,f),e.dot(k,b)< -x.getEpsilon())||a.type===q.LineType.RAY&&(a=e.sub(H,g,c),e.dot(d,a)<-x.getEpsilon())?[]:[l.clone(g)]}function Q({start:b,end:a,type:f},c){const d=e.sub(z,c,b);b=e.sub(A,a,b);a=e.cross(D,b,d);a=e.sqrLen(a)/e.sqrLen(b);const k=x.getEpsilon();if(a{const b=l.create(),a=l.create(),f=l.create();return({start:c,end:d},{center:k,radius:m,normal:g,slicePlane:n})=>{var r=y.fromPositionAndNormal(k,g,U);if(t(y.distance(r,c),0)&&t(y.distance(r,d),0)){S.tangentFrame(g,b,a);r=(w,u)=>{e.subtract(f,u,k);p.set(w,e.dot(f,b),e.dot(f,a));return w};d=q.intersectLineLikeAndCircle({start:r(C,c),end:r(F,d),type:q.LineType.LINE},v.ZEROS,m);c=[];for(const [w,u]of d)d=e.copy(l.create(), k),e.scaleAndAdd(d,d,b,w),e.scaleAndAdd(d,d,a,u),n&&!E(n,d)||c.push(d);return c}g=l.create();return y.intersectLine(r,c,d,g)?!t(e.distance(g,k),m)||n&&!E(n,g)?[]:[g]:[]}})();h.VerticalPlaneType=void 0;(function(b){b[b.PLANE=0]="PLANE";b[b.HALF_PLANE=1]="HALF_PLANE"})(h.VerticalPlaneType||(h.VerticalPlaneType={}));const T={[h.VerticalPlaneType.PLANE]:q.LineType.LINE,[h.VerticalPlaneType.HALF_PLANE]:q.LineType.RAY},C=v.create(),F=v.create(),z=l.create(),A=l.create(),D=l.create(),N=l.create(),O=l.create(), P=l.create(),H=l.create(),U=y.create(),G={start:l.create(),end:l.create(),type:q.LineType.LINE},W={start:l.create(),end:l.create(),type:q.LineType.LINE};Object.defineProperty(h,"LineType",{enumerable:!0,get:()=>q.LineType});h.intersectLineAndPoint=Q;h.intersectLineLikeAndCircle=V;h.intersectLineLikeAndVerticalCylinder=function({start:b,end:a,type:f},c,d){const k=[];a=e.subtract(z,a,b);var m=p.subtract(F,b,c);c=p.squaredLength(a);const g=2*p.dot(a,m);d=p.squaredLength(m)-d*d;d=g*g-4*c*d;0===d?(c=-g/ (2*c),(f===q.LineType.LINE||0<=c)&&k.push(e.scaleAndAdd(l.create(),b,a,c))):0a+c||uv.fromValues(f,c))};h.isClose=t;h.isPointInsidePlane=E;h.pointToLineLikeDistance=L;h.pointToVerticalCylinderDistance=function(b,a,f){return p.distance(b, a)-f};h.pointToVerticalPlaneDistance=function(b,a){return L(B(G,b[2],a),b)};h.pointsInsidePlane=function(b,a){return a.filter(f=>E(b,f))};h.projectPointToLineLike=K;h.projectPointToVerticalCylinder=function(b,a,f,c=l.create()){const d=p.subtract(C,b,a),k=p.length(d);p.scaleAndAdd(c,a,d,0===k?1:f/k);c[2]=b[2];return c};h.projectPointToVerticalPlane=function(b,a,f){return K(b,B(G,b[2],a),f)};h.vectorsHaveCloseZ=function(b,a){return t(b[2],a[2])};Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});