TomTom Maps for JavaScript
    Preparing search index...

    Function localFrameMatrix

    • Returns the matrix that draws a local frame around origin on the map: x runs east, y north and z up from the origin, in metres, scaled as LocalFrameOptions sets.

      • Call it in a custom layer's render, with options.defaultProjectionData.mainMatrix.
      • It composes in double precision, so a street-scale scene doesn't jitter. Copy the result into a three.js camera's projectionMatrix, or into a Float32Array for a WebGL uniform.
      • It works in the mercator projection. In the globe projection, the map's matrix takes other coordinates.

      Parameters

      • mainMatrix: ArrayLike<number>

        The map's defaultProjectionData.mainMatrix for this frame.

      • origin: [number, number]

        The frame's origin, [longitude, latitude]. Its height is altitude.

      • options: LocalFrameOptions = {}

      Returns Float64Array

      render(gl, options) {
      const matrix = localFrameMatrix(options.defaultProjectionData.mainMatrix, [4.8897, 52.3731], {
      centerLatitude: map.mapLibreMap.getCenter().lat,
      });
      camera.projectionMatrix.fromArray(matrix);
      camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
      }