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