コード例 #1
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <summary>
 /// Adds to vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <param name="result">The sum of both vectors.</param>
 public static void Add(ref FixVector4 value1, ref FixVector4 value2, out FixVector4 result)
 {
     result.x = value1.x + value2.x;
     result.y = value1.y + value2.y;
     result.z = value1.z + value2.z;
     result.w = value1.w + value2.w;
 }
コード例 #2
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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 FixVector4 value1, Fix64 scaleFactor, out FixVector4 result)
 {
     result.x = value1.x * scaleFactor;
     result.y = value1.y * scaleFactor;
     result.z = value1.z * scaleFactor;
     result.w = value1.w * scaleFactor;
 }
コード例 #3
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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 FixVector4 value1, Fix64 scaleFactor, out FixVector4 result)
 {
     result.x = value1.x / scaleFactor;
     result.y = value1.y / scaleFactor;
     result.z = value1.z / scaleFactor;
     result.w = value1.w / scaleFactor;
 }
コード例 #4
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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 FixVector4 value1, ref FixVector4 value2, out FixVector4 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;
     result.w = (value1.w > value2.w) ? value1.w : value2.w;
 }
コード例 #5
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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 FixVector4 value1, ref FixVector4 value2, out FixVector4 result)
 {
     result.x = value1.x - value2.x;
     result.y = value1.y - value2.y;
     result.z = value1.z - value2.z;
     result.w = value1.w - value2.w;
 }
コード例 #6
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <summary>
 /// Inverses the direction of a vector.
 /// </summary>
 /// <param name="value">The vector to inverse.</param>
 /// <param name="result">The negated vector.</param>
 public static void Negate(ref FixVector4 value, out FixVector4 result)
 {
     result.x = -value.x;
     result.y = -value.y;
     result.z = -value.z;
     result.w = -value.w;
 }
コード例 #7
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 public static void Transform(ref FixVector4 vector, ref FixMatrix4x4 matrix, out FixVector4 result)
 {
     result.x = vector.x * matrix.M11 + vector.y * matrix.M12 + vector.z * matrix.M13 + vector.w * matrix.M14;
     result.y = vector.x * matrix.M21 + vector.y * matrix.M22 + vector.z * matrix.M23 + vector.w * matrix.M24;
     result.z = vector.x * matrix.M31 + vector.y * matrix.M32 + vector.z * matrix.M33 + vector.w * matrix.M34;
     result.w = vector.x * matrix.M41 + vector.y * matrix.M42 + vector.z * matrix.M43 + vector.w * matrix.M44;
 }
コード例 #8
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <summary>
 /// Multiplies each component of the vector by the same components of the provided vector.
 /// </summary>
 public void Scale(FixVector4 other)
 {
     this.x = x * other.x;
     this.y = y * other.y;
     this.z = z * other.z;
     this.w = w * other.w;
 }
コード例 #9
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 static FixVector4()
 {
     one          = new FixVector4(1, 1, 1, 1);
     zero         = new FixVector4(0, 0, 0, 0);
     MinValue     = new FixVector4(Fix64.MinValue);
     MaxValue     = new FixVector4(Fix64.MaxValue);
     InternalZero = zero;
 }
コード例 #10
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
    /// <summary>
    /// Normalizes the given vector.
    /// </summary>
    /// <param name="value">The vector which should be normalized.</param>
    /// <param name="result">A normalized vector.</param>
    public static void Normalize(ref FixVector4 value, out FixVector4 result)
    {
        Fix64 num2 = ((value.x * value.x) + (value.y * value.y)) + (value.z * value.z) + (value.w * value.w);
        Fix64 num  = Fix64.One / Fix64.Sqrt(num2);

        result.x = value.x * num;
        result.y = value.y * num;
        result.z = value.z * num;
        result.w = value.w * num;
    }
コード例 #11
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
    /// <summary>
    /// Tests if an object is equal to this vector.
    /// </summary>
    /// <param name="obj">The object to test.</param>
    /// <returns>Returns true if they are euqal, otherwise false.</returns>
    #region public override bool Equals(object obj)
    public override bool Equals(object obj)
    {
        if (!(obj is FixVector4))
        {
            return(false);
        }
        FixVector4 other = (FixVector4)obj;

        return(((x == other.x) && (y == other.y)) && (z == other.z) && (w == other.w));
    }
コード例 #12
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
    /// <summary>
    /// Multiplies each component of the vector by the same components of the provided vector.
    /// </summary>
    public static FixVector4 Scale(FixVector4 vecA, FixVector4 vecB)
    {
        FixVector4 result;

        result.x = vecA.x * vecB.x;
        result.y = vecA.y * vecB.y;
        result.z = vecA.z * vecB.z;
        result.w = vecA.w * vecB.w;

        return(result);
    }
