Developer Guide

API Reference

@math.gl/core

@math.gl/culling

@math.gl/polygon

@math.gl/proj4

@math.gl/sun

@math.gl/web-mercator

Welcome to math.gl! math.gl is JavaScript math library focused on **geospatial** and **3D** use cases, designed as a composable, **modular toolbox**. math.gl provides a core module with classic vector and matrix classes, and a suite of optional modules implementing various aspects of geospatial and 3D math.

While the math.gl is highly **optimized for use with the WebGL and WebGPU APIs**, math.gl itself has no WebGL dependencies.

math.gl is a toolbox that offers a suite of composable modules.

In addition, math.gl provides a few deprecated legacy modules, to avoid breaking older applications.

Legacy Module | Description |
---|---|

`math.gl` | Re-exports the API from `@math.gl/core` . An "alias" for `@math.gl/core` to avoid breaking old applications. |

`viewport-mercator-project` | Re-exports the Web Mercator projection utilities in `@math.gl/web-mercator` . The viewport-mercator-project repository was moved to math.gl in Oct 2019. |

math.gl is fully supported on:

- Evergreen browsers: Recent versions of Chrome, Safari, Firefox, Edge etc.
- Node.js: Active and Maintenance LTS releases
- IE11: Supported (with certain performance caveats) using math.gl's fully transpiled
`es5`

distribution and`@babel/polyfills`

.

Note that Internet Explorer < 10 will not work. If your application needs to support older browsers, an option could be to use `gl-matrix`

directly.

- The core classes were originally developed as part of luma.gl v4 to provide a basic 3D math library for the luma.gl and deck.gl frameworks.
- math.gl was then broken out into its own module to allow it to mature in terms of functionality and stability and make it a proper home for additional 3D and Geospatial modules.
- parts of the Cesium math library were ported and published as independently usable math.gl modules (the geospatial and culling modules). This was a collaboration with the Cesium team around 3D Tiles support in loaders.gl,
- Additional geospatial modules have gradually been added to support more advanced use cases for deck.gl.

math.gl was inspired by and built upon some of the most proven open source JavaScript math libraries:

`gl-matrix`

- math.gl classes use gl-matrix under the hood- THREE.js math library - math.gl classes are API-compatible with a subset of the THREE.js classes and pass THREE.js test suites.
- The CesiumJS math library (Apache2) - The geospatial and culling modules were ported from Cesium code base.

MIT license. The libraries that the core `math.gl`

module are built on (e.g. gl-matrix) are also all open source and MIT licensed.

The `@math.gl/geospatial`

and `@math.gl/culling`

modules include Cesium-derived code which is Apache2 licensed.

math.gl will never include any code that is not under permissive license.