@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.31 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{c as t,i as e,f as r,l as s,n as o,h as i}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,fromPositionAndNormal as a,intersectRay as p}from"../../../../geometry/support/plane.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as l}from"./GeometryUtil.js";function g(g,n){let v=null;const u=g.vertices.length,j=.99619469809,R=f(),y=f(),x=f(),L=f(),b=f(),k=f(),q=m();let G=g.vertices[0];t(y,n),e(R,0,1,0),l(G.vRight,y,R,R,x,y,j),t(G.frame.up,y),t(G.frame.right,x);const M=g.positions;let U=g.offset;v=G;for(let f=1;f<u;++f){G=g.vertices[f],r(b,G.vLeft,G.vRight);let m=s(b);m>0?(m=1/Math.sqrt(m),b[0]=b[0]*m,b[1]=b[1]*m,b[2]=b[2]*m):(b[0]=G.vRight[0],b[1]=G.vRight[1],b[2]=G.vRight[2]),k[0]=M[U]+v.frame.up[0],k[1]=M[U+1]+v.frame.up[1],k[2]=M[U+2]+v.frame.up[2],U+=3;const n=e(h,M[U],M[U+1],M[U+2]);a(n,b,q);p(q,c(k,G.vLeft),L)?(L[0]-=M[U],L[1]-=M[U+1],L[2]-=M[U+2],o(y,L),i(x,b,y),o(x,x)):l(b,v.frame.up,v.frame.right,R,x,y,j),t(G.frame.up,y),t(G.frame.right,x),v=G}}const h=f();export{g as computeMinimumRotationTangentFrame};