コード例 #13
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
    /// <summary>
    /// Swaps the components of both vectors.
    /// </summary>
    /// <param name="vector1">The first vector to swap with the second.</param>
    /// <param name="vector2">The second vector to swap with the first.</param>
    public static void Swap(ref FixVector4 vector1, ref FixVector4 vector2)
    {
        Fix64 temp;

        temp      = vector1.x;
        vector1.x = vector2.x;
        vector2.x = temp;

        temp      = vector1.y;
        vector1.y = vector2.y;
        vector2.y = temp;

        temp      = vector1.z;
        vector1.z = vector2.z;
        vector2.z = temp;

        temp      = vector1.w;
        vector1.w = vector2.w;
        vector2.w = temp;
    }
コード例 #14
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="value1">The first vector.</param>
 /// <param name="value2">The second vector.</param>
 /// <returns>Returns the dot product of both.</returns>
 #region public static Fix64 operator *(JVector value1, JVector value2)
 public static Fix64 operator *(FixVector4 value1, FixVector4 value2)
 {
     return(FixVector4.Dot(ref value1, ref value2));
 }
コード例 #15
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <summary>
 /// Normalizes the given vector.
 /// </summary>
 /// <param name="value">The vector which should be normalized.</param>
 /// <returns>A normalized vector.</returns>
 #region public static JVector Normalize(JVector value)
 public static FixVector4 Normalize(FixVector4 value)
 {
     FixVector4.Normalize(ref value, out FixVector4 result);
     return(result);
 }
コード例 #16
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <summary>
 /// Inverses the direction of a vector.
 /// </summary>
 /// <param name="value">The vector to inverse.</param>
 /// <returns>The negated vector.</returns>
 public static FixVector4 Negate(FixVector4 value)
 {
     FixVector4.Negate(ref value, out FixVector4 result);
     return(result);
 }
コード例 #17
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 public static Fix64 Distance(FixVector4 v1, FixVector4 v2)
 {
     return(Fix64.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) + (v1.w - v2.w) * (v1.w - v2.w)));
 }
コード例 #18
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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>
 #region public static JVector Subtract(JVector value1, JVector value2)
 public static FixVector4 Subtract(FixVector4 value1, FixVector4 value2)
 {
     FixVector4.Subtract(ref value1, ref value2, out FixVector4 result);
     return(result);
 }
コード例 #19
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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>
 #region public static JVector Transform(JVector position, JMatrix matrix)
 public static FixVector4 Transform(FixVector4 position, FixMatrix4x4 matrix)
 {
     FixVector4.Transform(ref position, ref matrix, out FixVector4 result);
     return(result);
 }
コード例 #20
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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>
 #region public static JVector Multiply(JVector value1, Fix64 scaleFactor)
 public static FixVector4 Multiply(FixVector4 value1, Fix64 scaleFactor)
 {
     FixVector4.Multiply(ref value1, scaleFactor, out FixVector4 result);
     return(result);
 }
コード例 #21
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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>
 #region public static void Add(JVector value1, JVector value2)
 public static FixVector4 Add(FixVector4 value1, FixVector4 value2)
 {
     FixVector4.Add(ref value1, ref value2, out FixVector4 result);
     return(result);
 }
コード例 #22
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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 Fix64 Dot(ref FixVector4 vector1, ref FixVector4 vector2)
 {
     return(((vector1.x * vector2.x) + (vector1.y * vector2.y)) + (vector1.z * vector2.z) + (vector1.w * vector2.w));
 }
コード例 #23
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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>
 #region public static Fix64 Dot(JVector vector1, JVector vector2)
 public static Fix64 Dot(FixVector4 vector1, FixVector4 vector2)
 {
     return(FixVector4.Dot(ref vector1, ref vector2));
 }
コード例 #24
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 /// <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 FixVector4 Divide(FixVector4 value1, Fix64 scaleFactor)
 {
     FixVector4.Divide(ref value1, scaleFactor, out FixVector4 result);
     return(result);
 }
コード例 #25
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 public static FixVector4 Lerp(FixVector4 from, FixVector4 to, Fix64 percent)
 {
     return(from + (to - from) * percent);
 }
コード例 #26
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 public static FixVector4 Abs(FixVector4 other)
 {
     return(new FixVector4(Fix64.Abs(other.x), Fix64.Abs(other.y), Fix64.Abs(other.z), Fix64.Abs(other.z)));
 }
コード例 #27
0
ファイル: FixVector4.cs プロジェクト: mengtest/FrameAlignment
 public static FixVector4 ClampMagnitude(FixVector4 vector, Fix64 maxLength)
 {
     return(Normalize(vector) * maxLength);
 }