Ejemplo n.º 1
0
 /// <summary>Constructs and initializes a Tuple4f from the specified Tuple4f.</summary>
 /// <remarks>Constructs and initializes a Tuple4f from the specified Tuple4f.</remarks>
 /// <param name="t1">the Tuple4f containing the initialization x y z w data</param>
 public Tuple4f(Tuple4f t1)
 {
     this.x = t1.x;
     this.y = t1.y;
     this.z = t1.z;
     this.w = t1.w;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the value of this tuple to the scalar multiplication
 /// of itself and then adds tuple t1 (this = s*this + t1).
 /// </summary>
 /// <remarks>
 /// Sets the value of this tuple to the scalar multiplication
 /// of itself and then adds tuple t1 (this = s*this + t1).
 /// </remarks>
 /// <param name="s">the scalar value</param>
 /// <param name="t1">the tuple to be added</param>
 public void ScaleAdd(float s, Tuple4f t1)
 {
     this.x = s * this.x + t1.x;
     this.y = s * this.y + t1.y;
     this.z = s * this.z + t1.z;
     this.w = s * this.w + t1.w;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the value of this tuple to the scalar multiplication
 /// of tuple t1.
 /// </summary>
 /// <remarks>
 /// Sets the value of this tuple to the scalar multiplication
 /// of tuple t1.
 /// </remarks>
 /// <param name="s">the scalar value</param>
 /// <param name="t1">the source tuple</param>
 public void Scale(float s, Tuple4f t1)
 {
     this.x = s * t1.x;
     this.y = s * t1.y;
     this.z = s * t1.z;
     this.w = s * t1.w;
 }
Ejemplo n.º 4
0
 /// <summary>Sets the value of this tuple to the negation of tuple t1.</summary>
 /// <remarks>Sets the value of this tuple to the negation of tuple t1.</remarks>
 /// <param name="t1">the source tuple</param>
 public void Negate(Tuple4f t1)
 {
     this.x = -t1.x;
     this.y = -t1.y;
     this.z = -t1.z;
     this.w = -t1.w;
 }
Ejemplo n.º 5
0
 /// <summary>Constructs and initializes a Color4f from the specified Tuple4f.</summary>
 /// <remarks>Constructs and initializes a Color4f from the specified Tuple4f.</remarks>
 /// <param name="t1">the Tuple4f containing the initialization r,g,b,a data</param>
 public Color4f(Tuple4f t1)
     : base(t1)
 {
 }
Ejemplo n.º 6
0
 /// <summary>Constructs and initializes a Point4d from the specified Tuple4f.</summary>
 /// <remarks>Constructs and initializes a Point4d from the specified Tuple4f.</remarks>
 /// <param name="t1">the Tuple4f containing the initialization x y z w data</param>
 public Point4d(Tuple4f t1)
     : base(t1)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Transform the vector vec using this Transform and place the
 /// result back into vec.
 /// </summary>
 /// <remarks>
 /// Transform the vector vec using this Transform and place the
 /// result back into vec.
 /// </remarks>
 /// <param name="vec">the single precision vector to be transformed</param>
 public void Transform(Tuple4f vec)
 {
     float x;
     float y;
     float z;
     x = m00 * vec.x + m01 * vec.y + m02 * vec.z + m03 * vec.w;
     y = m10 * vec.x + m11 * vec.y + m12 * vec.z + m13 * vec.w;
     z = m20 * vec.x + m21 * vec.y + m22 * vec.z + m23 * vec.w;
     vec.w = m30 * vec.x + m31 * vec.y + m32 * vec.z + m33 * vec.w;
     vec.x = x;
     vec.y = y;
     vec.z = z;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Sets the value of this tuple to the difference
 /// of tuples t1 and t2 (this = t1 - t2).
 /// </summary>
 /// <remarks>
 /// Sets the value of this tuple to the difference
 /// of tuples t1 and t2 (this = t1 - t2).
 /// </remarks>
 /// <param name="t1">the first tuple</param>
 /// <param name="t2">the second tuple</param>
 public void Sub(Tuple4f t1, Tuple4f t2)
 {
     this.x = t1.x - t2.x;
     this.y = t1.y - t2.y;
     this.z = t1.z - t2.z;
     this.w = t1.w - t2.w;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Clamps the minimum value of the tuple parameter to the min
 /// parameter and places the values into this tuple.
 /// </summary>
 /// <remarks>
 /// Clamps the minimum value of the tuple parameter to the min
 /// parameter and places the values into this tuple.
 /// </remarks>
 /// <param name="min">the lowest value in the tuple after clamping</param>
 /// <param name="t">the source tuple, which will not be modified</param>
 public void ClampMin(float min, Tuple4f t)
 {
     if (t.x < min)
     {
         x = min;
     }
     else
     {
         x = t.x;
     }
     if (t.y < min)
     {
         y = min;
     }
     else
     {
         y = t.y;
     }
     if (t.z < min)
     {
         z = min;
     }
     else
     {
         z = t.z;
     }
     if (t.w < min)
     {
         w = min;
     }
     else
     {
         w = t.w;
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Clamps the maximum value of the tuple parameter to the max
 /// parameter and places the values into this tuple.
 /// </summary>
 /// <remarks>
 /// Clamps the maximum value of the tuple parameter to the max
 /// parameter and places the values into this tuple.
 /// </remarks>
 /// <param name="max">the highest value in the tuple after clamping</param>
 /// <param name="t">the source tuple, which will not be modified</param>
 public void ClampMax(float max, Tuple4f t)
 {
     if (t.x > max)
     {
         x = max;
     }
     else
     {
         x = t.x;
     }
     if (t.y > max)
     {
         y = max;
     }
     else
     {
         y = t.y;
     }
     if (t.z > max)
     {
         z = max;
     }
     else
     {
         z = t.z;
     }
     if (t.w > max)
     {
         w = max;
     }
     else
     {
         w = t.z;
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Clamps the tuple parameter to the range [low, high] and
 /// places the values into this tuple.
 /// </summary>
 /// <remarks>
 /// Clamps the tuple parameter to the range [low, high] and
 /// places the values into this tuple.
 /// </remarks>
 /// <param name="min">the lowest value in the tuple after clamping</param>
 /// <param name="max">the highest value in the tuple after clamping</param>
 /// <param name="t">the source tuple, which will not be modified</param>
 public void Clamp(float min, float max, Tuple4f t)
 {
     if (t.x > max)
     {
         x = max;
     }
     else
     {
         if (t.x < min)
         {
             x = min;
         }
         else
         {
             x = t.x;
         }
     }
     if (t.y > max)
     {
         y = max;
     }
     else
     {
         if (t.y < min)
         {
             y = min;
         }
         else
         {
             y = t.y;
         }
     }
     if (t.z > max)
     {
         z = max;
     }
     else
     {
         if (t.z < min)
         {
             z = min;
         }
         else
         {
             z = t.z;
         }
     }
     if (t.w > max)
     {
         w = max;
     }
     else
     {
         if (t.w < min)
         {
             w = min;
         }
         else
         {
             w = t.w;
         }
     }
 }
Ejemplo n.º 12
0
 /// <summary>Sets the value of this tuple to the sum of itself and t1.</summary>
 /// <remarks>Sets the value of this tuple to the sum of itself and t1.</remarks>
 /// <param name="t1">the other tuple</param>
 public void Add(Tuple4f t1)
 {
     this.x += t1.x;
     this.y += t1.y;
     this.z += t1.z;
     this.w += t1.w;
 }
Ejemplo n.º 13
0
 /// <summary>Sets the value of this tuple to the sum of tuples t1 and t2.</summary>
 /// <remarks>Sets the value of this tuple to the sum of tuples t1 and t2.</remarks>
 /// <param name="t1">the first tuple</param>
 /// <param name="t2">the second tuple</param>
 public void Add(Tuple4f t1, Tuple4f t2)
 {
     this.x = t1.x + t2.x;
     this.y = t1.y + t2.y;
     this.z = t1.z + t2.z;
     this.w = t1.w + t2.w;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Sets each component of the tuple parameter to its absolute
 /// value and places the modified values into this tuple.
 /// </summary>
 /// <remarks>
 /// Sets each component of the tuple parameter to its absolute
 /// value and places the modified values into this tuple.
 /// </remarks>
 /// <param name="t">the source tuple, which will not be modified</param>
 public void Absolute(Tuple4f t)
 {
     x = Math.Abs(t.x);
     y = Math.Abs(t.y);
     z = Math.Abs(t.z);
     w = Math.Abs(t.w);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Returns true if the L-infinite distance between this tuple
 /// and tuple t1 is less than or equal to the epsilon parameter,
 /// otherwise returns false.
 /// </summary>
 /// <remarks>
 /// Returns true if the L-infinite distance between this tuple
 /// and tuple t1 is less than or equal to the epsilon parameter,
 /// otherwise returns false.  The L-infinite
 /// distance is equal to
 /// MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(w1-w2)].
 /// </remarks>
 /// <param name="t1">the tuple to be compared to this tuple</param>
 /// <param name="epsilon">the threshold value</param>
 /// <returns>true or false</returns>
 public virtual bool EpsilonEquals(Tuple4f t1, float epsilon)
 {
     float diff;
     diff = x - t1.x;
     if (float.IsNaN(diff))
     {
         return false;
     }
     if ((diff < 0 ? -diff : diff) > epsilon)
     {
         return false;
     }
     diff = y - t1.y;
     if (float.IsNaN(diff))
     {
         return false;
     }
     if ((diff < 0 ? -diff : diff) > epsilon)
     {
         return false;
     }
     diff = z - t1.z;
     if (float.IsNaN(diff))
     {
         return false;
     }
     if ((diff < 0 ? -diff : diff) > epsilon)
     {
         return false;
     }
     diff = w - t1.w;
     if (float.IsNaN(diff))
     {
         return false;
     }
     if ((diff < 0 ? -diff : diff) > epsilon)
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 16
0
 /// <summary>Sets the value of this tuple to the value of tuple t1.</summary>
 /// <remarks>Sets the value of this tuple to the value of tuple t1.</remarks>
 /// <param name="t1">the tuple to be copied</param>
 public void Set(Tuple4f t1)
 {
     this.x = t1.x;
     this.y = t1.y;
     this.z = t1.z;
     this.w = t1.w;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Returns true if all of the data members of Tuple4f t1 are
 /// equal to the corresponding data members in this Tuple4f.
 /// </summary>
 /// <remarks>
 /// Returns true if all of the data members of Tuple4f t1 are
 /// equal to the corresponding data members in this Tuple4f.
 /// </remarks>
 /// <param name="t1">the vector with which the comparison is made</param>
 /// <returns>true or false</returns>
 public virtual bool Equals(Tuple4f t1)
 {
     try
     {
         return (this.x == t1.x && this.y == t1.y && this.z == t1.z && this.w == t1.w);
     }
     catch (ArgumentNullException)
     {
         return false;
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Sets the value of this tuple to the difference
 /// of itself and t1 (this = this - t1).
 /// </summary>
 /// <remarks>
 /// Sets the value of this tuple to the difference
 /// of itself and t1 (this = this - t1).
 /// </remarks>
 /// <param name="t1">the other tuple</param>
 public void Sub(Tuple4f t1)
 {
     this.x -= t1.x;
     this.y -= t1.y;
     this.z -= t1.z;
     this.w -= t1.w;
 }
Ejemplo n.º 19
0
 /// <summary>Copies the values of this tuple into the tuple t.</summary>
 /// <remarks>Copies the values of this tuple into the tuple t.</remarks>
 /// <param name="t">the target tuple</param>
 public void Get(Tuple4f t)
 {
     t.x = this.x;
     t.y = this.y;
     t.z = this.z;
     t.w = this.w;
 }
Ejemplo n.º 20
0
 /// <summary>Constructs and initializes a Quat4d from the specified Tuple4f.</summary>
 /// <remarks>Constructs and initializes a Quat4d from the specified Tuple4f.</remarks>
 /// <param name="t1">the Tuple4f containing the initialization x y z w data</param>
 public Quat4d(Tuple4f t1)
 {
     double mag;
     mag = 1.0 / Math.Sqrt(t1.x * t1.x + t1.y * t1.y + t1.z * t1.z + t1.w * t1.w);
     x = t1.x * mag;
     y = t1.y * mag;
     z = t1.z * mag;
     w = t1.w * mag;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Linearly interpolates between this tuple and tuple t1 and
 /// places the result into this tuple:  this = (1-alpha)*this + alpha*t1.
 /// </summary>
 /// <remarks>
 /// Linearly interpolates between this tuple and tuple t1 and
 /// places the result into this tuple:  this = (1-alpha)*this + alpha*t1.
 /// </remarks>
 /// <param name="t1">the first tuple</param>
 /// <param name="alpha">the alpha interpolation parameter</param>
 public virtual void Interpolate(Tuple4f t1, float alpha)
 {
     this.x = (1 - alpha) * this.x + alpha * t1.x;
     this.y = (1 - alpha) * this.y + alpha * t1.y;
     this.z = (1 - alpha) * this.z + alpha * t1.z;
     this.w = (1 - alpha) * this.w + alpha * t1.w;
 }
Ejemplo n.º 22
0
 /// <summary>Constructs and initializes a Vector4f from the specified Tuple4f.</summary>
 /// <remarks>Constructs and initializes a Vector4f from the specified Tuple4f.</remarks>
 /// <param name="t1">the Tuple4f containing the initialization x y z w data</param>
 public Vector4f(Tuple4f t1)
     : base(t1)
 {
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Transform the vector vec using this Transform and place the
 /// result back into vec.
 /// </summary>
 /// <remarks>
 /// Transform the vector vec using this Transform and place the
 /// result back into vec.
 /// </remarks>
 /// <param name="vec">the single precision vector to be transformed</param>
 public void Transform(Tuple4f vec)
 {
     float x;
     float y;
     float z;
     x = (float)(m00 * vec.x + m01 * vec.y + m02 * vec.z + m03 * vec.w);
     y = (float)(m10 * vec.x + m11 * vec.y + m12 * vec.z + m13 * vec.w);
     z = (float)(m20 * vec.x + m21 * vec.y + m22 * vec.z + m23 * vec.w);
     vec.w = (float)(m30 * vec.x + m31 * vec.y + m32 * vec.z + m33 * vec.w);
     vec.x = x;
     vec.y = y;
     vec.z = z;
 }