@wemap/geo 14.7.0 → 14.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@wemap/maths")):typeof define==`function`&&define.amd?define([`exports`,`@wemap/maths`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.Wemap=e.Wemap||{},e.Wemap.Geo={}),e.Wemap.Maths))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.defineProperty,r=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},i=r({CIRCUMFERENCE:()=>_,EARTH_GRAVITY:()=>s,ECCENTRICITY:()=>d,ECCENTRICITY_2:()=>f,ELLIPSOID_FLATNESS:()=>u,EPS_DEG_MM:()=>c,EPS_MM:()=>l,R_MAJOR:()=>a,R_MAJOR_2:()=>p,R_MAJOR_4:()=>m,R_MINOR:()=>o,R_MINOR_2:()=>h,R_MINOR_4:()=>g,SECOND_ECCENTRICITY_2:()=>v}),a=6378137,o=6356752.314245179,s=9.80665,c=1e-8,l=.001,u=1/298.257223563,d=Math.sqrt(u*(2-u)),f=d*d,p=a*a,m=p*p,h=o*o,g=h*h,_=a*2*Math.PI,v=(p-h)/h,y=class e{static VERIFY_TYPING=!1;static checkType(e){if(e!==null&&!(typeof e==`number`&&!isNaN(e))){if(Array.isArray(e)&&e.length===2){let[t,n]=e;if(typeof t==`number`&&!isNaN(t)&&typeof n==`number`&&!isNaN(n)){if(t>n||t===n)throw Error(`Invalid level range: [${t}, ${n}]`);return}}throw Error(`Unknown level format: ${e}`)}}static isRange(t){return e.VERIFY_TYPING&&e.checkType(t),Array.isArray(t)}static clone(t){return e.VERIFY_TYPING&&e.checkType(t),t===null?null:typeof t==`number`?t:[t[0],t[1]]}static fromString(t){if(t===null)return null;if(typeof t!=`string`||!t.length)throw Error(`argument must be a non empty string, got ${typeof t}`);if(!isNaN(Number(t)))return parseFloat(t);let n=e=>{let n=e.map(e=>Number(e));if(n.some(e=>Number.isNaN(e))||e.some(e=>!e.length))throw Error(`Cannot parse following level: ${t}`);return n},r=t.split(`;`);if(r.length>1){let t=n(r),i=Math.min(...t),a=Math.max(...t);return e.checkType([i,a]),[i,a]}else{let r=t.substring(1).indexOf(`-`)+1;if(r>0){let[i,a]=n([t.substring(0,r),t.substring(r+1)]);return e.checkType([i,a]),[i,a]}}throw Error(`Cannot parse following level: ${t}`)}static parse(t){if(t==null)return null;if(typeof t==`number`){if(Number.isNaN(t))throw Error(`level number must not be NaN`);return t}if(Array.isArray(t)){if(t.length!==2)throw Error(`level range must have exactly 2 elements, got ${t.length}`);let n=[t[0],t[1]];return e.checkType(n),e.clone(n)}if(typeof t==`string`)return e.fromString(t);throw Error(`Cannot parse level from ${typeof t}`)}static contains(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===n?!0:Array.isArray(t)?Array.isArray(n)?t[0]<=n[0]&&t[1]>=n[1]:n!==null&&t[0]<=n&&t[1]>=n:t===null||n===null?!1:t<=n[0]&&t>=n[1]}static intersection(t,n){if(e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===null||n===null)return null;if(e.equals(t,n))return e.clone(t);if(typeof t==`number`&&typeof n==`number`)return t===n?t:null;if(Array.isArray(t)&&!Array.isArray(n))return e.contains(t,n)?n:null;if(!Array.isArray(t)&&Array.isArray(n))return e.contains(n,t)?t:null;let r=Math.max(t[0],n[0]),i=Math.min(t[1],n[1]);return i===r?i:i<r?null:[r,i]}static intersect(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===null&&n===null||e.intersection(t,n)!==null}static union(t,n){if(e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===n)return e.clone(t);if(n===null||t===null)return null;let r,i;return!Array.isArray(t)&&!Array.isArray(n)?(r=Math.min(t,n),i=Math.max(t,n)):Array.isArray(t)&&!Array.isArray(n)?(r=Math.min(t[0],n),i=Math.max(t[1],n)):!Array.isArray(t)&&Array.isArray(n)?(r=Math.min(n[0],t),i=Math.max(n[1],t)):(r=Math.min(t[0],n[0]),i=Math.max(t[1],n[1])),r===i?r:[r,i]}static multiplyBy(t,n){return e.VERIFY_TYPING&&e.checkType(t),t===null?null:Array.isArray(t)?[t[0]*n,t[1]*n]:t*n}static toString(t){return e.VERIFY_TYPING&&e.checkType(t),t===null?null:Array.isArray(t)?t[0]+`;`+t[1]:String(t)}static equals(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===n?!0:Array.isArray(t)&&Array.isArray(n)?t[0]===n[0]&&t[1]===n[1]:!1}static diff(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===null||n===null?null:!Array.isArray(t)&&!Array.isArray(n)?n-t:Array.isArray(t)&&!Array.isArray(n)?t[0]===n?n-t[1]:t[1]===n?n-t[0]:null:Array.isArray(n)&&!Array.isArray(t)?t===n[0]?n[1]-t:t===n[1]?n[0]-t:null:e.equals(t,n)?0:null}};function b(e,n){let r=(0,t.deg2rad)(e),i=(0,t.deg2rad)(n);return{sinLat:Math.sin(r),cosLat:Math.cos(r),sinLng:Math.sin(i),cosLng:Math.cos(i)}}function x(e){return a/Math.sqrt(1-f*e**2)}function S(e){return o/(1-f*e**2)}function C(e,t,n){let{sinLat:r,cosLat:i,sinLng:a,cosLng:o}=b(e,t),s=x(r),c=(s+n)*i;return[c*o,c*a,(s*(1-f)+n)*r]}function w(e){let[n,r,i]=e,s=Math.hypot(n,r),c=Math.atan2(a*i,o*s),l=Math.atan2(i+o*v*Math.sin(c)**3,s-a*f*Math.cos(c)**3),u=Math.sin(l),d=s*Math.cos(l)+i*u-a*Math.sqrt(1-f*u**2);return[(0,t.rad2deg)(l),(0,t.rad2deg)(Math.atan2(r,n)),d]}function T(e,n){let r=(0,t.deg2rad)(e),i=(0,t.deg2rad)(n),a=Math.cos(r);return[a*Math.cos(i),a*Math.sin(i),Math.sin(r)]}function E(e){return[(0,t.rad2deg)(Math.atan2(e[2],Math.hypot(e[0],e[1]))),(0,t.rad2deg)(Math.atan2(e[1],e[0]))]}function D(e,t){return 2*Math.asin(Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])/2)}var O=class e{_lat;_lng;_alt=null;_level=null;_heightFromFloor=null;_heightFromGround=null;_ecef;_groundEcef=null;autoWrap=!0;constructor(e,t,n=null,r=null){this.lat=e,this.lng=t,this.alt=n,this.level=r,this._ecef=null}get lat(){return this._lat}set lat(e){if(Math.abs(e)<=90)this._lat=e;else throw Error(`lat argument is not in [-90; 90], value is ${e}`);this._ecef=null,this._groundEcef=null}get latitude(){return this._lat}set latitude(e){throw Error(`Please use Coordinates#lat setter instead of Coordinate#latitude`)}get lng(){return this._lng}set lng(e){this._lng=e,this.autoWrap&&this.wrap(),this._ecef=null,this._groundEcef=null}get longitude(){return this._lng}set longitude(e){throw Error(`Please use Coordinates#lng setter instead of Coordinate#longitude`)}get alt(){return this._alt}set alt(e){this._alt=e,this._ecef=null}get level(){return this._level}set level(e){y.checkType(e),this._level=e}get heightFromFloor(){return this._heightFromFloor}set heightFromFloor(e){this._heightFromFloor=e}get heightFromGround(){return this._heightFromGround}set heightFromGround(e){this._heightFromGround=e}clone(){let t=new e(this.lat,this.lng,this.alt);return this.level!==null&&(t.level=y.clone(this.level)),t}wrap(){(this._lng<=-180||this._lng>180)&&(this._lng=(0,t.wrap)(this._lng,-180,180))}static equals(e,t,n=c,r=l){return this.equalsWithoutLevel(e,t,n,r)?e===null||t===null||y.equals(e.level,t.level):!1}equals(t){return e.equals(this,t)}static equalsWithoutLevel(t,n,r=c,i=l){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)?!1:Math.abs(n.lat-t.lat)<r&&Math.abs(n.lng-t.lng)<r&&(t.alt===n.alt||t.alt!==null&&n.alt!==null&&Math.abs(n.alt-t.alt)<i)}equalsWithoutLevel(t,n=c,r=l){return e.equalsWithoutLevel(this,t,n,r)}destinationPoint(e,t,n=null){let r=this.clone();return r.move(e,t,n),r}move(e,t,n=null){let{sinLat:r,cosLat:i,sinLng:a,cosLng:o}=b(this.lat,this.lng),s=S(r),c=e/(2*s),l=2*s*Math.sin(c),u=l*Math.cos(c),d=u*Math.sin(t),p=u*Math.cos(t),m=-l*Math.sin(c),h=x(r),g=h*i,[_,v]=w([g*o-a*d-r*o*p+i*o*m,g*a+o*d-r*a*p+i*a*m,h*(1-f)*r+i*p+r*m]);if(this.lat=_,this.lng=v,n!==null){if(this.alt===null)throw Error(`Point altitude is not defined`);this.alt+=n}return this}distanceTo(e){let[n,r,i]=this.groundEcef,[a,o,s]=e.groundEcef,c=Math.hypot(a-n,o-r,s-i),l=S(Math.sin((0,t.deg2rad)((this.lat+e.lat)/2)));return 2*l*Math.asin(Math.min(1,c/(2*l)))}static distanceBetween(e,t){return e.distanceTo(t)}bearingTo(e){let t=this.groundEcef,n=e.groundEcef,r=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],{sinLat:o,cosLat:s,sinLng:c,cosLng:l}=b(this.lat,this.lng),u=-c*r+l*i,d=-o*l*r-o*c*i+s*a;return Math.atan2(u,d)}static bearingTo(e,t){return e.bearingTo(t)}get enuToEcefRotation(){let e=t.Quaternion.fromAxisAngle([0,0,1],Math.PI/2+(0,t.deg2rad)(this.lng)),n=t.Quaternion.fromAxisAngle([1,0,0],Math.PI/2-(0,t.deg2rad)(this.lat));return t.Quaternion.multiply(e,n)}get ecefToEnuRotation(){let e=t.Quaternion.fromAxisAngle([1,0,0],(0,t.deg2rad)(this.lat)-Math.PI/2),n=t.Quaternion.fromAxisAngle([0,0,1],-(0,t.deg2rad)(this.lng)-Math.PI/2);return t.Quaternion.multiply(e,n)}get ecef(){return this._ecef||=C(this.lat,this.lng,this.alt||0),this._ecef}get groundEcef(){return this.alt?(this._groundEcef||=C(this.lat,this.lng,0),this._groundEcef):this.ecef}static fromECEF(n){if(t.Vector3.norm(n)===0)throw Error(`ECEF vector cannot be the earth center`);let[r,i,a]=w(n),o=new e(r,i,a);return o._ecef=n,o}getSegmentProjection(n,r){let i=T(n.lat,n.lng),a=T(r.lat,r.lng),o=T(this.lat,this.lng),s=t.Vector3.cross(i,a);if(t.Vector3.norm(s)===0)return null;let c=t.Vector3.cross(o,s),l=t.Vector3.normalize(t.Vector3.cross(s,c));if(Math.abs(D(i,a)-D(i,l)-D(a,l))>.001/6378137)return null;let[u,d]=E(l),f;return n.alt!==null&&r.alt!==null&&(f=(n.alt+r.alt)/2),new e(u,d,f,y.union(n.level,r.level))}toString(){let e=`[`+this._lat.toFixed(7)+`, `+this._lng.toFixed(7);return this._alt!==null&&(e+=`, `+this._alt.toFixed(2)),this._level!==null&&(e+=`, [`+y.toString(this._level)+`]`),e+=`]`,e}toJson(){return{lat:Number(this.lat.toFixed(8)),lng:Number(this.lng.toFixed(8)),...this.alt!==null&&{alt:Number(this.alt.toFixed(3))},...this.level!==null&&{level:this.level}}}static fromJson(t){return new e(t.lat,t.lng,t.alt,t.level)}toCompressedJson(){return this.level===null?[Number(this.lat.toFixed(8)),Number(this.lng.toFixed(8))]:[Number(this.lat.toFixed(8)),Number(this.lng.toFixed(8)),this.level]}static fromCompressedJson(t){let n=new e(t[0],t[1]);return t.length>2&&(n.level=t[2]),n}},k=class e extends O{_time=null;_accuracy=null;_bearing=null;constructor(e,t,n=null,r=null,i=null,a=null,o=null){super(e,t,n,r),this.time=i,this.accuracy=a,this.bearing=o}get time(){return this._time}set time(e){this._time=e}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&e<0)throw Error(`accuracy argument is not a positive number`);this._accuracy=e}get bearing(){return this._bearing}set bearing(e){this._bearing=e===null?null:e%(2*Math.PI)}move(e,t,n=null){return super.move(e,t,n),this}destinationPoint(e,t,n=null){let r=this.clone();return r.move(e,t,n),r}static fromCoordinates(t){return new e(t.lat,t.lng,t.alt,t.level)}clone(){let t=e.fromCoordinates(super.clone());return t.time=this.time,t.accuracy=this.accuracy,t.bearing=this.bearing,t}static equals(t,n,r=c,i=l){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)||!super.equals(t,n,r,i)?!1:t.time===n.time&&t.accuracy===n.accuracy&&t.bearing===n.bearing}equals(t,n=c,r=l){return e.equals(this,t,n,r)}toJson(){return{...super.toJson(),...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy},...this.bearing!==null&&{bearing:this.bearing}}}static fromJson(t){let n=e.fromCoordinates(O.fromJson(t));return t.time!==void 0&&(n.time=t.time),t.accuracy!==void 0&&(n.accuracy=t.accuracy),t.bearing!==void 0&&(n.bearing=t.bearing),n}},A=r({calcDistance:()=>F,createSegmentsAtLevel:()=>ee,geolocationPositionToUserPosition:()=>P,sampleRoute:()=>j,segmentIntersection:()=>te,simplifyRoute:()=>N,trimRoute:()=>M});function j(e,t=.7,n=0,r=Number.MAX_VALUE){let i=n+r,a=[],o,s=0,c=0,l=!1;for(let r=0;r<e.length-1;r++){let u=e[r],d=e[r+1],f=u.distanceTo(d),p=u.bearingTo(d),m=0;if(!l)if(n<s+f)l=!0,c=n-s;else{s+=f;continue}for(o=Object.assign(u.clone(),{bearing:p});m+c<f&&s+c<=i;){let e=o.destinationPoint(c,p);e.bearing=p,a.push(e),o=e,m+=c,s+=c,c=t}if(s+c>i)break;let h=f-m;s+=h,c-=h}return a}function M(e,t=e[0],n=Number.MAX_VALUE){let r=[],i=null,a,o=0;if(e.length<=1)throw Error(`Route must have at least 2 points`);for(a=1;a<e.length;a++){let n=e[a-1],o=e[a];if(O.equals(t,n)){r.push(n),i=n;break}let s=t.getSegmentProjection(n,o);if(s&&O.equals(t,s)&&!s.equals(o)){r.push(s),i=s;break}}if(!r.length)throw Error(`startPosition is not on the route`);for(;i&&a<e.length;){let t=e[a],s=i.distanceTo(t);if(o+s>=n||Math.abs(o+s-n)<=.001){let e=i.bearingTo(t),a=n-o,s=i.destinationPoint(a,e);r.push(s);break}r.push(t),i=t,o+=s,a++}return r}function N(e,n=(0,t.deg2rad)(5)){let r=e[0].equals(e[e.length-1]),i=e.slice(0,e.length-+!!r),a=i.length;for(let o=+!r;o<a;o++){let r=e[(0,t.positiveMod)(o-1,a)],s=e[o],c=e[(0,t.positiveMod)(o+1,a)],l=r.bearingTo(s),u=s.bearingTo(c);Math.abs(u-l)<n&&(i=i.filter(e=>e!==s))}return r&&i.push(i[0]),i}function P(e){if(e===null)return null;let{latitude:n,longitude:r,accuracy:i,heading:a}=e.coords,o=new k(n,r);return o.time=e.timestamp,o.accuracy=i,o.bearing=a?(0,t.deg2rad)(a):null,o}function F(e){return e.reduce((e,t,n,r)=>e+(n?r[n-1].distanceTo(t):0),0)}function ee(e,t,n=!0){let r=e.length,i=!1,a=[],o=[];for(let s=0;s<r;s++){let r=e[s],c=y.intersect(t,r.level);n&&!c&&i?o.push(r):c&&(i||(o=[],a.push(o),n&&s!==0&&o.push(e[s-1])),o.push(r)),i=c}return a}function te(e,t,n,r){let i=e=>e*Math.PI/180,o=(e.lat+t.lat+n.lat+r.lat)/4,s=a*180/Math.PI,c=a*180/Math.PI*Math.cos(i(o)),l=e=>({x:e.lng*c,y:e.lat*s}),u=l(e),d=l(t),f=l(n),p=l(r),m=d.x-u.x,h=d.y-u.y,g=p.x-f.x,_=p.y-f.y,v=m*_-h*g;if(Math.abs(v)<1e-10)return null;let y=f.x-u.x,b=f.y-u.y,x=(y*_-b*g)/v,S=(y*h-b*m)/v;return x<0||x>1||S<0||S>1?null:new O((u.y+x*h)/s,(u.x+x*m)/c)}var I=class e{northEast;southWest;constructor(e,t){if(this.northEast=e,this.southWest=t,this.northEast&&this.southWest&&this.getNorth()<this.getSouth())throw Error(`Incorrect bounding box`)}get center(){return new O((this.southWest.lat+this.northEast.lat)/2,(this.northEast.lng+this.southWest.lng)/2)}contains(e){return e.lat<=this.northEast.lat&&e.lat>=this.southWest.lat&&e.lng<=this.northEast.lng&&e.lng>=this.southWest.lng}extend(t){let n=this.southWest,r=this.northEast,i,a;if(t instanceof O)i=t,a=t;else if(t instanceof e)i=t.southWest,a=t.northEast;else throw Error(`Unknown parameter`);return this.southWest=new O(Math.min(i.lat,n.lat),Math.min(i.lng,n.lng)),this.northEast=new O(Math.max(a.lat,r.lat),Math.max(a.lng,r.lng)),this}extendsWithMeasure(e){if(typeof e!=`number`)throw Error(`measure is not a number`);return this.northEast=this.northEast.destinationPoint(e,0).move(e,Math.PI/2),this.southWest=this.southWest.clone().destinationPoint(e,-Math.PI/2).destinationPoint(e,Math.PI),this}pad(e){let t=this.southWest,n=this.northEast,r=Math.abs(t.lat-n.lat)*e,i=Math.abs(t.lng-n.lng)*e;return this.southWest=new O(t.lat-r,t.lng-i),this.northEast=new O(n.lat+r,n.lng+i),this}getSouthWest(){return this.southWest}getNorthEast(){return this.northEast}getNorthWest(){return new O(this.getNorth(),this.getWest())}getSouthEast(){return new O(this.getSouth(),this.getEast())}getWest(){return this.southWest.lng}getSouth(){return this.southWest.lat}getEast(){return this.northEast.lng}getNorth(){return this.northEast.lat}static equals(e,t){return O.equals(e.northEast,t.northEast)&&O.equals(e.southWest,t.southWest)}equals(t){return e.equals(this,t)}static fromArray(t){return new e(new O(t[3],t[2]),new O(t[1],t[0]))}static fromCoordinates(t){return t.length===0?null:t.reduce((e,t)=>e.extend(t),new e(t[0],t[0]))}toArray(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()]}},L=class e{x;y;z;time=null;_accuracy=null;_bearing=null;constructor(e,t,n,r=null,i=null,a=null){this.x=e,this.y=t,this.z=n,this.time=r,this.accuracy=i,this.bearing=a}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&e<0)throw Error(`accuracy argument is not a positive number`);this._accuracy=e}get bearing(){return this._bearing}set bearing(e){this._bearing=e===null?null:e%(2*Math.PI)}clone(){return new e(this.x,this.y,this.z,this.time,this.accuracy,this.bearing)}static equals(t,n,r=l){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)?!1:Math.abs(n.x-t.x)<r&&Math.abs(n.y-t.y)<r&&Math.abs(n.z-t.z)<r&&t.time===n.time&&t.accuracy===n.accuracy&&t.bearing===n.bearing}equals(t){return e.equals(this,t)}toJson(){return{x:this.x,y:this.y,z:this.z,...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy},...this.bearing!==null&&{bearing:this.bearing}}}static fromJson(t){return new e(t.x,t.y,t.z,t.time,t.accuracy,t.bearing)}},R=class extends L{},z=11102230246251565e-32,B=134217729,V=3.000000000000001*z;function H(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[p++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[p++]=s);return(a!==0||p===0)&&(i[p++]=a),p}function U(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function W(e){return new Float64Array(e)}var G=(3+16*z)*z,K=(2+12*z)*z,q=(9+64*z)*z*z,J=W(4),Y=W(8),X=W(12),Z=W(16),Q=W(4);function ne(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=B*T,p=f-(f-T),m=T-p,f=B*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=B*D,p=f-(f-D),m=D-p,f=B*E,h=f-(f-E),g=E-h,C=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m*h-p*g),_=x-C,d=x-_,Q[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,Q[1]=y-(_+d)+(d-S),w=v+_,d=w-v,Q[2]=v-(w-d)+(_-d),Q[3]=w,Z[H(M,X,4,Q,Z)-1]}function re(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=G*l?c:-ne(e,t,n,r,i,a,l)}(7+56*z)*z,(3+28*z)*z,(26+288*z)*z*z,W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(8),W(8),W(8),W(4),W(8),W(8),W(16),W(12),W(192),W(192),(10+96*z)*z,(4+48*z)*z,(44+576*z)*z*z,W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(8),W(8),W(8),W(8),W(8),W(8),W(8),W(8),W(8),W(4),W(4),W(4),W(8),W(16),W(16),W(16),W(32),W(32),W(48),W(64),W(1152),W(1152),(16+224*z)*z,(5+72*z)*z,(71+1408*z)*z*z,W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(1152),W(1152),W(1152),W(1152),W(1152),W(2304),W(2304),W(3456),W(5760),W(8),W(8),W(8),W(16),W(24),W(48),W(48),W(96),W(192),W(384),W(384),W(384),W(768),W(96),W(96),W(96),W(1152);function ie(e,t){var n,r,i=0,a,o,s,c,l,u,d,f=e[0],p=e[1],m=t.length;for(n=0;n<m;n++){r=0;var h=t[n],g=h.length-1;if(u=h[0],u[0]!==h[g][0]&&u[1]!==h[g][1])throw Error(`First and last coordinates in a ring must be the same`);for(o=u[0]-f,s=u[1]-p;r<g;r++){if(d=h[r+1],c=d[0]-f,l=d[1]-p,s===0&&l===0){if(c<=0&&o>=0||o<=0&&c>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(a=re(o,c,s,l,0,0),a===0)return 0;(a>0&&l>0&&s<=0||a<0&&l<=0&&s>0)&&i++}u=d,s=l,o=c}}return i%2!=0}function ae(e){if(!e)throw Error(`coord is required`);if(!Array.isArray(e)){if(e.type===`Feature`&&e.geometry!==null&&e.geometry.type===`Point`)return[...e.geometry.coordinates];if(e.type===`Point`)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw Error(`coord must be GeoJSON Point or an Array of numbers`)}function oe(e){return e.type===`Feature`?e.geometry:e}function se(e,t,n={}){if(!e)throw Error(`point is required`);if(!t)throw Error(`polygon is required`);let r=ae(e),i=oe(t),a=i.type,o=t.bbox,s=i.coordinates;if(o&&ce(r,o)===!1)return!1;a===`Polygon`&&(s=[s]);let c=!1;for(var l=0;l<s.length;++l){let e=ie(r,s[l]);if(e===0)return!n.ignoreBoundary;e&&(c=!0)}return c}function ce(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}var le=se,ue=class e{scale=1;heading=0;origin;buildingLevels;constructor(e,t=[]){this.origin=e,this.buildingLevels=t}localToWorld(e){let n=t.Vector3.multiplyScalar(e,this.scale),r=t.Quaternion.fromAxisAngle([0,0,1],-this.heading),i=t.Quaternion.multiply(this.origin.enuToEcefRotation,r),a=t.Quaternion.rotate(i,n),o=t.Vector3.sum(this.origin.ecef,a),s=O.fromECEF(o),c=s.alt;s.heightFromGround=s.alt-this.origin.alt;let l=e=>{s.level=e.id,s.heightFromFloor=c-e.floorAltitude};if(!this.buildingLevels.length)return s;let u=this.buildingLevels.filter(e=>c>=e.floorAltitude&&c<=e.ceilingAltitude);if(!u.length)return s;let d=u[0],f=[s.lng,s.lat],p=u.filter(e=>e.geometries.length);if(!p.length)return l(d),s;let m=p.filter(e=>e.geometries.some(e=>le(f,e)))[0];return m&&l(m),s}worldToLocal(e){let n=t.Quaternion.fromAxisAngle([0,0,1],this.heading),r=t.Quaternion.multiply(n,this.origin.ecefToEnuRotation),i=t.Vector3.subtract(e.ecef,this.origin.ecef),a=t.Vector3.multiplyScalar(i,1/this.scale);return t.Quaternion.rotate(r,a)}toJson(){return{origin:this.origin.toJson(),...this.scale!==1&&{scale:this.scale},...this.heading!==0&&{heading:this.heading}}}static fromJson(t){let n=new e(O.fromJson(t.origin));return n.scale=t.scale===void 0?1:t.scale,n.heading=t.heading===void 0?0:t.heading,n}},$=class e{_quaternion=[1,0,0,0];_heading=null;_eulerAngles=null;_time=null;_accuracy=null;constructor(e,t=null,n=null){this.quaternion=e,this.time=t,this.accuracy=n}static unitary(){return new e([1,0,0,0])}get quaternion(){return this._quaternion}set quaternion(e){if(Math.abs(1-t.Quaternion.norm(e))>1e-4)throw Error(`quaternion is not a unit quaternion`);this._quaternion=e,this._heading=null,this._eulerAngles=null}get time(){return this._time}set time(e){this._time=e}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&(e<0||e>Math.PI))throw Error(`accuracy argument (`+e+`) is not in range [0; PI]`);this._accuracy=e}get eulerAngles(){return this._eulerAngles===null&&(this._eulerAngles=t.Rotations.quaternionToEulerZXY(this.quaternion)),this._eulerAngles}get eulerAnglesDegrees(){return this.eulerAngles.map(e=>(0,t.rad2deg)(e))}get heading(){if(this._heading===null){let e=0;typeof window<`u`&&window&&window.orientation&&(e=(0,t.deg2rad)(window.orientation)),this._heading=t.Rotations.getHeadingFromQuaternion(this.quaternion)+e}return this._heading}get headingDegrees(){return(0,t.rad2deg)(this.heading)}static equals(n,r){return n===null&&n===r?!0:!(n instanceof e)||!(r instanceof e)?!1:n===r||t.Quaternion.equals(n.quaternion,r.quaternion)}equals(t){return e.equals(this,t)}toJson(){return this.time===null&&this.accuracy===null?this.quaternion:{q:this.quaternion,...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy}}}static fromJson(t){return Array.isArray(t)?new e(t,null,null):new e(t.q,t.time,t.accuracy)}clone(){return new e(this.quaternion.slice(0),this.time,this.accuracy)}static diff(n,r){let i=t.Quaternion.multiply(t.Quaternion.inverse(n.quaternion),r.quaternion),a=null;r.time!==null&&n.time!==null&&(a=r.time-n.time);let o=null;return n.accuracy!==null&&r.accuracy!==null&&(o=Math.max(r.accuracy-n.accuracy)),new e(i,a,o)}};e.AbsoluteHeading=class e{heading;time=null;_accuracy=null;constructor(e,t=null,n=null){this.heading=e,this.time=t,this.accuracy=n}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&(e<0||e>Math.PI))throw Error(`accuracy argument (`+e+`) is not in range [0; PI]`);this._accuracy=e}toAttitude(){return new $(t.Quaternion.fromAxisAngle([0,0,1],-this.heading),this.time,this.accuracy)}static equals(t,n){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)?!1:Math.abs(t.heading-n.heading)<1e-8}equals(t){return e.equals(this,t)}toJson(){return{heading:this.heading,...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy}}}static fromJson(t){return new e(t.heading,t.time,t.accuracy)}clone(){return new e(this.heading,this.time,this.accuracy)}},e.Attitude=$,e.BoundingBox=I,Object.defineProperty(e,"Constants",{enumerable:!0,get:function(){return i}}),e.Coordinates=O,e.GeoRef=ue,e.GeoRelativePosition=R,e.Level=y,e.RelativePosition=L,e.UserPosition=k,Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return A}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@wemap/maths")):typeof define==`function`&&define.amd?define([`exports`,`@wemap/maths`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.Wemap=e.Wemap||{},e.Wemap.Geo={}),e.Wemap.Maths))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.defineProperty,r=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},i=r({CIRCUMFERENCE:()=>_,EARTH_GRAVITY:()=>s,ECCENTRICITY:()=>d,ECCENTRICITY_2:()=>f,ELLIPSOID_FLATNESS:()=>u,EPS_DEG_MM:()=>c,EPS_MM:()=>l,R_MAJOR:()=>a,R_MAJOR_2:()=>p,R_MAJOR_4:()=>m,R_MINOR:()=>o,R_MINOR_2:()=>h,R_MINOR_4:()=>g,SECOND_ECCENTRICITY_2:()=>v}),a=6378137,o=6356752.314245179,s=9.80665,c=1e-8,l=.001,u=1/298.257223563,d=Math.sqrt(u*(2-u)),f=d*d,p=a*a,m=p*p,h=o*o,g=h*h,_=a*2*Math.PI,v=(p-h)/h,y=class e{static VERIFY_TYPING=!1;static checkType(e){if(e!==null&&!(typeof e==`number`&&!isNaN(e))){if(Array.isArray(e)&&e.length===2){let[t,n]=e;if(typeof t==`number`&&!isNaN(t)&&typeof n==`number`&&!isNaN(n)){if(t>n||t===n)throw Error(`Invalid level range: [${t}, ${n}]`);return}}throw Error(`Unknown level format: ${e}`)}}static isRange(t){return e.VERIFY_TYPING&&e.checkType(t),Array.isArray(t)}static clone(t){return e.VERIFY_TYPING&&e.checkType(t),t===null?null:typeof t==`number`?t:[t[0],t[1]]}static fromString(t){if(t===null)return null;if(typeof t!=`string`||!t.length)throw Error(`argument must be a non empty string, got ${typeof t}`);if(!isNaN(Number(t)))return parseFloat(t);let n=e=>{let n=e.map(e=>Number(e));if(n.some(e=>Number.isNaN(e))||e.some(e=>!e.length))throw Error(`Cannot parse following level: ${t}`);return n},r=t.split(`;`);if(r.length>1){let t=n(r),i=Math.min(...t),a=Math.max(...t);return e.checkType([i,a]),[i,a]}else{let r=t.substring(1).indexOf(`-`)+1;if(r>0){let[i,a]=n([t.substring(0,r),t.substring(r+1)]);return e.checkType([i,a]),[i,a]}}throw Error(`Cannot parse following level: ${t}`)}static parse(t){if(t==null)return null;if(typeof t==`number`){if(Number.isNaN(t))throw Error(`level number must not be NaN`);return t}if(Array.isArray(t)){if(t.length!==2)throw Error(`level range must have exactly 2 elements, got ${t.length}`);let n=[t[0],t[1]];return e.checkType(n),e.clone(n)}if(typeof t==`string`)return e.fromString(t);throw Error(`Cannot parse level from ${typeof t}`)}static contains(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===n?!0:Array.isArray(t)?Array.isArray(n)?t[0]<=n[0]&&t[1]>=n[1]:n===null?!1:t[0]<=n&&t[1]>=n||t[1]<=n&&t[0]>=n:t===null||n===null?!1:t<=n[0]&&t>=n[1]}static intersection(t,n){if(e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===null||n===null)return null;if(e.equals(t,n))return e.clone(t);if(typeof t==`number`&&typeof n==`number`)return t===n?t:null;if(Array.isArray(t)&&!Array.isArray(n))return e.contains(t,n)?n:null;if(!Array.isArray(t)&&Array.isArray(n))return e.contains(n,t)?t:null;let r=Math.max(t[0],n[0]),i=Math.min(t[1],n[1]);return i===r?i:i<r?null:[r,i]}static intersect(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===null&&n===null||e.intersection(t,n)!==null}static union(t,n){if(e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===n)return e.clone(t);if(n===null||t===null)return null;let r,i;return!Array.isArray(t)&&!Array.isArray(n)?(r=Math.min(t,n),i=Math.max(t,n)):Array.isArray(t)&&!Array.isArray(n)?(r=Math.min(t[0],n),i=Math.max(t[1],n)):!Array.isArray(t)&&Array.isArray(n)?(r=Math.min(n[0],t),i=Math.max(n[1],t)):(r=Math.min(t[0],n[0]),i=Math.max(t[1],n[1])),r===i?r:[r,i]}static multiplyBy(t,n){return e.VERIFY_TYPING&&e.checkType(t),t===null?null:Array.isArray(t)?[t[0]*n,t[1]*n]:t*n}static toString(t){return e.VERIFY_TYPING&&e.checkType(t),t===null?null:Array.isArray(t)?t[0]+`;`+t[1]:String(t)}static equals(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===n?!0:Array.isArray(t)&&Array.isArray(n)?t[0]===n[0]&&t[1]===n[1]:!1}static diff(t,n){return e.VERIFY_TYPING&&(e.checkType(t),e.checkType(n)),t===null||n===null?null:!Array.isArray(t)&&!Array.isArray(n)?n-t:Array.isArray(t)&&!Array.isArray(n)?t[0]===n?n-t[1]:t[1]===n?n-t[0]:null:Array.isArray(n)&&!Array.isArray(t)?t===n[0]?n[1]-t:t===n[1]?n[0]-t:null:e.equals(t,n)?0:null}};function b(e,n){let r=(0,t.deg2rad)(e),i=(0,t.deg2rad)(n);return{sinLat:Math.sin(r),cosLat:Math.cos(r),sinLng:Math.sin(i),cosLng:Math.cos(i)}}function x(e){return a/Math.sqrt(1-f*e**2)}function S(e){return o/(1-f*e**2)}function C(e,t,n){let{sinLat:r,cosLat:i,sinLng:a,cosLng:o}=b(e,t),s=x(r),c=(s+n)*i;return[c*o,c*a,(s*(1-f)+n)*r]}function w(e){let[n,r,i]=e,s=Math.hypot(n,r),c=Math.atan2(a*i,o*s),l=Math.atan2(i+o*v*Math.sin(c)**3,s-a*f*Math.cos(c)**3),u=Math.sin(l),d=s*Math.cos(l)+i*u-a*Math.sqrt(1-f*u**2);return[(0,t.rad2deg)(l),(0,t.rad2deg)(Math.atan2(r,n)),d]}function T(e,n){let r=(0,t.deg2rad)(e),i=(0,t.deg2rad)(n),a=Math.cos(r);return[a*Math.cos(i),a*Math.sin(i),Math.sin(r)]}function E(e){return[(0,t.rad2deg)(Math.atan2(e[2],Math.hypot(e[0],e[1]))),(0,t.rad2deg)(Math.atan2(e[1],e[0]))]}function D(e,t){return 2*Math.asin(Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])/2)}var O=class e{_lat;_lng;_alt=null;_level=null;_heightFromFloor=null;_heightFromGround=null;_ecef;_groundEcef=null;autoWrap=!0;constructor(e,t,n=null,r=null){this.lat=e,this.lng=t,this.alt=n,this.level=r,this._ecef=null}get lat(){return this._lat}set lat(e){if(Math.abs(e)<=90)this._lat=e;else throw Error(`lat argument is not in [-90; 90], value is ${e}`);this._ecef=null,this._groundEcef=null}get latitude(){return this._lat}set latitude(e){throw Error(`Please use Coordinates#lat setter instead of Coordinate#latitude`)}get lng(){return this._lng}set lng(e){this._lng=e,this.autoWrap&&this.wrap(),this._ecef=null,this._groundEcef=null}get longitude(){return this._lng}set longitude(e){throw Error(`Please use Coordinates#lng setter instead of Coordinate#longitude`)}get alt(){return this._alt}set alt(e){this._alt=e,this._ecef=null}get level(){return this._level}set level(e){y.checkType(e),this._level=e}get heightFromFloor(){return this._heightFromFloor}set heightFromFloor(e){this._heightFromFloor=e}get heightFromGround(){return this._heightFromGround}set heightFromGround(e){this._heightFromGround=e}clone(){let t=new e(this.lat,this.lng,this.alt);return this.level!==null&&(t.level=y.clone(this.level)),t}wrap(){(this._lng<=-180||this._lng>180)&&(this._lng=(0,t.wrap)(this._lng,-180,180))}static equals(e,t,n=c,r=l){return this.equalsWithoutLevel(e,t,n,r)?e===null||t===null||y.equals(e.level,t.level):!1}equals(t){return e.equals(this,t)}static equalsWithoutLevel(t,n,r=c,i=l){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)?!1:Math.abs(n.lat-t.lat)<r&&Math.abs(n.lng-t.lng)<r&&(t.alt===n.alt||t.alt!==null&&n.alt!==null&&Math.abs(n.alt-t.alt)<i)}equalsWithoutLevel(t,n=c,r=l){return e.equalsWithoutLevel(this,t,n,r)}destinationPoint(e,t,n=null){let r=this.clone();return r.move(e,t,n),r}move(e,t,n=null){let{sinLat:r,cosLat:i,sinLng:a,cosLng:o}=b(this.lat,this.lng),s=S(r),c=e/(2*s),l=2*s*Math.sin(c),u=l*Math.cos(c),d=u*Math.sin(t),p=u*Math.cos(t),m=-l*Math.sin(c),h=x(r),g=h*i,[_,v]=w([g*o-a*d-r*o*p+i*o*m,g*a+o*d-r*a*p+i*a*m,h*(1-f)*r+i*p+r*m]);if(this.lat=_,this.lng=v,n!==null){if(this.alt===null)throw Error(`Point altitude is not defined`);this.alt+=n}return this}distanceTo(e){let[n,r,i]=this.groundEcef,[a,o,s]=e.groundEcef,c=Math.hypot(a-n,o-r,s-i),l=S(Math.sin((0,t.deg2rad)((this.lat+e.lat)/2)));return 2*l*Math.asin(Math.min(1,c/(2*l)))}static distanceBetween(e,t){return e.distanceTo(t)}bearingTo(e){let t=this.groundEcef,n=e.groundEcef,r=n[0]-t[0],i=n[1]-t[1],a=n[2]-t[2],{sinLat:o,cosLat:s,sinLng:c,cosLng:l}=b(this.lat,this.lng),u=-c*r+l*i,d=-o*l*r-o*c*i+s*a;return Math.atan2(u,d)}static bearingTo(e,t){return e.bearingTo(t)}get enuToEcefRotation(){let e=t.Quaternion.fromAxisAngle([0,0,1],Math.PI/2+(0,t.deg2rad)(this.lng)),n=t.Quaternion.fromAxisAngle([1,0,0],Math.PI/2-(0,t.deg2rad)(this.lat));return t.Quaternion.multiply(e,n)}get ecefToEnuRotation(){let e=t.Quaternion.fromAxisAngle([1,0,0],(0,t.deg2rad)(this.lat)-Math.PI/2),n=t.Quaternion.fromAxisAngle([0,0,1],-(0,t.deg2rad)(this.lng)-Math.PI/2);return t.Quaternion.multiply(e,n)}get ecef(){return this._ecef||=C(this.lat,this.lng,this.alt||0),this._ecef}get groundEcef(){return this.alt?(this._groundEcef||=C(this.lat,this.lng,0),this._groundEcef):this.ecef}static fromECEF(n){if(t.Vector3.norm(n)===0)throw Error(`ECEF vector cannot be the earth center`);let[r,i,a]=w(n),o=new e(r,i,a);return o._ecef=n,o}getSegmentProjection(n,r){let i=T(n.lat,n.lng),a=T(r.lat,r.lng),o=T(this.lat,this.lng),s=t.Vector3.cross(i,a);if(t.Vector3.norm(s)===0)return null;let c=t.Vector3.cross(o,s),l=t.Vector3.normalize(t.Vector3.cross(s,c));if(Math.abs(D(i,a)-D(i,l)-D(a,l))>.001/6378137)return null;let[u,d]=E(l),f;return n.alt!==null&&r.alt!==null&&(f=(n.alt+r.alt)/2),new e(u,d,f,y.union(n.level,r.level))}toString(){let e=`[`+this._lat.toFixed(7)+`, `+this._lng.toFixed(7);return this._alt!==null&&(e+=`, `+this._alt.toFixed(2)),this._level!==null&&(e+=`, [`+y.toString(this._level)+`]`),e+=`]`,e}toJson(){return{lat:Number(this.lat.toFixed(8)),lng:Number(this.lng.toFixed(8)),...this.alt!==null&&{alt:Number(this.alt.toFixed(3))},...this.level!==null&&{level:this.level}}}static fromJson(t){return new e(t.lat,t.lng,t.alt,t.level)}toCompressedJson(){return this.level===null?[Number(this.lat.toFixed(8)),Number(this.lng.toFixed(8))]:[Number(this.lat.toFixed(8)),Number(this.lng.toFixed(8)),this.level]}static fromCompressedJson(t){let n=new e(t[0],t[1]);return t.length>2&&(n.level=t[2]),n}},k=class e extends O{_time=null;_accuracy=null;_bearing=null;constructor(e,t,n=null,r=null,i=null,a=null,o=null){super(e,t,n,r),this.time=i,this.accuracy=a,this.bearing=o}get time(){return this._time}set time(e){this._time=e}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&e<0)throw Error(`accuracy argument is not a positive number`);this._accuracy=e}get bearing(){return this._bearing}set bearing(e){this._bearing=e===null?null:e%(2*Math.PI)}move(e,t,n=null){return super.move(e,t,n),this}destinationPoint(e,t,n=null){let r=this.clone();return r.move(e,t,n),r}static fromCoordinates(t){return new e(t.lat,t.lng,t.alt,t.level)}clone(){let t=e.fromCoordinates(super.clone());return t.time=this.time,t.accuracy=this.accuracy,t.bearing=this.bearing,t}static equals(t,n,r=c,i=l){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)||!super.equals(t,n,r,i)?!1:t.time===n.time&&t.accuracy===n.accuracy&&t.bearing===n.bearing}equals(t,n=c,r=l){return e.equals(this,t,n,r)}toJson(){return{...super.toJson(),...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy},...this.bearing!==null&&{bearing:this.bearing}}}static fromJson(t){let n=e.fromCoordinates(O.fromJson(t));return t.time!==void 0&&(n.time=t.time),t.accuracy!==void 0&&(n.accuracy=t.accuracy),t.bearing!==void 0&&(n.bearing=t.bearing),n}},A=r({calcDistance:()=>F,createSegmentsAtLevel:()=>ee,geolocationPositionToUserPosition:()=>P,sampleRoute:()=>j,segmentIntersection:()=>te,simplifyRoute:()=>N,trimRoute:()=>M});function j(e,t=.7,n=0,r=Number.MAX_VALUE){let i=n+r,a=[],o,s=0,c=0,l=!1;for(let r=0;r<e.length-1;r++){let u=e[r],d=e[r+1],f=u.distanceTo(d),p=u.bearingTo(d),m=0;if(!l)if(n<s+f)l=!0,c=n-s;else{s+=f;continue}for(o=Object.assign(u.clone(),{bearing:p});m+c<f&&s+c<=i;){let e=o.destinationPoint(c,p);e.bearing=p,a.push(e),o=e,m+=c,s+=c,c=t}if(s+c>i)break;let h=f-m;s+=h,c-=h}return a}function M(e,t=e[0],n=Number.MAX_VALUE){let r=[],i=null,a,o=0;if(e.length<=1)throw Error(`Route must have at least 2 points`);for(a=1;a<e.length;a++){let n=e[a-1],o=e[a];if(O.equals(t,n)){r.push(n),i=n;break}let s=t.getSegmentProjection(n,o);if(s&&O.equals(t,s)&&!s.equals(o)){r.push(s),i=s;break}}if(!r.length)throw Error(`startPosition is not on the route`);for(;i&&a<e.length;){let t=e[a],s=i.distanceTo(t);if(o+s>=n||Math.abs(o+s-n)<=.001){let e=i.bearingTo(t),a=n-o,s=i.destinationPoint(a,e);r.push(s);break}r.push(t),i=t,o+=s,a++}return r}function N(e,n=(0,t.deg2rad)(5)){let r=e[0].equals(e[e.length-1]),i=e.slice(0,e.length-+!!r),a=i.length;for(let o=+!r;o<a;o++){let r=e[(0,t.positiveMod)(o-1,a)],s=e[o],c=e[(0,t.positiveMod)(o+1,a)],l=r.bearingTo(s),u=s.bearingTo(c);Math.abs(u-l)<n&&(i=i.filter(e=>e!==s))}return r&&i.push(i[0]),i}function P(e){if(e===null)return null;let{latitude:n,longitude:r,accuracy:i,heading:a}=e.coords,o=new k(n,r);return o.time=e.timestamp,o.accuracy=i,o.bearing=a?(0,t.deg2rad)(a):null,o}function F(e){return e.reduce((e,t,n,r)=>e+(n?r[n-1].distanceTo(t):0),0)}function ee(e,t,n=!0){let r=e.length,i=!1,a=[],o=[];for(let s=0;s<r;s++){let r=e[s],c=y.intersect(t,r.level);n&&!c&&i?o.push(r):c&&(i||(o=[],a.push(o),n&&s!==0&&o.push(e[s-1])),o.push(r)),i=c}return a}function te(e,t,n,r){let i=e=>e*Math.PI/180,o=(e.lat+t.lat+n.lat+r.lat)/4,s=a*180/Math.PI,c=a*180/Math.PI*Math.cos(i(o)),l=e=>({x:e.lng*c,y:e.lat*s}),u=l(e),d=l(t),f=l(n),p=l(r),m=d.x-u.x,h=d.y-u.y,g=p.x-f.x,_=p.y-f.y,v=m*_-h*g;if(Math.abs(v)<1e-10)return null;let y=f.x-u.x,b=f.y-u.y,x=(y*_-b*g)/v,S=(y*h-b*m)/v;return x<0||x>1||S<0||S>1?null:new O((u.y+x*h)/s,(u.x+x*m)/c)}var I=class e{northEast;southWest;constructor(e,t){if(this.northEast=e,this.southWest=t,this.northEast&&this.southWest&&this.getNorth()<this.getSouth())throw Error(`Incorrect bounding box`)}get center(){return new O((this.southWest.lat+this.northEast.lat)/2,(this.northEast.lng+this.southWest.lng)/2)}contains(e){return e.lat<=this.northEast.lat&&e.lat>=this.southWest.lat&&e.lng<=this.northEast.lng&&e.lng>=this.southWest.lng}extend(t){let n=this.southWest,r=this.northEast,i,a;if(t instanceof O)i=t,a=t;else if(t instanceof e)i=t.southWest,a=t.northEast;else throw Error(`Unknown parameter`);return this.southWest=new O(Math.min(i.lat,n.lat),Math.min(i.lng,n.lng)),this.northEast=new O(Math.max(a.lat,r.lat),Math.max(a.lng,r.lng)),this}extendsWithMeasure(e){if(typeof e!=`number`)throw Error(`measure is not a number`);return this.northEast=this.northEast.destinationPoint(e,0).move(e,Math.PI/2),this.southWest=this.southWest.clone().destinationPoint(e,-Math.PI/2).destinationPoint(e,Math.PI),this}pad(e){let t=this.southWest,n=this.northEast,r=Math.abs(t.lat-n.lat)*e,i=Math.abs(t.lng-n.lng)*e;return this.southWest=new O(t.lat-r,t.lng-i),this.northEast=new O(n.lat+r,n.lng+i),this}getSouthWest(){return this.southWest}getNorthEast(){return this.northEast}getNorthWest(){return new O(this.getNorth(),this.getWest())}getSouthEast(){return new O(this.getSouth(),this.getEast())}getWest(){return this.southWest.lng}getSouth(){return this.southWest.lat}getEast(){return this.northEast.lng}getNorth(){return this.northEast.lat}static equals(e,t){return O.equals(e.northEast,t.northEast)&&O.equals(e.southWest,t.southWest)}equals(t){return e.equals(this,t)}static fromArray(t){return new e(new O(t[3],t[2]),new O(t[1],t[0]))}static fromCoordinates(t){return t.length===0?null:t.reduce((e,t)=>e.extend(t),new e(t[0],t[0]))}toArray(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()]}},L=class e{x;y;z;time=null;_accuracy=null;_bearing=null;constructor(e,t,n,r=null,i=null,a=null){this.x=e,this.y=t,this.z=n,this.time=r,this.accuracy=i,this.bearing=a}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&e<0)throw Error(`accuracy argument is not a positive number`);this._accuracy=e}get bearing(){return this._bearing}set bearing(e){this._bearing=e===null?null:e%(2*Math.PI)}clone(){return new e(this.x,this.y,this.z,this.time,this.accuracy,this.bearing)}static equals(t,n,r=l){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)?!1:Math.abs(n.x-t.x)<r&&Math.abs(n.y-t.y)<r&&Math.abs(n.z-t.z)<r&&t.time===n.time&&t.accuracy===n.accuracy&&t.bearing===n.bearing}equals(t){return e.equals(this,t)}toJson(){return{x:this.x,y:this.y,z:this.z,...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy},...this.bearing!==null&&{bearing:this.bearing}}}static fromJson(t){return new e(t.x,t.y,t.z,t.time,t.accuracy,t.bearing)}},R=class extends L{},z=11102230246251565e-32,B=134217729,V=3.000000000000001*z;function H(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[p++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[p++]=s);return(a!==0||p===0)&&(i[p++]=a),p}function U(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function W(e){return new Float64Array(e)}var G=(3+16*z)*z,K=(2+12*z)*z,q=(9+64*z)*z*z,J=W(4),Y=W(8),X=W(12),Z=W(16),Q=W(4);function ne(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=B*T,p=f-(f-T),m=T-p,f=B*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=B*D,p=f-(f-D),m=D-p,f=B*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,J[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,J[1]=y-(_+d)+(d-S),w=v+_,d=w-v,J[2]=v-(w-d)+(_-d),J[3]=w;let k=U(4,J),A=K*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=q*o+V*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=B*s,p=f-(f-s),m=s-p,f=B*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=B*c,p=f-(f-c),m=c-p,f=B*E,h=f-(f-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),W(8),W(8),W(8),W(8),W(8),W(8),W(4),W(4),W(4),W(8),W(16),W(16),W(16),W(32),W(32),W(48),W(64),W(1152),W(1152),(16+224*z)*z,(5+72*z)*z,(71+1408*z)*z*z,W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(4),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(24),W(1152),W(1152),W(1152),W(1152),W(1152),W(2304),W(2304),W(3456),W(5760),W(8),W(8),W(8),W(16),W(24),W(48),W(48),W(96),W(192),W(384),W(384),W(384),W(768),W(96),W(96),W(96),W(1152);function ie(e,t){var n,r,i=0,a,o,s,c,l,u,d,f=e[0],p=e[1],m=t.length;for(n=0;n<m;n++){r=0;var h=t[n],g=h.length-1;if(u=h[0],u[0]!==h[g][0]&&u[1]!==h[g][1])throw Error(`First and last coordinates in a ring must be the same`);for(o=u[0]-f,s=u[1]-p;r<g;r++){if(d=h[r+1],c=d[0]-f,l=d[1]-p,s===0&&l===0){if(c<=0&&o>=0||o<=0&&c>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(a=re(o,c,s,l,0,0),a===0)return 0;(a>0&&l>0&&s<=0||a<0&&l<=0&&s>0)&&i++}u=d,s=l,o=c}}return i%2!=0}function ae(e){if(!e)throw Error(`coord is required`);if(!Array.isArray(e)){if(e.type===`Feature`&&e.geometry!==null&&e.geometry.type===`Point`)return[...e.geometry.coordinates];if(e.type===`Point`)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw Error(`coord must be GeoJSON Point or an Array of numbers`)}function oe(e){return e.type===`Feature`?e.geometry:e}function se(e,t,n={}){if(!e)throw Error(`point is required`);if(!t)throw Error(`polygon is required`);let r=ae(e),i=oe(t),a=i.type,o=t.bbox,s=i.coordinates;if(o&&ce(r,o)===!1)return!1;a===`Polygon`&&(s=[s]);let c=!1;for(var l=0;l<s.length;++l){let e=ie(r,s[l]);if(e===0)return!n.ignoreBoundary;e&&(c=!0)}return c}function ce(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}var le=se,ue=class e{scale=1;heading=0;origin;buildingLevels;constructor(e,t=[]){this.origin=e,this.buildingLevels=t}localToWorld(e){let n=t.Vector3.multiplyScalar(e,this.scale),r=t.Quaternion.fromAxisAngle([0,0,1],-this.heading),i=t.Quaternion.multiply(this.origin.enuToEcefRotation,r),a=t.Quaternion.rotate(i,n),o=t.Vector3.sum(this.origin.ecef,a),s=O.fromECEF(o),c=s.alt;s.heightFromGround=s.alt-this.origin.alt;let l=e=>{s.level=e.id,s.heightFromFloor=c-e.floorAltitude};if(!this.buildingLevels.length)return s;let u=this.buildingLevels.filter(e=>c>=e.floorAltitude&&c<=e.ceilingAltitude);if(!u.length)return s;let d=u[0],f=[s.lng,s.lat],p=u.filter(e=>e.geometries.length);if(!p.length)return l(d),s;let m=p.filter(e=>e.geometries.some(e=>le(f,e)))[0];return m&&l(m),s}worldToLocal(e){let n=t.Quaternion.fromAxisAngle([0,0,1],this.heading),r=t.Quaternion.multiply(n,this.origin.ecefToEnuRotation),i=t.Vector3.subtract(e.ecef,this.origin.ecef),a=t.Vector3.multiplyScalar(i,1/this.scale);return t.Quaternion.rotate(r,a)}toJson(){return{origin:this.origin.toJson(),...this.scale!==1&&{scale:this.scale},...this.heading!==0&&{heading:this.heading}}}static fromJson(t){let n=new e(O.fromJson(t.origin));return n.scale=t.scale===void 0?1:t.scale,n.heading=t.heading===void 0?0:t.heading,n}},$=class e{_quaternion=[1,0,0,0];_heading=null;_eulerAngles=null;_time=null;_accuracy=null;constructor(e,t=null,n=null){this.quaternion=e,this.time=t,this.accuracy=n}static unitary(){return new e([1,0,0,0])}get quaternion(){return this._quaternion}set quaternion(e){if(Math.abs(1-t.Quaternion.norm(e))>1e-4)throw Error(`quaternion is not a unit quaternion`);this._quaternion=e,this._heading=null,this._eulerAngles=null}get time(){return this._time}set time(e){this._time=e}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&(e<0||e>Math.PI))throw Error(`accuracy argument (`+e+`) is not in range [0; PI]`);this._accuracy=e}get eulerAngles(){return this._eulerAngles===null&&(this._eulerAngles=t.Rotations.quaternionToEulerZXY(this.quaternion)),this._eulerAngles}get eulerAnglesDegrees(){return this.eulerAngles.map(e=>(0,t.rad2deg)(e))}get heading(){if(this._heading===null){let e=0;typeof window<`u`&&window&&window.orientation&&(e=(0,t.deg2rad)(window.orientation)),this._heading=t.Rotations.getHeadingFromQuaternion(this.quaternion)+e}return this._heading}get headingDegrees(){return(0,t.rad2deg)(this.heading)}static equals(n,r){return n===null&&n===r?!0:!(n instanceof e)||!(r instanceof e)?!1:n===r||t.Quaternion.equals(n.quaternion,r.quaternion)}equals(t){return e.equals(this,t)}toJson(){return this.time===null&&this.accuracy===null?this.quaternion:{q:this.quaternion,...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy}}}static fromJson(t){return Array.isArray(t)?new e(t,null,null):new e(t.q,t.time,t.accuracy)}clone(){return new e(this.quaternion.slice(0),this.time,this.accuracy)}static diff(n,r){let i=t.Quaternion.multiply(t.Quaternion.inverse(n.quaternion),r.quaternion),a=null;r.time!==null&&n.time!==null&&(a=r.time-n.time);let o=null;return n.accuracy!==null&&r.accuracy!==null&&(o=Math.max(r.accuracy-n.accuracy)),new e(i,a,o)}};e.AbsoluteHeading=class e{heading;time=null;_accuracy=null;constructor(e,t=null,n=null){this.heading=e,this.time=t,this.accuracy=n}get accuracy(){return this._accuracy}set accuracy(e){if(e!==null&&(e<0||e>Math.PI))throw Error(`accuracy argument (`+e+`) is not in range [0; PI]`);this._accuracy=e}toAttitude(){return new $(t.Quaternion.fromAxisAngle([0,0,1],-this.heading),this.time,this.accuracy)}static equals(t,n){return t===null&&t===n?!0:!(t instanceof e)||!(n instanceof e)?!1:Math.abs(t.heading-n.heading)<1e-8}equals(t){return e.equals(this,t)}toJson(){return{heading:this.heading,...this.time!==null&&{time:this.time},...this.accuracy!==null&&{accuracy:this.accuracy}}}static fromJson(t){return new e(t.heading,t.time,t.accuracy)}clone(){return new e(this.heading,this.time,this.accuracy)}},e.Attitude=$,e.BoundingBox=I,Object.defineProperty(e,"Constants",{enumerable:!0,get:function(){return i}}),e.Coordinates=O,e.GeoRef=ue,e.GeoRelativePosition=R,e.Level=y,e.RelativePosition=L,e.UserPosition=k,Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return A}})});
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ var c = Object.defineProperty, l = (e, t) => {
79
79
  throw Error(`Cannot parse level from ${typeof t}`);
80
80
  }
