@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.74 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{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{set as e,transformMat2 as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_X as h,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as n,g as m,n as g,h as f,f as c,d as u,e as l,v 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){n(this.frame.up,t),m(D,this.vLeft,this.vRight),g(D,D),f(I,this.frame.up,c(D,this.frame.up)),u(k,D,I),g(k,k),l(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 h}get rotationAngle(){f(w,this.frame.up,c(this.frame.up,this.vLeft)),u(w,this.vLeft,w),p(w,w),g(w,w),f(y,this.frame.up,c(this.frame.up,this.vRight)),u(y,this.vRight,y),g(y,y),l(U,this.rotationFrameUp,this.vLeft);return Math.sign(c(U,this.vRight))*(Math.PI-t(c(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 a=i(Math.cos(.5*s));return e(t,(a-1+1)*r[0],r[1])}}class L extends R{get rotationFrameUp(){const t=Math.sign(c(this.frame.right,this.vRight));return l(A,this.vRight,this.vLeft),f(A,A,t),g(A,A)}get rotationRight(){const t=this.rotationFrameUp,i=c(t,this.frame.up),r=c(t,this.frame.right);return f(F,this.frame.up,-r),f(P,this.frame.right,i),m(F,F,P),g(F,F),j(S,this.frame,F),S}get rotationAngle(){const i=Math.sign(c(this.frame.right,this.vRight));return p(U,this.vLeft),-i*(Math.PI-t(c(U,this.vRight)))}get maxStretchDistance(){return Math.abs(this.vMinSiblingLength*i(Math.cos(.5*this.foldingAngle)))}applyMiterStretch(t,s){const e=this.rotationAngle;if(0===Math.abs(e))return s;const h=i(Math.cos(.5*e)),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 a(t,s,n)}}function j(t,i,r){e(t,c(r,i.right),c(r,i.up))}function d(t){switch(t){case b.World:return new x;case b.Path:return new L}}const A=v(),S=o(),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};