Projection.translate

Syntax

translate(v_x: PP.Vector3 || Number, y: Number, z: Number);

Parameters

v_x. Offset angle or its X component

y. Y component of vector

z. Z component of vector.

Description

The translate method offsets a coordinate system.

Example

To execute the example the HTML page must contain the MapChart component map (see Example of Creating the MapChart Component). Open a spherical map. Get model and view matrix:

// Get class object used to work with 3D projection
var projection = map.getGLControl().getProjection();
// Get model and view matrix
console.log("Model and view matrix: ");
console.log(projection.getModelMatrix().getData());

As a result the console displays model and view matrix:

Model and view matrix:

[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1.089900016784668, 1]

 

Offset coordinate system and get a new model and view matrix:

// Offset coordinate system
projection.translate(100, 100);
// Get a new model and view matrix
console.log("Model and view matrix: ");
console.log(projection.getModelMatrix().getData());

As a result the console displays model and view matrix:

Model and view matrix:

[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 100, -1.089900016784668, 1]

See also:

Projection