@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.15 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{distanceToSegmentSquared as t}from"../../../../geometry/support/coordsUtils.js";import{Point as n}from"../../../../geometry/support/TileClipper.js";const r=Number.POSITIVE_INFINITY,o=Math.PI,e=2*o,i=128/o,u=256/360,s=o/180,c=1/Math.LN2;function a(t,n){return(t%=n)>=0?t:t+n}function f(t){return a(t*i,256)}function l(t){return a(t*u,256)}function h(t){return Math.log(t)*c}function m(t){return t*t}function p(t,n,r){return t*(1-r)+n*r}function g(t,n,r){return t>=n&&t<=r||t>=r&&t<=n}const x=8,y=14,M=16;function d(t){return x+Math.max((t-y)*M,0)}function I(t,n,r){let o,e,i,u=0;for(const s of r){o=s.length;for(let r=1;r<o;++r){if(e=s[r-1],i=s[r],e.y>n==i.y>n)continue;(i.x-e.x)*(n-e.y)-(i.y-e.y)*(t-e.x)>0?u++:u--}}return 0!==u}function N(n,r,o,e){let i,u,s,c;const a=e*e;for(const f of o){const o=f.length;if(!(o<2)){i=f[0].x,u=f[0].y;for(let e=1;e<o;++e){if(s=f[e].x,c=f[e].y,t(n,r,i,u,s,c)<a)return!0;i=s,u=c}}}return!1}function w(t,n,r,o,e,i,u){const s=Math.max(o,Math.min(n,i))-n,c=Math.max(e,Math.min(r,u))-r;return s*s+c*c<=t*t}function P(t,r){if(0===r||Number.isNaN(r))return t;const o=[],e=new n(0,0),i=new n(0,0),u=new n(0,0);for(let s=0;s<t.length;s++){const c=t[s],a=[];for(let t=0;t<c.length;t++){const o=c[t-1],s=c[t],f=c[t+1];0===t?e.setCoords(0,0):e.assignSub(s,o).normalize().rightPerpendicular(),t===c.length-1?i.setCoords(0,0):i.assignSub(f,s).normalize().rightPerpendicular(),u.assignAdd(e,i).normalize();const l=u.x*i.x+u.y*i.y;0!==l&&u.scale(1/l),a.push(n.add(s,u.scale(r)))}o.push(a)}return o}function b(t,r,o,e){const i=new n(t[0],t[1]);if(i.scale(e),"viewport"===r){const t=-o*(Math.PI/180),n=Math.cos(t),r=Math.sin(t);i.rotate(n,r)}return i}export{g as between,e as c2pi,u as cDegTo256,s as cDegToRad,r as cInfinity,o as cPi,i as cRadTo256,l as degToByte,N as distanceFromToPolylineWithinThreshold,d as getTileMargins,p as interpolate,w as isCircleOverlapingRect,h as log2,P as offsetLine,I as pointInPolygon,a as positiveMod,f as radToByte,m as sqr,b as translateAnchor};