/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{castRenderScreenPointArray3 as r,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{n as t,e as o,d as i,h as c}from"../../../../chunks/vec32.js";import{create as u}from"../../../../geometry/support/ray.js";import{sv3d as s}from"../../../../geometry/support/vectorStacks.js";function l(r,n,o=u()){return m(r,e(n),o),t(o.direction,o.direction),o}function m(e,n,t){return g(e,e.screenToRender(n,r(s.get())),t)}function g(e,t,i){if(null==t)return null;const c=r(n(s.get(),t));if(c[2]=0,!e.unprojectFromRenderScreen(c,i.origin))return null;const u=r(n(s.get(),t));u[2]=1;const l=e.unprojectFromRenderScreen(u,s.get());return null==l?null:(o(i.direction,l,i.origin),i)}function p(e,n,t){return f(e,e.screenToRender(n,r(s.get())),t)}function f(r,e,n){i(n.origin,r.eye);const t=c(s.get(),e[0],e[1],1),u=r.unprojectFromRenderScreen(t,s.get());return null==u?null:(o(n.direction,u,n.origin),n)}export{g as fromRender,f as fromRenderAtEye,m as fromScreen,p as fromScreenAtEye,l as fromScreenNormalized};