81
81
  static contains(t, n) {
82
- return e.VERIFY_TYPING && (e.checkType(t), e.checkType(n)), t === n ? !0 : Array.isArray(t) ? Array.isArray(n) ? t[0] <= n[0] && t[1] >= n[1] : n !== null && t[0] <= n && t[1] >= n : t === null || n === null ? !1 : t <= n[0] && t >= n[1];
82
+ return e.VERIFY_TYPING && (e.checkType(t), e.checkType(n)), t === n ? !0 : Array.isArray(t) ? Array.isArray(n) ? t[0] <= n[0] && t[1] >= n[1] : n === null ? !1 : t[0] <= n && t[1] >= n || t[1] <= n && t[0] >= n : t === null || n === null ? !1 : t <= n[0] && t >= n[1];
83
83
  }
84
84
  static intersection(t, n) {
85
85
  if (e.VERIFY_TYPING && (e.checkType(t), e.checkType(n)), t === null || n === null) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"Level.d.ts","sourceRoot":"","sources":["../../../src/coordinates/Level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,cAAM,KAAK;IAEP,MAAM,CAAC,aAAa,UAAS;IAE7B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO;IAoB/B;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAOzD,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 @@
1
1
  {
2
2
  "name": "@wemap/geo",
3
- "version": "14.7.0",
3
+ "version": "14.8.0-beta.0",
4
4
  "description": "Geospatial primitives (coordinates, levels, bounding boxes) for the Wemap SDK.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Wemap SAS",
@@ -38,8 +38,8 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@turf/boolean-point-in-polygon": "^7.3.4",
41
- "@wemap/maths": "14.7.0",
42
- "@wemap/utils": "14.7.0"
41
+ "@wemap/maths": "14.8.0-beta.0",
42
+ "@wemap/utils": "14.8.0-beta.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/geojson": "^7946.0.14",