コード例 #1
0
 /// <summary>
 /// Adds two vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <returns>The sum of both vectors.</returns>
 public static Fixed64Vector3 Add(Fixed64Vector3 value1, Fixed64Vector3 value2)
 {
     Add(ref value1, ref value2, out Fixed64Vector3 result);
     return(result);
 }
コード例 #2
0
 /// <summary>
 /// Divides a vector by a factor.
 /// </summary>
 /// <param name="value1">The vector to divide.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 /// <returns>Returns the scaled vector.</returns>
 public static Fixed64Vector3 Divide(Fixed64Vector3 value1, Fixed64 scaleFactor)
 {
     Divide(ref value1, scaleFactor, out Fixed64Vector3 result);
     return(result);
 }
コード例 #3
0
 /// <summary>
 /// Multiply a vector with a factor.
 /// </summary>
 /// <param name="value1">The vector to multiply.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 /// <param name="result">Returns the multiplied vector.</param>
 public static void Multiply(ref Fixed64Vector3 value1, Fixed64 scaleFactor, out Fixed64Vector3 result)
 {
     result.x = value1.x * scaleFactor;
     result.y = value1.y * scaleFactor;
     result.z = value1.z * scaleFactor;
 }
コード例 #4
0
 public static Fixed64Quaternion Euler(Fixed64Vector3 eulerAngles)
 {
     return(Euler(eulerAngles.x, eulerAngles.y, eulerAngles.z));
 }
コード例 #5
0
        /// <summary>
        /// The cross product of two vectors.
        /// </summary>
        /// <param name="vector1">The first vector.</param>
        /// <param name="vector2">The second vector.</param>
        /// <param name="result">The cross product of both vectors.</param>
        public static void Cross(ref Fixed64Vector3 vector1, ref Fixed64Vector3 vector2, out Fixed64Vector3 result)
        {
            Fixed64 num3 = (vector1.y * vector2.z) - (vector1.z * vector2.y);
            Fixed64 num2 = (vector1.z * vector2.x) - (vector1.x * vector2.z);
            Fixed64 num  = (vector1.x * vector2.y) - (vector1.y * vector2.x);

            result.x = num3;
            result.y = num2;
            result.z = num;
        }
コード例 #6
0
 /// <summary>
 /// Normalizes the given vector.
 /// </summary>
 /// <param name="value">The vector which should be normalized.</param>
 /// <returns>A normalized vector.</returns>
 public static Fixed64Vector3 Normalize(Fixed64Vector3 value)
 {
     Normalize(ref value, out Fixed64Vector3 result);
     return(result);
 }
コード例 #7
0
 public static Fixed64 Distance(Fixed64Vector3 v1, Fixed64Vector3 v2)
 {
     return(Fixed64.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z)));
 }
コード例 #8
0
        /// <summary>
        /// Subtracts to vectors.
        /// </summary>
        /// <param name="value1">The first vector.</param>
        /// <param name="value2">The second vector.</param>
        /// <param name="result">The difference of both vectors.</param>
        public static void Subtract(ref Fixed64Vector3 value1, ref Fixed64Vector3 value2, out Fixed64Vector3 result)
        {
            Fixed64 num0 = value1.x - value2.x;
            Fixed64 num1 = value1.y - value2.y;
            Fixed64 num2 = value1.z - value2.z;

            result.x = num0;
            result.y = num1;
            result.z = num2;
        }
コード例 #9
0
 /// <summary>
 /// Multiplies each component of the vector by the same components of the provided vector.
 /// </summary>
 public void Scale(Fixed64Vector3 other)
 {
     x = x * other.x;
     y = y * other.y;
     z = z * other.z;
 }
コード例 #10
0
 public static Fixed64Vector3 Lerp(Fixed64Vector3 from, Fixed64Vector3 to, Fixed64 percent)
 {
     return(from + (to - from) * percent);
 }
コード例 #11
0
 public static Fixed64Vector3 ClampMagnitude(Fixed64Vector3 vector, Fixed64 maxLength)
 {
     return(Normalize(vector) * maxLength);
 }
コード例 #12
0
 public static Fixed64Vector3 Abs(Fixed64Vector3 other)
 {
     return(new Fixed64Vector3(Fixed64.Abs(other.x), Fixed64.Abs(other.y), Fixed64.Abs(other.z)));
 }
コード例 #13
0
        public void SetFromToRotation(Fixed64Vector3 fromDirection, Fixed64Vector3 toDirection)
        {
            Fixed64Quaternion targetRotation = FromToRotation(fromDirection, toDirection);

            Set(targetRotation.x, targetRotation.y, targetRotation.z, targetRotation.w);
        }
コード例 #14
0
 /// <summary>
 /// Divides a vector by a factor.
 /// </summary>
 /// <param name="value1">The vector to divide.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 /// <param name="result">Returns the scaled vector.</param>
 public static void Divide(ref Fixed64Vector3 value1, Fixed64 scaleFactor, out Fixed64Vector3 result)
 {
     result.x = value1.x / scaleFactor;
     result.y = value1.y / scaleFactor;
     result.z = value1.z / scaleFactor;
 }
