@ue-too/border 0.12.0 → 0.14.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.
package/README.md CHANGED
@@ -417,7 +417,7 @@ cities.forEach(city => {
417
417
 
418
418
  ## API Reference
419
419
 
420
- For complete API documentation with detailed type information, see the [TypeDoc-generated documentation](../../docs/border).
420
+ For complete API documentation with detailed type information, see the [TypeDoc-generated documentation](/border/).
421
421
 
422
422
  ## TypeScript Support
423
423
 
@@ -466,9 +466,9 @@ This library follows these principles:
466
466
 
467
467
  ## Related Packages
468
468
 
469
- - **[@ue-too/math](../math)**: Vector operations for point calculations
470
- - **[@ue-too/curve](../curve)**: Bezier curves for drawing map features
471
- - **[@ue-too/board](../board)**: Canvas board for rendering maps
469
+ - **[@ue-too/math](/math/)**: Vector operations for point calculations
470
+ - **[@ue-too/curve](/curve/)**: Bezier curves for drawing map features
471
+ - **[@ue-too/board](/board/)**: Canvas board for rendering maps
472
472
 
473
473
  ## Further Reading
474
474
 
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  function w(c,e=0){let p=c.latitude*Math.PI/180,l=c.longitude*Math.PI/180,m=6371000*D(l-e*Math.PI/180),i=6371000*Math.log(Math.tan(Math.PI/4+p/2));return{x:m,y:i}}function R(c,e=0){let p=c.x/6371000+e;return{latitude:(2*Math.atan(Math.exp(c.y/6371000))-Math.PI/2)*180/Math.PI,longitude:p*180/Math.PI}}function g(c,e){let p=c.latitude*Math.PI/180,l=c.longitude*Math.PI/180,m=6371000*Math.cos(p)*Math.sin(l-e.longitude*Math.PI/180),i=6371000*(Math.cos(e.latitude*Math.PI/180)*Math.sin(p)-Math.sin(e.latitude*Math.PI/180)*Math.cos(p)*Math.cos(l-e.longitude*Math.PI/180));return{clipped:Math.sin(e.latitude*Math.PI/180)*Math.sin(p)+Math.cos(e.latitude*Math.PI/180)*Math.cos(p)*Math.cos(l-e.longitude*Math.PI/180)<0,coord:{x:m,y:i}}}function E(c,e){let p=Math.sqrt(c.x*c.x+c.y*c.y),l=Math.asin(p/6371000),m=Math.asin(Math.cos(l)*Math.sin(e.latitude*Math.PI/180)+c.y*Math.sin(l)*Math.cos(e.latitude*Math.PI/180)/p)*180/Math.PI,i=e.longitude+Math.atan2(c.x*Math.sin(l),p*Math.cos(l)*Math.cos(e.latitude*Math.PI/180)-c.y*Math.sin(l)*Math.sin(e.latitude*Math.PI/180))*180/Math.PI;return{latitude:m,longitude:i}}function D(c){return c=c%(Math.PI*2),c=(c+3*Math.PI)%(2*Math.PI)-Math.PI,c}function B(c,e,b){let p=(e.latitude-c.latitude)*Math.PI/180,l=(e.longitude-c.longitude)*Math.PI/180,m=c.latitude*Math.PI/180,i=c.longitude*Math.PI/180,v=e.latitude*Math.PI/180,j=e.longitude*Math.PI/180,u=Math.sin(p/2)*Math.sin(p/2)+Math.cos(m)*Math.cos(v)*Math.sin(l/2)*Math.sin(l/2),k=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),h=Math.sin((1-b)*k)/Math.sin(k),f=Math.sin(b*k)/Math.sin(k),a=h*Math.cos(m)*Math.cos(i)+f*Math.cos(v)*Math.cos(j),O=h*Math.cos(m)*Math.sin(i)+f*Math.cos(v)*Math.sin(j),G=h*Math.sin(m)*f*Math.sin(v),M=Math.atan2(G,Math.sqrt(a*a+O*O)),F=Math.atan2(O,a);return{latitude:M,longitude:F}}function K(c,e){let b=c.latitude*Math.PI/180,p=e.latitude*Math.PI/180,l=c.longitude*Math.PI/180,m=e.longitude*Math.PI/180,i=Math.cos(p)*Math.cos(m-l),v=Math.cos(p)*Math.sin(m-l),j=Math.atan2(Math.sin(b)+Math.sin(p),Math.sqrt((Math.cos(b)+i)*(Math.cos(b)+i)+v*v)),u=l+Math.atan2(v,Math.cos(b)+i);return{latitude:j,longitude:u}}function N(c,e){let b=c.latitude*Math.PI/180,p=e.latitude*Math.PI/180,l=c.longitude*Math.PI/180,m=e.longitude*Math.PI/180,i=Math.sin(m-l)*Math.cos(p),v=Math.cos(b)*Math.sin(p)-Math.sin(b)*Math.cos(p)*Math.cos(m-l);return(Math.atan2(i,v)*180/Math.PI+360)%360}function S(c,e){let p=c.latitude*Math.PI/180,l=e.latitude*Math.PI/180,m=(e.latitude-c.latitude)*Math.PI/180,i=(e.longitude-c.longitude)*Math.PI/180,v=Math.sin(m/2)*Math.sin(m/2)+Math.cos(p)*Math.cos(l)*Math.sin(i/2)*Math.sin(i/2);return 6371000*(2*Math.atan2(Math.sqrt(v),Math.sqrt(1-v)))}function V(c,e,b){let l=c.latitude*Math.PI/180,m=c.longitude*Math.PI/180,i=e*Math.PI/180,v=b/6371000,j=Math.asin(Math.sin(l)*Math.cos(v)+Math.cos(l)*Math.sin(v)*Math.cos(i)),u=m+Math.atan2(Math.sin(i)*Math.sin(v)*Math.cos(l),Math.cos(v)-Math.sin(l)*Math.sin(j));return{latitude:j,longitude:u}}function H(c,e){let p=c.latitude*Math.PI/180,l=e.latitude*Math.PI/180,m=(e.latitude-c.latitude)*Math.PI/180,i=(e.longitude-c.longitude)*Math.PI/180,v=Math.log(Math.tan(Math.PI/4+l/2)/Math.tan(Math.PI/4+p/2)),j=Math.abs(v)>0.00000000001?m/v:Math.cos(p);if(Math.abs(i)>Math.PI)i=i>0?-(2*Math.PI-i):2*Math.PI+i;return Math.sqrt(m*m+j*j*i*i)*6371000}function J(c,e){let b=c.latitude*Math.PI/180,p=e.latitude*Math.PI/180,l=(e.longitude-c.longitude)*Math.PI/180,m=Math.log(Math.tan(Math.PI/4+p/2)/Math.tan(Math.PI/4+b/2));if(Math.abs(l)>Math.PI)l=l>0?-(2*Math.PI-l):2*Math.PI+l;return Math.atan2(l,m)*180/Math.PI}function L(c,e,b){let l=c.latitude*Math.PI/180,m=c.longitude*Math.PI/180,i=e*Math.PI/180,j=b/6371000,u=j*Math.cos(i),k=l+u,h=Math.log(Math.tan(k/2+Math.PI/4)/Math.tan(l/2+Math.PI/4)),f=Math.abs(h)>0.00000000001?u/h:Math.cos(l),a=j*Math.sin(i)/f,O=m+a;if(Math.abs(k)>Math.PI/2)k=k>0?Math.PI-k:-Math.PI-k;return{latitude:k,longitude:O}}function Q(c,e){let b=c.longitude*Math.PI/180,p=e.longitude*Math.PI/180,l=c.latitude*Math.PI/180,m=e.latitude*Math.PI/180;if(Math.abs(p-b)>Math.PI)b+=2*Math.PI;let i=(l+m)/2,v=Math.tan(Math.PI/4+l/2),j=Math.tan(Math.PI/4+m/2),u=Math.tan(Math.PI/4+i/2),k=((p-b)*Math.log(u)+b*Math.log(j)-p*Math.log(v))/Math.log(j/v);if(!isFinite(k))k=(b+p)/2;return{latitude:i,longitude:k}}export{H as rhumbDistance,J as rhumbBearing,g as orthoProjection,Q as midPointOnRhumbLine,K as midPointOnGreatCircle,w as mercatorProjection,E as inverseOrthoProjection,R as inverseMercatorProjection,B as intermediatePointOnGreatCircle,N as initialBearingOfGreatCircle,S as greatCircleDistance,L as destinationFromOriginOnRhumbLine,V as destinationFromOriginOnGreatCircle};
2
2
 
3
3
  //# debugId=ADDDACDC1E32424A64756E2164756E21
4
+
5
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/projection.ts", "../src/greateCircle.ts", "../src/rhumbLine.ts"],
3
+ "sources": [
4
+ "projection.ts",
5
+ "greateCircle.ts",
6
+ "rhumbLine.ts"
7
+ ],
4
8
  "sourcesContent": [
5
9
  "import { Point } from \"@ue-too/math\";\n\n/**\n * Geographic coordinate representing a location on Earth's surface.\n *\n * @remarks\n * Coordinates use the WGS84 standard:\n * - Latitude: -90 to 90 degrees (negative = south, positive = north)\n * - Longitude: -180 to 180 degrees (negative = west, positive = east)\n *\n * @category Types\n */\nexport type GeoCoord = {\n /** Longitude in degrees (-180 to 180) */\n longitude: number;\n /** Latitude in degrees (-90 to 90) */\n latitude: number;\n}\n\n/**\n * Projects a geographic coordinate to Mercator projection.\n *\n * @remarks\n * The Mercator projection is a cylindrical map projection that preserves angles\n * and shapes locally. It's widely used for navigation because straight lines on\n * the map represent constant bearings (rhumb lines).\n *\n * The projection uses Earth's mean radius of 6,371,000 meters.\n *\n * Note: The Mercator projection becomes increasingly distorted near the poles.\n *\n * @param interestPoint - The geographic coordinate to project\n * @param centerLongitude - The central meridian in degrees (default: 0)\n * @returns The projected point in meters from the central meridian\n *\n * @example\n * ```typescript\n * const coord = { latitude: 51.5074, longitude: -0.1278 }; // London\n * const point = mercatorProjection(coord);\n * console.log(point); // { x: -14232.4, y: 6711665.7 }\n *\n * // With custom center longitude\n * const pointCentered = mercatorProjection(coord, -0.1278);\n * console.log(pointCentered.x); // Close to 0\n * ```\n *\n * @category Projections\n */\nexport function mercatorProjection(interestPoint: GeoCoord, centerLongitude: number = 0): Point{\n const r = 6371000;\n const latitude = interestPoint.latitude * Math.PI / 180;\n const longitude = interestPoint.longitude * Math.PI / 180;\n let x = r * normalizeAngleMinusPiToPi(longitude - centerLongitude * Math.PI / 180);\n let y = r * Math.log(Math.tan(Math.PI / 4 + latitude / 2));\n return {x: x, y: y};\n}\n\n/**\n * Converts a Mercator projection point back to geographic coordinates.\n *\n * @remarks\n * This is the inverse of {@link mercatorProjection}. Given a point in Mercator\n * projection space (in meters), it returns the corresponding latitude/longitude.\n *\n * @param point - The point in Mercator projection (in meters)\n * @param centerLongitude - The central meridian in degrees (must match the forward projection)\n * @returns The geographic coordinate\n *\n * @example\n * ```typescript\n * const point = { x: -14232.4, y: 6711665.7 };\n * const coord = inverseMercatorProjection(point);\n * console.log(coord); // { latitude: ~51.5, longitude: ~-0.13 }\n * ```\n *\n * @category Projections\n */\nexport function inverseMercatorProjection(point: Point, centerLongitude: number = 0): GeoCoord{\n const r = 6371000;\n const longitude = point.x / r + centerLongitude;\n const latitude = 2 * Math.atan(Math.exp(point.y / r)) - Math.PI / 2;\n return {latitude: latitude * 180 / Math.PI, longitude: longitude * 180 / Math.PI};\n}\n\n/**\n * Projects a geographic coordinate to orthographic projection.\n *\n * @remarks\n * The orthographic projection shows Earth as it would appear from space,\n * displaying one hemisphere at a time. It's useful for globe-like visualizations.\n *\n * Points on the back hemisphere (not visible from the origin viewpoint) are\n * marked as clipped.\n *\n * The projection uses Earth's mean radius of 6,371,000 meters.\n *\n * @param interestPoint - The geographic coordinate to project\n * @param origin - The center point of the hemisphere to view\n * @returns Object with clipped flag and projected coordinate\n *\n * @example\n * ```typescript\n * const origin = { latitude: 45.0, longitude: 0.0 }; // View centered on France\n * const coord = { latitude: 51.5, longitude: -0.1 }; // London\n *\n * const result = orthoProjection(coord, origin);\n * if (!result.clipped) {\n * console.log('London is visible at:', result.coord);\n * } else {\n * console.log('London is on the back of the globe');\n * }\n * ```\n *\n * @category Projections\n */\nexport function orthoProjection(interestPoint: GeoCoord, origin: GeoCoord): {clipped: boolean, coord: Point}{\n const r = 6371000;\n const latitude = interestPoint.latitude * Math.PI / 180;\n const longitude = interestPoint.longitude * Math.PI / 180;\n const x = r * Math.cos(latitude) * Math.sin(longitude - origin.longitude * Math.PI / 180);\n const y = r * (Math.cos(origin.latitude * Math.PI / 180) * Math.sin(latitude) - Math.sin(origin.latitude * Math.PI / 180) * Math.cos(latitude) * Math.cos(longitude - origin.longitude * Math.PI / 180));\n const clipped = Math.sin(origin.latitude * Math.PI / 180) * Math.sin(latitude) + Math.cos(origin.latitude * Math.PI / 180) * Math.cos(latitude) * Math.cos(longitude - origin.longitude * Math.PI / 180);\n\n return {clipped: clipped < 0, coord: {x: x, y: y}};\n}\n\n/**\n * Converts an orthographic projection point back to geographic coordinates.\n *\n * @remarks\n * This is the inverse of {@link orthoProjection}. Given a point in orthographic\n * projection space (in meters), it returns the corresponding latitude/longitude.\n *\n * @param interestPoint - The point in orthographic projection (in meters)\n * @param origin - The center point of the hemisphere (must match the forward projection)\n * @returns The geographic coordinate\n *\n * @example\n * ```typescript\n * const origin = { latitude: 45.0, longitude: 0.0 };\n * const point = { x: 100000, y: 200000 }; // Some point in projection space\n * const coord = inverseOrthoProjection(point, origin);\n * console.log(coord); // { latitude: ..., longitude: ... }\n * ```\n *\n * @category Projections\n */\nexport function inverseOrthoProjection(interestPoint: Point, origin: GeoCoord): GeoCoord {\n const r = 6371000;\n const rho = Math.sqrt(interestPoint.x * interestPoint.x + interestPoint.y * interestPoint.y);\n const c = Math.asin(rho / r);\n const latitude = Math.asin(Math.cos(c) * Math.sin(origin.latitude * Math.PI / 180) + (interestPoint.y * Math.sin(c) * Math.cos(origin.latitude * Math.PI / 180)) / rho) * 180 / Math.PI;\n const longitude = origin.longitude + Math.atan2(interestPoint.x * Math.sin(c), rho * Math.cos(c)*Math.cos(origin.latitude * Math.PI / 180) - interestPoint.y * Math.sin(c) * Math.sin(origin.latitude * Math.PI / 180)) * 180 / Math.PI;\n return {latitude: latitude, longitude: longitude};\n}\n\nfunction normalizeAngleMinusPiToPi(angle: number): number {\n // Reduce the angle\n angle = angle % (Math.PI * 2);\n\n // Force it to be in the range -π to π\n angle = (angle + 3 * Math.PI) % (2 * Math.PI) - Math.PI;\n\n return angle;\n}\n",
6
10
  "import { GeoCoord } from \"./projection\";\n\n/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\n/* Geodesy representation conversion functions (c) Chris Veness 2002-2022 */\n/* MIT Licence */\n/* www.movable-type.co.uk/scripts/latlong.html */\n/* www.movable-type.co.uk/scripts/js/geodesy/geodesy-library.html#dms */\n/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\n\n\n/**\n * Calculates an intermediate point along a great circle path.\n *\n * @remarks\n * Given two points on Earth's surface, this finds a point at a specified\n * fraction along the great circle (shortest) path between them.\n *\n * Uses the spherical interpolation formula for accurate results on a sphere.\n *\n * @param startCoord - The starting geographic coordinate\n * @param endCoord - The ending geographic coordinate\n * @param fraction - The fraction along the path (0 = start, 1 = end, 0.5 = midpoint)\n * @returns The intermediate point at the specified fraction\n *\n * @example\n * ```typescript\n * const nyc = { latitude: 40.7128, longitude: -74.0060 };\n * const london = { latitude: 51.5074, longitude: -0.1278 };\n *\n * // Find point 25% of the way from NYC to London\n * const quarter = intermediatePointOnGreatCircle(nyc, london, 0.25);\n *\n * // Find point 75% of the way\n * const threeQuarters = intermediatePointOnGreatCircle(nyc, london, 0.75);\n * ```\n *\n * @category Great Circle\n */\nexport function intermediatePointOnGreatCircle(startCoord: GeoCoord, endCoord: GeoCoord, fraction: number): GeoCoord{\n const Δφ = (endCoord.latitude - startCoord.latitude) * Math.PI / 180;\n const Δλ = (endCoord.longitude - startCoord.longitude) * Math.PI / 180;\n const φ1 = startCoord.latitude * Math.PI / 180;\n const λ1 = startCoord.longitude * Math.PI / 180;\n const φ2 = endCoord.latitude * Math.PI / 180;\n const λ2 = endCoord.longitude * Math.PI / 180;\n const angularDistA = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +\n Math.cos(φ1) * Math.cos(φ2) *\n Math.sin(Δλ / 2) * Math.sin(Δλ / 2);\n const c = 2 * Math.atan2(Math.sqrt(angularDistA), Math.sqrt(1 - angularDistA));\n \n const a = Math.sin((1 - fraction) * c) / Math.sin(c);\n const b = Math.sin(fraction * c) / Math.sin(c);\n const x = a * Math.cos(φ1) * Math.cos(λ1) + b * Math.cos(φ2) * Math.cos(λ2);\n const y = a * Math.cos(φ1) * Math.sin(λ1) + b * Math.cos(φ2) * Math.sin(λ2);\n const z = a * Math.sin(φ1) * b * Math.sin(φ2);\n const φi = Math.atan2(z, Math.sqrt(x * x + y * y));\n const λi = Math.atan2(y, x);\n return {latitude: φi, longitude: λi};\n}\n\n/**\n * Calculates the midpoint along a great circle path.\n *\n * @remarks\n * This is a specialized, optimized version of {@link intermediatePointOnGreatCircle}\n * for finding the exact midpoint (fraction = 0.5).\n *\n * @param startCoord - The starting geographic coordinate\n * @param endCoord - The ending geographic coordinate\n * @returns The midpoint on the great circle path\n *\n * @example\n * ```typescript\n * const start = { latitude: 50.0, longitude: -5.0 };\n * const end = { latitude: 58.0, longitude: 3.0 };\n * const mid = midPointOnGreatCircle(start, end);\n * console.log('Midpoint:', mid);\n * ```\n *\n * @category Great Circle\n */\nexport function midPointOnGreatCircle(startCoord: GeoCoord, endCoord: GeoCoord): GeoCoord{\n const φ1 = startCoord.latitude * Math.PI / 180;\n const φ2 = endCoord.latitude * Math.PI / 180;\n const λ1 = startCoord.longitude * Math.PI / 180;\n const λ2 = endCoord.longitude * Math.PI / 180;\n const Bx = Math.cos(φ2) * Math.cos(λ2 - λ1);\n const By = Math.cos(φ2) * Math.sin(λ2 - λ1);\n const φ3 = Math.atan2(Math.sin(φ1) + Math.sin(φ2),\n Math.sqrt( (Math.cos(φ1) + Bx) * (Math.cos(φ1) + Bx) + By * By ) );\n const λ3 = λ1 + Math.atan2(By, Math.cos(φ1) + Bx);\n return {latitude: φ3, longitude: λ3};\n}\n\n/**\n * Calculate the initial bearing between two points on the Earth's surface. \n * (traveling along the great circle would result in different bearing from the start point to the end point)\n * \n * @param startCoord - The starting point in GeoCoord format.\n * @param endCoord - The ending point in GeoCoord format.\n * @returns The bearing in degrees.\n */\nexport function initialBearingOfGreatCircle(startCoord: GeoCoord, endCoord: GeoCoord): number{\n const φ1 = startCoord.latitude * Math.PI / 180;\n const φ2 = endCoord.latitude * Math.PI / 180;\n const λ1 = startCoord.longitude * Math.PI / 180;\n const λ2 = endCoord.longitude * Math.PI / 180;\n const y = Math.sin(λ2-λ1) * Math.cos(φ2);\n const x = Math.cos(φ1) * Math.sin(φ2) -\n Math.sin(φ1) * Math.cos(φ2)*Math.cos(λ2 - λ1);\n const θ = Math.atan2(y, x);\n const brng = (θ * 180 / Math.PI + 360) % 360; // in degrees\n return brng;\n}\n\n/**\n * Calculates the great circle distance between two points on Earth.\n *\n * @remarks\n * Uses the haversine formula to calculate the shortest distance over Earth's\n * surface between two geographic coordinates. This is the \"as-the-crow-flies\"\n * distance.\n *\n * The calculation assumes Earth's mean radius of 6,371,000 meters and treats\n * Earth as a perfect sphere.\n *\n * @param startCoord - The starting geographic coordinate\n * @param endCoord - The ending geographic coordinate\n * @returns The distance in meters\n *\n * @example\n * ```typescript\n * const nyc = { latitude: 40.7128, longitude: -74.0060 };\n * const london = { latitude: 51.5074, longitude: -0.1278 };\n *\n * const distance = greatCircleDistance(nyc, london);\n * console.log('Distance:', distance / 1000, 'km'); // ~5570 km\n * ```\n *\n * @category Great Circle\n */\nexport function greatCircleDistance(startCoord: GeoCoord, endCoord: GeoCoord): number{\n const R = 6371e3; // metres\n const φ1 = startCoord.latitude * Math.PI / 180; // φ, λ in radians\n const φ2 = endCoord.latitude * Math.PI / 180;\n const Δφ = (endCoord.latitude - startCoord.latitude) * Math.PI / 180;\n const Δλ = (endCoord.longitude - startCoord.longitude) * Math.PI / 180;\n\n const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +\n Math.cos(φ1) * Math.cos(φ2) *\n Math.sin(Δλ / 2) * Math.sin(Δλ / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n const d = R * c; // in metres\n return d;\n} \n\n/**\n * Calculates the destination point given a start point, bearing, and distance on a great circle.\n *\n * @remarks\n * Starting from a given point and traveling along a great circle at a specific\n * initial bearing for a given distance, this calculates where you'll end up.\n *\n * Note: The bearing will change along the path (except when traveling due north/south\n * or along the equator) because great circles are not straight lines on most map projections.\n *\n * @param startCoord - The starting geographic coordinate\n * @param bearing - The initial bearing in degrees (0 = north, 90 = east, etc.)\n * @param distance - The distance to travel in meters\n * @returns The destination coordinate\n *\n * @example\n * ```typescript\n * const start = { latitude: 40.7128, longitude: -74.0060 }; // NYC\n *\n * // Travel 1000km northeast from NYC\n * const destination = destinationFromOriginOnGreatCircle(start, 45, 1000000);\n * console.log('Destination:', destination);\n * ```\n *\n * @category Great Circle\n */\nexport function destinationFromOriginOnGreatCircle(startCoord: GeoCoord, bearing: number, distance: number): GeoCoord{\n const R = 6371e3; // metres\n const φ1 = startCoord.latitude * Math.PI / 180; // φ, λ in radians\n const λ1 = startCoord.longitude * Math.PI / 180;\n const θ = bearing * Math.PI / 180;\n const d = distance / R; // angular distance in radians\n const φ2 = Math.asin(Math.sin(φ1) * Math.cos(d) +\n Math.cos(φ1) * Math.sin(d) * Math.cos(θ) );\n const λ2 = λ1 + Math.atan2(Math.sin(θ) * Math.sin(d) * Math.cos(φ1),\n Math.cos(d) - Math.sin(φ1) * Math.sin(φ2));\n return {latitude: φ2, longitude: λ2};\n}\n",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ue-too/border",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.14.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/ue-too/ue-too.git"
@@ -20,7 +20,7 @@
20
20
  "./package.json": "./package.json"
21
21
  },
22
22
  "dependencies": {
23
- "@ue-too/math": "^0.12.0"
23
+ "@ue-too/math": "^0.14.0"
24
24
  },
25
25
  "main": "./index.js",
26
26
  "types": "./index.d.ts",