Projection.unProject

Syntax

unProject(v: PP.Vector3);

Parameters

v. Vector.

Description

The unProject method transforms screen coordinates of vector to world ones.

Comments

World coordinates are transformed to screen coordinates by means of the project method.

Example

To execute the example the HTML page must contain the MapChart component map (see Example of Creating the MapChart Components). Open a spherical map. Get world coordinates of vector with the screen coordinates (-2018.5, 2702, 1):

// Get class object used to work with 3D projection
var projection = map.getGLControl().getProjection();
// Get ray direction from point
var vector = projection.unProject(new PP.Vector3(-2018.5, 2702, 1));
console.log("X coordinate of vector: " + vector.getX());
console.log("Y coordinates of vector: " + vector.getY());
console.log("Z coordinates of vector: " + vector.getZ());

As a result the console displays vector coordinates:

X coordinates of vector: 9.999733240684458

Y coordinate of vector: 9.99973295890323

Z coordinate of vector: 9.999209430791687

See also:

Projection