Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev-docs/RFCs/math-monorepo-rfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ Using with pure javascript `Array`

```js
import {Ellipsoid} from '@math.gl/geospatial';
const cartesian = Ellipsoid.WSG84.cartographicToCartesian([lng, lat, z]);
const cartesian = Ellipsoid.WSG84.cartographicToCartesian([lngDegrees, latDegress, zMetresFromEllipsoid]);
```

Using with math.gl `Vector3`:

```js
import {Ellipsoid} from '@math.gl/geospatial';
import {Vector3} from '@math.gl/core';
const cartesian = Ellipsoid.WSG84.cartographicToCartesian(new Vector3(lng, lat, z));
const cartesian = Ellipsoid.WSG84.cartographicToCartesian(new Vector3(lngDegrees, latDegress, zMetresFromEllipsoid));
```

### Dependencies and Bundle Size
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/geospatial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ Attribution: From <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#/

## Usage Examples

A major use of this library is to convert between "cartesian" (`x`, `y`, `z`) and "cartographic" (`longitude`, `latitude`, `height`) representations of WSG84 coordinates. The `Ellipsoid` class implements these calculations.
A major use of this library is to convert between "cartesian" (`x`, `y`, `z`) and "cartographic" (`longitude degrees`, `latitude degrees`, `height in metres from ellipsoid`) representations of WSG84 coordinates. The `Ellipsoid` class implements these calculations.

## Usage

Determine the Cartesian representation of a Cartographic position on a WGS84 ellipsoid.

```js
import {toRadians} from '@math.gl/core';
import {Ellipsoid} from '@math.gl/geospatial';
const cartographicPosition = [toRadians(21), toRadians(78), 5000];
const cartographicPosition = [21, 78, 5000]; // longitude degrees, latitude degrees, meters above ellipsoid
const cartesianPosition = Ellipsoid.WGS84.cartographicToCartesian(cartographicPosition);
```

Expand All @@ -47,7 +46,8 @@ Get the transform from local east-north-up at cartographic (0.0, 0.0) to Earth's

```js
import {Ellipsoid} from '@math.gl/geospatial';
const transformMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame([0, 0, 0]);
const cartesianOrigin = [17832.12, 83234.52, 952313.73]
const transformMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);
```

## Framework Independence
Expand Down
12 changes: 6 additions & 6 deletions docs/modules/geospatial/api-reference/ellipsoid.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ Rather than constructing this object directly, one of the provided constants is
Determine the Cartesian representation of a Cartographic position on a WGS84 ellipsoid.

```js
import {toRadians} from '@math.gl/core';
import {Ellipsoid} from '@math.gl/geospatial';
const cartographicPosition = [toRadians(21), toRadians(78), 5000];
const cartographicPosition = [21, 78, 5000]; // longitude degrees, latitude degrees, meters above ellipsoid
const cartesianPosition = Ellipsoid.WGS84.cartographicToCartesian(cartographicPosition);
```

Expand All @@ -33,7 +32,8 @@ Get the transform from local east-north-up at cartographic (0.0, 0.0) to Earth's

```js
import {Ellipsoid} from '@math.gl/geospatial';
const transformMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame([0, 0, 0]);
const cartesianOrigin = [17832.12, 83234.52, 952313.73]
const transformMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);
```

## Static Fields
Expand Down Expand Up @@ -116,7 +116,7 @@ Returns

Converts the provided cartographic to Cartesian representation.

- `cartographic` The cartographic position.
- `cartographic` The cartographic position (degrees).
- `result` Optional object onto which to store the result.

Returns
Expand Down Expand Up @@ -144,7 +144,7 @@ The local axes are defined as:
- The `y` axis points in the local north direction.
- The `z` axis points in the direction of the ellipsoid surface normal which passes through the position.

- `origin` The center point of the local reference frame.
- `origin` The cartesian coordinate of the center point of the local reference frame.
- `ellipsoid`=`Ellipsoid.WGS84` The ellipsoid whose fixed frame is used in the transformation.
- `result` Optional object onto which to store the result.

Expand All @@ -163,7 +163,7 @@ Computes a 4x4 transformation matrix from a reference frame centered at the prov
- `firstAxis` name of the first axis of the local reference frame. Must be 'east', 'north', 'up', 'west', 'south' or 'down'.
- `secondAxis` name of the second axis of the local reference frame.
- `thirdAxis` name of the third axis of the local reference frame. Can be omitted as it is implied by the cross product of the first two axis.
- `origin` The center point of the local reference frame.
- `origin` The cartesian coordinate of the center point of the local reference frame.
- `result` Optional object onto which to store the result.

Returns
Expand Down
Loading