UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.7 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{i as t,g as r,h as e,s as n,f as s,c as o,n as i,e as f}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../chunks/sphere.js";import{planeFromPoints as u}from"../../support/mathUtils.js";import{geodesicArea as c}from"../../../support/geodesicAreaMeasurementUtils.js";function h(s,o){const i=a(o);t(i,0,0,0);for(let t=0;t<s.length;++t)r(i,i,s[t]);e(i,i,1/s.length);let f=0;for(let t=0;t<s.length;++t)f=Math.max(f,n(i,s[t]));o[3]=Math.sqrt(f)}function g(t,r){if(t.length<3)throw new Error("need at least 3 points to fit a plane");u(t[0],t[1],t[2],r)}function p(t,r){return s(t,r)+t[3]}function m(t,r,e,n){const s=x;return o(s.rings[0][0],t),o(s.rings[0][1],r),o(s.rings[0][2],e),o(s.rings[0][3],t),s.spatialReference=n,c(s)}function j(e,n=null,l=!0){const a=(t,r)=>{if(0===r[0]&&0===r[1]&&0===r[2])return!1;for(let e=0;e<t.length;++e)if(s(r,t[e])<-1e-6)return!1;return!0};if(0===e.length)return!1;if(1===e.length)return n&&o(n,e[0]),!0;t(y,0,0,0);for(let t=0;t<e.length;++t)r(y,y,e[t]);if(i(y,y),a(e,y))return n&&o(n,y),!0;if(!l)return!1;for(let t=0;t<e.length;++t)for(let r=0;r<e.length;++r)if(t!==r&&(f(y,e[t],e[r]),i(y,y),a(e,y)))return n&&o(n,y),!0;return!1}function M(t){return"mouse"!==t.pointerType||0===t.button}const x={hasM:!1,hasZ:!0,rings:[[l(),l(),l(),l()]],spatialReference:null,type:"polygon"},y=l();export{g as bestFitPlane,h as boundingSphere,j as fitHemisphere,M as isPrimaryPointerAction,p as planePointDistance,m as triangleAreaGeodesic};