コード例 #15
0
 /// <summary>
 /// Gets a vector with the maximum x,y and z values of both vectors.
 /// </summary>
 /// <param name="value1">The first value.</param>
 /// <param name="value2">The second value.</param>
 /// <param name="result">A vector with the maximum x,y and z values of both vectors.</param>
 public static void Max(ref Fixed64Vector3 value1, ref Fixed64Vector3 value2, out Fixed64Vector3 result)
 {
     result.x = (value1.x > value2.x) ? value1.x : value2.x;
     result.y = (value1.y > value2.y) ? value1.y : value2.y;
     result.z = (value1.z > value2.z) ? value1.z : value2.z;
 }
コード例 #16
0
 /// <summary>
 /// Subtracts two vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <returns>The difference of both vectors.</returns>
 public static Fixed64Vector3 Subtract(Fixed64Vector3 value1, Fixed64Vector3 value2)
 {
     Subtract(ref value1, ref value2, out Fixed64Vector3 result);
     return(result);
 }
コード例 #17
0
 /// <summary>
 /// Transforms a vector by the given matrix.
 /// </summary>
 /// <param name="position">The vector to transform.</param>
 /// <param name="matrix">The transform matrix.</param>
 /// <returns>The transformed vector.</returns>
 public static Fixed64Vector3 Transform(Fixed64Vector3 position, Fixed64Matrix matrix)
 {
     Transform(ref position, ref matrix, out Fixed64Vector3 result);
     return(result);
 }
コード例 #18
0
 /// <summary>
 /// The cross product of two vectors.
 /// </summary>
 /// <param name="vector1">The first vector.</param>
 /// <param name="vector2">The second vector.</param>
 /// <returns>The cross product of both vectors.</returns>
 public static Fixed64Vector3 Cross(Fixed64Vector3 vector1, Fixed64Vector3 vector2)
 {
     Cross(ref vector1, ref vector2, out Fixed64Vector3 result);
     return(result);
 }
コード例 #19
0
        /// <summary>
        /// Transforms a vector by the transposed of the given Matrix.
        /// </summary>
        /// <param name="position">The vector to transform.</param>
        /// <param name="matrix">The transform matrix.</param>
        /// <param name="result">The transformed vector.</param>
        public static void TransposedTransform(ref Fixed64Vector3 position, ref Fixed64Matrix matrix, out Fixed64Vector3 result)
        {
            Fixed64 num0 = ((position.x * matrix.M11) + (position.y * matrix.M12)) + (position.z * matrix.M13);
            Fixed64 num1 = ((position.x * matrix.M21) + (position.y * matrix.M22)) + (position.z * matrix.M23);
            Fixed64 num2 = ((position.x * matrix.M31) + (position.y * matrix.M32)) + (position.z * matrix.M33);

            result.x = num0;
            result.y = num1;
            result.z = num2;
        }
コード例 #20
0
 /// <summary>
 /// Inverses the direction of a vector.
 /// </summary>
 /// <param name="value">The vector to inverse.</param>
 /// <returns>The negated vector.</returns>
 public static Fixed64Vector3 Negate(Fixed64Vector3 value)
 {
     Negate(ref value, out Fixed64Vector3 result);
     return(result);
 }
コード例 #21
0
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="vector1">The first vector.</param>
 /// <param name="vector2">The second vector.</param>
 /// <returns>Returns the dot product of both vectors.</returns>
 public static Fixed64 Dot(Fixed64Vector3 vector1, Fixed64Vector3 vector2)
 {
     return(Dot(ref vector1, ref vector2));
 }
コード例 #22
0
 /// <summary>
 /// Multiply a vector with a factor.
 /// </summary>
 /// <param name="value1">The vector to multiply.</param>
 /// <param name="scaleFactor">The scale factor.</param>
 /// <returns>Returns the multiplied vector.</returns>
 public static Fixed64Vector3 Multiply(Fixed64Vector3 value1, Fixed64 scaleFactor)
 {
     Multiply(ref value1, scaleFactor, out Fixed64Vector3 result);
     return(result);
 }
コード例 #23
0
 /// <summary>
 /// Calculates the dot product of both vectors.
 /// </summary>
 /// <param name="vector1">The first vector.</param>
 /// <param name="vector2">The second vector.</param>
 /// <returns>Returns the dot product of both vectors.</returns>
 public static Fixed64 Dot(ref Fixed64Vector3 vector1, ref Fixed64Vector3 vector2)
 {
     return(((vector1.x * vector2.x) + (vector1.y * vector2.y)) + (vector1.z * vector2.z));
 }
コード例 #24
0
 public static Fixed64 Angle(Fixed64Vector3 a, Fixed64Vector3 b)
 {
     return(Fixed64.Acos(a.Normalized * b.Normalized) * Fixed64.Rad2Deg);
 }
コード例 #25
0
 public static Fixed64Quaternion LookRotation(Fixed64Vector3 forward, Fixed64Vector3 upwards)
 {
     return(CreateFromMatrix(Fixed64Matrix.LookAt(forward, upwards)));
 }