public static Vector3 MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta) { Vector3 a = target - current; float magnitude = a.Magnitude(); if (magnitude <= maxDistanceDelta || BMath.ApproximatelyEqual(magnitude, 0f)) { return(target); } else { return(current + a / magnitude * maxDistanceDelta); } }
public bool IsUnit() { return(BMath.ApproximatelyEqual(1, x * x + y * y + z * z)); }
public bool ApproximatelyEquals(Vector3 o) { return(BMath.ApproximatelyEqual(X, o.X) && BMath.ApproximatelyEqual(Y, o.Y) && BMath.ApproximatelyEqual(Z, o.Z)); }
public bool ApproximatelyEqual(Vector2 o) { return(BMath.ApproximatelyEqual(x, o.x) && BMath.ApproximatelyEqual(y, o.y)); }
public bool IsUnit() { return(BMath.ApproximatelyEqual(1, real * real + i * i + j * j + k * k)); }