/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../core/maybe","../../../../chunks/mat4f64","../../../../chunks/vec3f64","../../../../geometry/projection","../../../../geometry/support/aaBoundingBox","../../../../geometry/support/coordsUtils","../../../../layers/graphics/dehydratedFeatures","./elevationAlignmentUtils","./graphicUtils","../../webgl-engine/lib/Object3D"],(function(e,t,n,o,r,i,a,c,l,s,p){"use strict";const u=o.create();function g(e,o,a,c,s,g,d,h){const m=a?a.length:0,y=e.clippingExtent;if(r.projectPointToVector(o,u,e.elevationProvider.spatialReference),t.isSome(y)&&!i.containsPoint(y,u))return null;r.projectPointToVector(o,u,e.renderCoordsHelper.spatialReference);const f=e.localOriginFactory.getOrigin(u),P=new p.Object3D({castShadow:!1,metadata:{layerUid:g,graphicUid:d,usesVerticalDistanceToGround:!0}});for(let t=0;t<m;t++){const e=n.IDENTITY;P.addGeometry(a[t],c[t],e,f,h)}return{object:P,sampledElevation:l.applyElevationAlignmentForHUD(P,o,e.elevationProvider,e.renderCoordsHelper,s)}}function d(e,t,n){const o=e.elevationContext,i=n.spatialReference;r.projectPointToVector(t,u,i),o.centerPointInElevationSR=c.makeDehydratedPoint(u[0],u[1],t.hasZ?u[2]:0,i)}function h(e){switch(e.type){case"point":return e;case"polygon":case"extent":return s.computeCentroid(e);case"polyline":{const t=e.paths[0];if(!t||0===t.length)return null;const n=a.getPointOnPath(t,a.getPathLength(t)/2);return c.makeDehydratedPoint(n[0],n[1],n[2],e.spatialReference)}case"mesh":return e.origin}return null}function m(e,t,n,o,r){const i=new Float64Array(3*e.length),a=new Float64Array(i.length);e.forEach(((e,t)=>{i[3*t+0]=e[0],i[3*t+1]=e[1],i[3*t+2]=e.length>2?e[2]:0}));const c=l.applyPerVertexElevationAlignment(i,t,0,a,0,i,0,i.length/3,n,o,r),s=null!=c;return{numVertices:e.length,position:i,mapPosition:a,projectionSuccess:s,sampledElevation:c}}e.createStageObjectForHUD=g,e.extendPointGraphicElevationContext=d,e.geometryToRenderInfo=m,e.placePointOnGeometry=h,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
