/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../chunks/vec2f64","../../../chunks/vec3","../../../chunks/vec3f64","../../../geometry/support/plane"],(function(n,e,t,r,i){"use strict";function c(n,e,t){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]<t}function u(n,e,t){const r=e[0],i=e[1],c=e[2];return!(n[0][0]*r+n[0][1]*i+n[0][2]*c+n[0][3]>t)&&(!(n[1][0]*r+n[1][1]*i+n[1][2]*c+n[1][3]>t)&&(!(n[2][0]*r+n[2][1]*i+n[2][2]*c+n[2][3]>t)&&(!(n[3][0]*r+n[3][1]*i+n[3][2]*c+n[3][3]>t)&&(!(n[4][0]*r+n[4][1]*i+n[4][2]*c+n[4][3]>t)&&!(n[5][0]*r+n[5][1]*i+n[5][2]*c+n[5][3]>t)))))}function o(n,e,t,r){return m(n,e,null,d(r,e,t,!1))}function s(n,e){for(let t=0;t<6;t++){if(i.signedDistance(n[t],e)>0)return!1}return!0}function l(n,e,t,r){return m(n,e,t,d(r,e,t,!0))}function f(n,e,r,i){const c=t.dot(r,t.subtract(n,i,e));return t.add(n,e,t.scale(n,r,c))}const a={dir:r.create(),len:0,clip:e.create()};function d(n,e,r,i){const c=a;return n?(r&&i&&(c.len=t.distance(e,r)),t.copy(c.dir,n)):i?(c.len=t.distance(e,r),t.subtract(c.dir,r,e),t.scale(c.dir,c.dir,1/c.len)):(t.subtract(c.dir,r,e),t.normalize(c.dir,c.dir)),c}function p(n,e,r){const c=t.dot(i.normal(n),r.dir),u=-i.signedDistance(n,e);if(u<0&&c>=0)return!1;if(c>-1e-6&&c<1e-6)return u>0;if((u<0||c<0)&&!(u<0&&c<0))return!0;const o=u/c;return c>0?o<r.clip[1]&&(r.clip[1]=o):o>r.clip[0]&&(r.clip[0]=o),r.clip[0]<=r.clip[1]}function m(n,e,t,r){r.clip[0]=0,r.clip[1]=t?r.len:Number.MAX_VALUE;for(let i=0;i<n.length;i++)if(!p(n[i],e,r))return!1;return!0}n.closestPointOnRay=f,n.frustumLineSegment=l,n.frustumPoint=s,n.frustumRay=o,n.frustumSphere=u,n.planeSphere=c,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
