/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{b as e,e as t,i as r,j as n}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{surfaceElevationBelowRenderLocation as o}from"../intersectionUtils.js";function i(s,i,a=0){const f=s.state.constraints.collision;if(!f.enabled)return!1;const d=o(s,i.eye),m=s.renderCoordsHelper.getAltitude(i.eye),u=d+f.elevationMargin;if(m>=u)return!1;const y=e(i.eye);if(t(c,i.center,i.eye),i.eye=s.renderCoordsHelper.setAltitude(l,u,i.eye),1===a)i.center=r(c,i.eye,c);else if(2===a){const e=(y-m+u)/y;i.center=n(c,i.center,e)}return!0}const c=s(),l=s();export{i as applySurfaceCollisionConstraint};
