distanceSquaredTo

Computes the estimated distance squared from the closest point on a bounding box to a point.

// Sort bounding boxes from back to front
boxes.sort(function(a, b) {
return OrientedBoundingBox.distanceSquaredTo(b, camera.positionWC) - OrientedBoundingBox.distanceSquaredTo(a, camera.positionWC);
});

Return

The distance squared from the oriented bounding box to the point. Returns 0 if the point is inside the box.

Parameters

box

The box.

cartesian

The point

See also