Projection.ortho

Syntax

ortho(left: Number, right: Number, top: Number, bottom: Number, near: Number, far: Number);

Parameters

left. Left border coordinate.

right. Right border coordinate.

top. Top border coordinate.

bottom. Bottom border coordinate.

near. Distance between a camera to the near clipping plane.

far. Distance between a camera and far clipping plane.

Description

The ortho method sets orthographic projection.

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 projection matrix:

// Get class object used to work with 3D projection
var projection = map.getGLControl().getProjection();
// Get projection matrix
console.log("Projection matrix: ");
console.log(projection.getProjectionMatrix().getData());

As a result the console displays projection matrix:

Projection matrix:

[4.717621803283691, 0, 0, 0, 0, 10.385396957397461, 0, 0, 0, 0, -1.0000020265579224, -1, 0, 0, -0.002000001957640052, 0]

 

Set orthographic projection and get a new projection matrix:

// Set orthographic projection
projection.ortho(10, 20, 20, 10, 100, 200);
// Get a new projection matrix
console.log("Projection matrix: ");
console.log(projection.getProjectionMatrix().getData());

As a result the console displays projection matrix:

Projection matrix:

[0.20000000298023224, 0, 0, 0, 0, -0.20000000298023224, 0, 0, 0, 0, -0.019999999552965164, 0, -3, 3, -3, 1]

See also:

Projection