closestPointToPoint method
Implementation
Vector3 closestPointToPoint(Vector3 point, Vector3 target) {
target.sub2(point, origin);
final directionDistance = target.dot(direction);
if (directionDistance < 0) {
return target.setFrom(origin);
}
return target.setFrom(direction).scale(directionDistance).add(origin);
}