@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.73 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{acosClamped as t,reciprocalClamped as i}from"../../../../core/mathUtils.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/mat2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat2f64.js";import{transformMat2 as e,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h,UNIT_X as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as n,h as m,g,n as f,f as c,u,d as l,c as p}from"../../../../chunks/vec32.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Frame2D as M}from"./PathExtruder.js";import{UpVectorAlignment as b}from"./PathGeometry.js";class R{constructor(){this.vLeft=v(),this.vRight=v(),this.vMinSiblingLength=0,this.frame=new M}setFrameFromUpVector(t){p(this.frame.up,t),c(D,this.vLeft,this.vRight),f(D,D),g(I,this.frame.up,n(D,this.frame.up)),l(k,D,I),f(k,k),m(this.frame.right,k,this.frame.up)}get foldingAngle(){return Math.PI-this.rotationAngle}}class x extends R{get rotationFrameUp(){return this.frame.up}get rotationRight(){return o}get rotationAngle(){g(w,this.frame.up,n(this.frame.up,this.vLeft)),l(w,this.vLeft,w),u(w,w),f(w,w),g(y,this.frame.up,n(this.frame.up,this.vRight)),l(y,this.vRight,y),f(y,y),m(U,this.rotationFrameUp,this.vLeft);return Math.sign(n(U,this.vRight))*(Math.PI-t(n(w,y)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength/Math.cos(.5*this.foldingAngle))}applyMiterStretch(t,r){const s=this.rotationAngle;if(Math.abs(s)<=0)return r;const e=i(Math.cos(.5*s));return a(t,(e-1+1)*r[0],r[1])}}class L extends R{get rotationFrameUp(){const t=Math.sign(n(this.frame.right,this.vRight));return m(A,this.vRight,this.vLeft),g(A,A,t),f(A,A)}get rotationRight(){const t=this.rotationFrameUp,i=n(t,this.frame.up),r=n(t,this.frame.right);return g(F,this.frame.up,-r),g(P,this.frame.right,i),c(F,F,P),f(F,F),j(S,this.frame,F),S}get rotationAngle(){const i=Math.sign(n(this.frame.right,this.vRight));return u(U,this.vLeft),-i*(Math.PI-t(n(U,this.vRight)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength*i(Math.cos(.5*this.foldingAngle)))}applyMiterStretch(t,s){const a=this.rotationAngle;if(0===Math.abs(a))return s;const h=i(Math.cos(.5*a)),o=this.rotationRight,n=r(E,1+(h-1)*o[0]*o[0],(h-1)*o[0]*o[1],(h-1)*o[0]*o[1],1+(h-1)*o[1]*o[1]);return e(t,s,n)}}function j(t,i,r){a(t,n(r,i.right),n(r,i.up))}function d(t){switch(t){case b.World:return new x;case b.Path:return new L}}const A=v(),S=h(),F=v(),P=v(),U=v(),w=v(),y=v(),I=v(),D=v(),k=v(),E=s();export{R as PathVertex,d as newPathVertex};