Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public bool IsUnit()
 {
     return(BMath.ApproximatelyEqual(1, x * x + y * y + z * z));
 }
Exemplo n.º 3
0
 public bool ApproximatelyEquals(Vector3 o)
 {
     return(BMath.ApproximatelyEqual(X, o.X) && BMath.ApproximatelyEqual(Y, o.Y) && BMath.ApproximatelyEqual(Z, o.Z));
 }
Exemplo n.º 4
0
 public bool ApproximatelyEqual(Vector2 o)
 {
     return(BMath.ApproximatelyEqual(x, o.x) && BMath.ApproximatelyEqual(y, o.y));
 }
Exemplo n.º 5
0
 public bool IsUnit()
 {
     return(BMath.ApproximatelyEqual(1, real * real + i * i + j * j + k * k));
 }