/*
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/vec3","../../../../../chunks/vec3f64","../../../../../geometry/projection","../../../../../geometry/projectionEllipsoid","../../../../../geometry/support/vectorStacks","../../../support/mathUtils"],(function(e,t,r,n,c,s,i){"use strict";let o=function(){function e(e=r.create(),t=r.create()){this.startRenderSpace=e,this.endRenderSpace=t,this.type="euclidean"}var n=e.prototype;return n.eval=function(e,r,n){return t.lerp(r,this.startRenderSpace,this.endRenderSpace,e),n&&(t.subtract(n,this.endRenderSpace,this.startRenderSpace),t.normalize(n,n)),r},n.createRenderGeometry=function(e,r){const n=[],c=[],i=(r,s)=>{const i=d;t.subtract(i,r,e),n.push([i[0],i[1],i[2]]),c.push([s[0],s[1],s[2]])},o=r.worldUpAtPosition(this.eval(.5,h),s.sv3d.get());return i(this.startRenderSpace,o),i(this.endRenderSpace,o),{points:n,normals:c}},e.fromPositionAndVector=function(n,c,s=1){return t.scale(h,c,s),t.add(h,n,h),new e(r.clone(n),r.clone(h))},e}(),a=function(){function e(e,t,s){this.startRenderSpace=e,this.endRenderSpace=t,this.renderSpatialReference=s,this.type="geodesic",this._start=r.create(),this._end=r.create(),this._pcpf=c.getSphericalPCPF(s),this._project=n.canProjectWithoutEngine(s,this._pcpf),this._projectIn(e,this._start),this._projectIn(t,this._end)}var s=e.prototype;return s._projectIn=function(e,r){this._project?n.projectVectorToVector(e,this.renderSpatialReference,r,this._pcpf):t.copy(r,e)},s.eval=function(e,r,c){if(this._project)if(c){const s=d;i.slerpTangent(this._start,this._end,e,r,s),t.add(u,r,s),n.projectVectorToVector(r,this._pcpf,r,this.renderSpatialReference),n.projectVectorToVector(u,this._pcpf,u,this.renderSpatialReference),t.subtract(c,u,r),t.normalize(c,c)}else i.slerp(this._start,this._end,e,r),n.projectVectorToVector(r,this._pcpf,r,this.renderSpatialReference);else t.lerp(r,this._start,this._end,e),c&&(t.subtract(c,this._end,this._start),t.normalize(c,c));return r},s.createRenderGeometry=function(e,r){const n=[],c=[],s=(r,s)=>{const i=u;t.subtract(i,r,e),n.push([i[0],i[1],i[2]]),c.push([s[0],s[1],s[2]])},i=128+1&-2;for(let t=0;t<i;++t){const e=t/(i-1),n=h,c=d;this.eval(e,n),r.worldUpAtPosition(n,c),s(n,c)}return{points:n,normals:c}},e}();function p(e,t,r,n){switch(e){case"euclidean":return new o(t,r);case"geodesic":return new a(t,r,n)}}const h=r.create(),d=r.create(),u=r.create();e.EuclideanSegment=o,e.GeodesicSegment=a,e.createSegment=p,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
