distanceSquared

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

// Returns 4.0, not 2.0
const d = Cartesian3.distanceSquared(new Cartesian3(1.0, 0.0, 0.0), new Cartesian3(3.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