public T DistanceTo(Vec3 <T> point, T unit) { return((ClosestPointTo(point) - point).Length(unit)); }
public Line3(Vec3 <T> p0, Vec3 <T> p1, T unit) { pos = p0; dir = p1 - p0; dir.Normalize(unit); }
public Vec3 <T> ClosestPointTo(Vec3 <T> point) { return(((point - pos) ^ dir) * dir + pos); }
void Set(Vec3 <T> p0, Vec3 <T> p1, T unit) { pos = p0; dir = p1 - p0; dir.Normalize(unit); }