distanceSquared

Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances using Cartesian4.distance.

// Returns 4.0, not 2.0
const d = Cartesian4.distance(
new Cartesian4(1.0, 0.0, 0.0, 0.0),
new Cartesian4(3.0, 0.0, 0.0, 0.0));

Return

The distance between two points.

Parameters

left

The first point to compute the distance from.

right

The second point to compute the distance to.

See also