public default float distanceTo(XYZ v) { if (v != null) { final float dx = x() - v.x(); final float dy = y() - v.y(); final float dz = z() - v.z(); return (float) Math.sqrt(dx * dx + dy * dy + dz * dz); } else { return Float.NaN; } }
public default XYZ interpolateTo(XYZ v, float f, InterpolateStrategy s) { return new Vec3D( s.interpolate(x(), v.x(), f), s.interpolate(y(), v.y(), f), s.interpolate(z(), v.z(), f)); }
public default Vec3D sub(XYZ v) { return new Vec3D(x() - v.x(), y() - v.y(), z() - v.z()); }
public default XYZ interpolateTo(XYZ v, float f) { return new Vec3D(x() + (v.x() - x()) * f, y() + (v.y() - y()) * f, z() + (v.z() - z()) * f); }