Ellipsoid
Source: Ellipsoid.ts:23
Class represents a plant ellipsoid.
Constructor
new Ellipsoid(
equatorialSize: number,
polarSize: number,
): EllipsoidParameters
equatorialSize(number) — Equatorial ellipsoid size.polarSize(number) — Polar ellipsoid size.
Instance Methods
rhumbDistanceTo(startLonLat: LonLat, endLonLat: LonLat): number
Returns the distance travelling from ‘this’ point to destination point along a rhumb line.
Parameters
Returns
number— Distance in m between this point and destination point (same units as radius).
getIntermediatePointOnGreatCircle(
lonLat1: LonLat,
lonLat2: LonLat,
fraction: number,
): LonLat
Returns the point at given fraction between two points on the great circle.
Parameters
lonLat1(LonLat) — Longitude/Latitude of source point.lonLat2(LonLat) — Longitude/Latitude of destination point.fraction(number) — Fraction between the two points (0 = source point, 1 = destination point).
Returns
LonLat— Intermediate point between points.
getEquatorialSize(): number
Gets ellipsoid equatorial size.
Returns
number
getPolarSize(): number
Gets ellipsoid polar size.
Returns
number
lonLatToCartesian(lonlat: LonLat): Vec3
Calculate cartesian coordinates by its ECEF geodetic coordinates.
Parameters
lonlat(LonLat) — Geodetic coordinates.
Returns
lonLatToCartesianRes(lonlat: LonLat, res: Vec3): Vec3
Calculate cartesian coordinates by its ECEF geodetic coordinates.
Parameters
Returns
geodeticToCartesian(
lon: Number,
lat: Number,
height: Number,
res: Vec3,
): Vec3
Gets cartesian ECEF 3d coordinates from geodetic coordinates.
Parameters
lon(Number) — Longitude.lat(Number) — Latitude.height(Number, default: 0) — Height.res(Vec3) — Output result variable.
Returns
projToSurface(p: Vec3): LonLat
Gets Wgs84 geodetic coordinates from cartesian ECEF.
Parameters
p(Vec3) — Cartesian coordinates.
Returns
cartesianToLonLat(cart: Vec3): LonLat
Converts 3d cartesian coordinates to geodetic
Parameters
cart(Vec3) — Cartesian coordinates
Returns
cartesianToLonLatRes(cart: Vec3, res: LonLat): LonLat
Converts 3d cartesian coordinates to geodetic
Parameters
Returns
getSurfaceNormal3v(coord: Vec3): Vec3
Gets ellipsoid surface normal.
Parameters
coord(Vec3) — Spatial coordinates.
Returns
getGreatCircleDestination(
lonLat: LonLat,
azimuth: number,
dist: number,
): LonLat
Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m). Source: http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens http://mathiasbynens.be/ Based on the Vincenty direct formula by T. Vincenty, “Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations”, Survey Review, vol XXII no 176, 1975 http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
Parameters
lonLat(LonLat) — Origin coordinatesazimuth(number) — View azimuth in degreesdist(number) — Distance to the destination point coordinates in meters
Returns
inverse(lonLat1: LonLat, lonLat2: LonLat): IInverseResult
Returns inverse Geodesic solution for two points
Parameters
Returns
IInverseResult
direct(lonLat: LonLat, azimuth: number, dist: number): Object
Calculates the destination point given start point lat / lon, azimuth(deg) and distance (m). Source: http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized / cleaned up by Mathias Bynens http://mathiasbynens.be/ Based on the Vincenty direct formula by T. Vincenty, “Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations”, Survey Review, vol XXII no 176, 1975 http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
Parameters
lonLat(LonLat) — Origin coordinatesazimuth(number) — View azimuth in degreesdist(number) — Distance to the destination point coordinates in meters
Returns
Object
hitRay(origin: Vec3, direction: Vec3): Vec3
Returns cartesian coordinates of the intersection of a ray and an ellipsoid. If the ray doesn't hit ellipsoid returns null.
Parameters
Returns
getBearingDestination(lonLat1, bearing, distance): LonLat
Parameters
lonLat1bearing(default: 0)distance(default: 0)
Returns
- TODO:
- this is not precise function, needs to be replaced or removed
Static Methods
getBearing(lonLat1, lonLat2): number
REMOVE ASAP after
Parameters
lonLat1lonLat2
Returns
number
getIntermediatePointOnGreatCircle(
lonLat1: LonLat,
lonLat2: LonLat,
fraction: number,
): LonLat
Returns the point at given fraction between two points on the great circle.
Parameters
lonLat1(LonLat) — Longitude/Latitude of source point.lonLat2(LonLat) — Longitude/Latitude of destination point.fraction(number) — Fraction between the two points (0 = source point, 1 = destination point).
Returns
LonLat— Intermediate point between points.