UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.2 kB
import{s as t,a as e,g as r,d as n,e as o,i as s,c as i,n as f,f as u}from"../../../../chunks/vec3.js";import{c as a}from"../../../../chunks/vec3f64.js";import{geodesicArea as c}from"../../../../geometry/geometryEngine.js";import l from"../../../../geometry/Polygon.js";import{projectPointToVector as m,projectPointToWGS84ComparableLonLat as g,projectVectorToWGS84ComparableLonLat as p}from"../../../../geometry/projection.js";import h from"../../../../geometry/SpatialReference.js";import{InverseGeodeticSolverResult as j,inverseGeodeticSolver as y}from"../../../../geometry/support/geodesicUtils.js";import{planeFromPoints as d}from"../../support/mathUtils.js";function w(o,s){const i=s.center;t(i,0,0,0);for(let t=0;t<o.length;++t)e(i,i,o[t]);r(i,i,1/o.length);let f=0;for(let t=0;t<o.length;++t)f=Math.max(f,n(i,o[t]));s.radius=Math.sqrt(f)}function P(t,e){if(t.length<3)throw new Error("need at least 3 points to fit a plane");d(t[0],t[1],t[2],e)}function M(t,e){return o(t,e)+t[3]}function b(t,e,r){return m(t,R,r)&&m(e,S,r)?s(R,S):0}function k(t,e){if(!g(t,R)||!g(e,S))return 0;const r=new j;return y(r,[R[0],R[1]],[S[0],S[1]]),r.distance}function q(t,e,r){const n=new j;return y(n,[t[0],t[1]],[e[0],e[1]],r),n.distance}function v(t,e,r,n){const o=G;return p(t,n,R)&&p(e,n,S)&&p(r,n,U)?(o.setPoint(0,0,R),o.setPoint(0,1,S),o.setPoint(0,2,U),Math.abs(c(o,"square-meters"))):0}function x(r,n=null,s=!0){const a=1e-6,c=(t,e)=>{if(0===e[0]&&0===e[1]&&0===e[2])return!1;for(let r=0;r<t.length;++r)if(o(e,t[r])<-a)return!1;return!0};if(0===r.length)return!1;if(1===r.length)return n&&i(n,r[0]),!0;t(T,0,0,0);for(let t=0;t<r.length;++t)e(T,T,r[t]);if(f(T,T),c(r,T))return n&&i(n,T),!0;if(!s)return!1;for(let t=0;t<r.length;++t)for(let e=0;e<r.length;++e)if(t!==e&&(u(T,r[t],r[e]),f(T,T),c(r,T)))return n&&i(n,T),!0;return!1}function E(t){return"mouse"!==t.pointerType||0===t.button}const R=a(),S=a(),U=a(),G=new l({rings:[[R,S,U]],spatialReference:h.WGS84}),T=a();export{P as bestFitPlane,w as boundingSphere,x as fitHemisphere,E as isPrimaryPointerAction,M as planePointDistance,b as segmentLengthEuclidean,k as segmentLengthGeodesic,q as segmentLengthGeodesicVector,v as triangleAreaGeodesic};