@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.33 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{m as t,d as e,n as s,h as r,g as i,c as o}from"../../../../../chunks/vec32.js";import{create as n,clone as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../../geometry/projection.js";import{getSphericalPCPF as a}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectVectorToVector as h}from"../../../../../geometry/projection/projectVectorToVector.js";import{sv3d as d}from"../../../../../geometry/support/vectorStacks.js";import{slerpTangent as l,slerp as m}from"../../../support/mathUtils.js";class f{constructor(t=n(),e=n()){this.startRenderSpace=t,this.endRenderSpace=e,this.type="euclidean"}eval(r,i,o){return t(i,this.startRenderSpace,this.endRenderSpace,r),o&&(e(o,this.endRenderSpace,this.startRenderSpace),s(o,o)),i}createRenderGeometry(t,s){const r=[],i=[],o=(s,o)=>{const n=j;e(n,s,t),r.push([n[0],n[1],n[2]]),i.push([o[0],o[1],o[2]])},n=s.worldUpAtPosition(this.eval(.5,R),d.get());return o(this.startRenderSpace,n),o(this.endRenderSpace,n),{points:r,normals:i}}static fromPositionAndVector(t,e,s=1){return r(R,e,s),i(R,t,R),new f(c(t),c(R))}}class _{_projectIn(t,e){this._project?h(t,this.renderSpatialReference,e,this._pcpf):o(e,t)}constructor(t,e,s){this.startRenderSpace=t,this.endRenderSpace=e,this.renderSpatialReference=s,this.type="geodesic",this._start=n(),this._end=n(),this._pcpf=a(s),this._project=p(s,this._pcpf),this._projectIn(t,this._start),this._projectIn(e,this._end)}eval(r,o,n){if(this._project)if(n){const t=j;l(this._start,this._end,r,o,t),i(S,o,t),h(o,this._pcpf,o,this.renderSpatialReference),h(S,this._pcpf,S,this.renderSpatialReference),e(n,S,o),s(n,n)}else m(this._start,this._end,r,o),h(o,this._pcpf,o,this.renderSpatialReference);else t(o,this._start,this._end,r),n&&(e(n,this._end,this._start),s(n,n));return o}createRenderGeometry(t,s){const r=[],i=[],o=(s,o)=>{const n=S;e(n,s,t),r.push([n[0],n[1],n[2]]),i.push([o[0],o[1],o[2]])},n=128+1&-2;for(let e=0;e<n;++e){const t=e/(n-1),r=R,i=j;this.eval(t,r),s.worldUpAtPosition(r,i),o(r,i)}return{points:r,normals:i}}}const R=n(),j=n(),S=n();export{f as EuclideanSegment,_ as GeodesicSegment};