Projection.getRay

Syntax

getRay(pos: Object);

Parameters

pos. Coordinates of ray start point.

Description

The getRay method returns a ray that comes out from the specified point.

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 direction coordinates for the ray that comes out from the point with the coordinates (10, 10):

// Get class object used to work with 3D projection
var projection = map.getGLControl().getProjection();
// Get ray direction from the point
var direction = projection.getRay({
    X: 10,
    Y: 10
}).getDirection();
console.log("X coordinate of ray: " + direction.getX());
console.log("Y coordinate of ray: " + direction.getY());
console.log("Z coordinate of ray: " + direction.getZ());

As a result the console displays ray coordinates:

X coordinate of ray: -0.20233237191132247

Y coordinate of ray: 0.08951007928384862

Z coordinate of ray: -0.9752176972262846

See also:

Projection