Esempio n. 1
0
 /// <summary>
 /// Creates a CoordinateF by using the X, Y and Z terms of a FloatVector
 /// </summary>
 /// <param name="floatVector"></param>
 public CoordinateF(FloatVector3 floatVector)
 {
     _x = floatVector.X;
     _y = floatVector.Y;
     _z = floatVector.Z;
     _m = float.NaN;
 }
Esempio n. 2
0
 /// <summary>
 /// Creates a CoordinateF by using the X, Y and Z terms of a FloatVector
 /// </summary>
 /// <param name="floatVector"></param>
 public CoordinateF(FloatVector3 floatVector)
 {
     _x = floatVector.X;
     _y = floatVector.Y;
     _z = floatVector.Z;
     _m = float.NaN;
 }
Esempio n. 3
0
        /// <summary>
        /// Returns the Cross Product of two vectors lhs and rhs
        /// </summary>
        /// <param name="lhs">Vector, the first input vector</param>
        /// <param name="rhs">Vector, the second input vector</param>
        /// <returns>A FloatVector3 containing the cross product of lhs and V</returns>
        public static FloatVector3 operator ^(FloatVector3 lhs, FloatVector3 rhs)
        {
            FloatVector3 result = new FloatVector3();

            result.X = (lhs.Y * rhs.Z - lhs.Z * rhs.Y);
            result.Y = (lhs.Z * rhs.X - lhs.X * rhs.Z);
            result.Z = (lhs.X * rhs.Y - lhs.Y * rhs.X);
            return(result);
        }
