/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{copy as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r,IDENTITY as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as e,length as s,add as a,copy as o,normalize as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c,UNIT_Z as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as m}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as l,copy as y}from"../../../../geometry/support/ray.js";class f{get ray(){return this._ray}get distanceInRenderSpace(){return null==this.distance?null:(e(g,this.ray.direction,this.distance),s(g))}withinDistance(t){return!!p(this)&&this.distanceInRenderSpace<=t}getIntersectionPoint(t){return!!p(this)&&(e(g,this.ray.direction,this.distance),a(t,this.ray.origin,g),!0)}getTransformedNormal(t){return o(u,this.normal),u[3]=0,m(u,u,this.transformation),o(t,u),n(t,t)}constructor(t){this.intersector=4,this.normal=c(),this.transformation=r(),this._ray=l(),this.init(t)}init(t){this.distance=this.target=this.drapedLayerOrder=this.renderPriority=null,this.intersector=4,y(t,this._ray)}set(r,e,s,a,n,c,m){this.intersector=r,this.distance=s,o(this.normal,a??h),t(this.transformation,n??i),this.target=e,this.drapedLayerOrder=c,this.renderPriority=m}copy(r){y(r.ray,this._ray),this.intersector=r.intersector,this.distance=r.distance,this.target=r.target,this.drapedLayerOrder=r.drapedLayerOrder,this.renderPriority=r.renderPriority,o(this.normal,r.normal),t(this.transformation,r.transformation)}}function p(t){return null!=t?.distance}const g=c(),u=d();export{f as IntersectorResult,p as isValidIntersectorResult};