Esempio n. 4
0
 /// <summary>
 /// tests to see if the specified object has the same X, Y and Z values
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public override bool Equals(object obj)
 {
     if (obj is FloatVector3)
     {
         FloatVector3 fv = (FloatVector3)obj;
         if (fv.X == X && fv.Y == Y && fv.Z == Z)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 5
0
        /// <summary>
        /// Divides the components of vector lhs by the respective components
        /// ov vector V and returns the resulting vector.
        /// </summary>
        /// <param name="lhs">FloatVector3 Dividend (Numbers to be divided)</param>
        /// <param name="rhs">FloatVector3 Divisor (Numbers to divide by)</param>
        /// <returns>A FloatVector3 quotient of lhs and V</returns>
        /// <remarks>To prevent divide by 0, if a 0 is in V, it will return 0 in the result</remarks>
        public static FloatVector3 operator /(FloatVector3 lhs, FloatVector3 rhs)
        {
            FloatVector3 result = new FloatVector3();

            if (rhs.X > 0)
            {
                result.X = lhs.X / rhs.X;
            }
            if (rhs.Y > 0)
            {
                result.Y = lhs.Y / rhs.Y;
            }
            if (rhs.Z > 0)
            {
                result.Z = lhs.Z / rhs.Z;
            }
            return(result);
        }
Esempio n. 6
0
 /// <summary>
 /// Multiplies the source vector by a scalar.
 /// </summary>
 /// <param name="source"></param>
 /// <param name="scalar"></param>
 /// <returns></returns>
 public static FloatVector3 Multiply(FloatVector3 source, float scalar)
 {
     return new FloatVector3(source.X * scalar, source.Y * scalar, source.Z * scalar);
 }
Esempio n. 7
0
 /// <summary>
 /// Multiplies all the scalar members of the the two vectors
 /// </summary>
 /// <param name="lhs">Left hand side</param>
 /// <param name="rhs">Right hand side</param>
 /// <returns></returns>
 public static float Dot(FloatVector3 lhs, FloatVector3 rhs)
 {
     return lhs.X * rhs.X + lhs.Y * rhs.Y + lhs.Z * rhs.Z;
 }
Esempio n. 8
0
 /// <summary>
 /// Subtracts the specified value
 /// </summary>
 /// <param name="vector">A FloatVector3</param>
 public void Subtract(FloatVector3 vector)
 {
     X -= vector.X;
     Y -= vector.Y;
     Z -= vector.Z;
 }
Esempio n. 9
0
 /// <summary>
 /// Subtracts all the scalar members of the the two vectors
 /// </summary>
 /// <param name="lhs">Left hand side</param>
 /// <param name="rhs">Right hand side</param>
 /// <returns></returns>
 public static FloatVector3 Subtract(FloatVector3 lhs, FloatVector3 rhs)
 {
     return new FloatVector3(lhs.X - rhs.X, lhs.Y - rhs.Y, lhs.Z - rhs.Z);
 }
Esempio n. 10
0
 /// <summary>
 /// Adds the specified v
 /// </summary>
 /// <param name="vector">A FloatVector3 to add to this vector</param>
 public void Add(FloatVector3 vector)
 {
     X += vector.X;
     Y += vector.Y;
     Z += vector.Z;
 }
Esempio n. 11
0
 /// <summary>
 /// Adds all the scalar members of the the two vectors
 /// </summary>
 /// <param name="lhs">Left hand side</param>
 /// <param name="rhs">Right hand side</param>
 /// <returns></returns>
 public static FloatVector3 Add(FloatVector3 lhs, FloatVector3 rhs)
 {
     return new FloatVector3(lhs.X + rhs.X, lhs.Y + rhs.Y, lhs.Z + rhs.Z);
 }
Esempio n. 12
0
 /// <summary>
 /// Subtracts all the scalar members of the the two vectors
 /// </summary>
 /// <param name="lhs">Left hand side</param>
 /// <param name="rhs">Right hand side</param>
 /// <returns></returns>
 public static FloatVector3 Subtract(FloatVector3 lhs, FloatVector3 rhs)
 {
     return(new FloatVector3(lhs.X - rhs.X, lhs.Y - rhs.Y, lhs.Z - rhs.Z));
 }
Esempio n. 13
0
 /// <summary>
 /// Adds the specified v
 /// </summary>
 /// <param name="vector">A FloatVector3 to add to this vector</param>
 public void Add(FloatVector3 vector)
 {
     X += vector.X;
     Y += vector.Y;
     Z += vector.Z;
 }
Esempio n. 14
0
 /// <summary>
 /// Returns the Cross Product of two vectors lhs and rhs
 /// </summary>
 /// <param name="lhs">Vector, the first input vector</param>
 /// <param name="rhs">Vector, the second input vector</param>
 /// <returns>A FloatVector3 containing the cross product of lhs and V</returns>
 public static FloatVector3 operator ^(FloatVector3 lhs, FloatVector3 rhs)
 {
     FloatVector3 result = new FloatVector3();
     result.X = (lhs.Y * rhs.Z - lhs.Z * rhs.Y);
     result.Y = (lhs.Z * rhs.X - lhs.X * rhs.Z);
     result.Z = (lhs.X * rhs.Y - lhs.Y * rhs.X);
     return result;
 }
Esempio n. 15
0
 /// <summary>
 /// Subtracts the specified value
 /// </summary>
 /// <param name="vector">A FloatVector3</param>
 public void Subtract(FloatVector3 vector)
 {
     X -= vector.X;
     Y -= vector.Y;
     Z -= vector.Z;
 }
Esempio n. 16
0
 /// <summary>
 /// Multiplies the source vector by a scalar.
 /// </summary>
 /// <param name="source"></param>
 /// <param name="scalar"></param>
 /// <returns></returns>
 public static FloatVector3 Multiply(FloatVector3 source, float scalar)
 {
     return(new FloatVector3(source.X * scalar, source.Y * scalar, source.Z * scalar));
 }
Esempio n. 17
0
 /// <summary>
 /// Multiplies all the scalar members of the the two vectors
 /// </summary>
 /// <param name="lhs">Left hand side</param>
 /// <param name="rhs">Right hand side</param>
 /// <returns></returns>
 public static float Dot(FloatVector3 lhs, FloatVector3 rhs)
 {
     return(lhs.X * rhs.X + lhs.Y * rhs.Y + lhs.Z * rhs.Z);
 }
Esempio n. 18
0
 /// <summary>
 /// Divides the components of vector lhs by the respective components
 /// ov vector V and returns the resulting vector.
 /// </summary>
 /// <param name="lhs">FloatVector3 Dividend (Numbers to be divided)</param>
 /// <param name="rhs">FloatVector3 Divisor (Numbers to divide by)</param>
 /// <returns>A FloatVector3 quotient of lhs and V</returns>
 /// <remarks>To prevent divide by 0, if a 0 is in V, it will return 0 in the result</remarks>
 public static FloatVector3 operator /(FloatVector3 lhs, FloatVector3 rhs)
 {
     FloatVector3 result = new FloatVector3();
     if (rhs.X > 0) result.X = lhs.X / rhs.X;
     if (rhs.Y > 0) result.Y = lhs.Y / rhs.Y;
     if (rhs.Z > 0) result.Z = lhs.Z / rhs.Z;
     return result;
 }
Esempio n. 19
0
 /// <summary>
 /// Adds all the scalar members of the the two vectors
 /// </summary>
 /// <param name="lhs">Left hand side</param>
 /// <param name="rhs">Right hand side</param>
 /// <returns></returns>
 public static FloatVector3 Add(FloatVector3 lhs, FloatVector3 rhs)
 {
     return(new FloatVector3(lhs.X + rhs.X, lhs.Y + rhs.Y, lhs.Z + rhs.Z));
 }