/// <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(double s, Tuple3d t1) { this.x = s * t1.x; this.y = s * t1.y; this.z = s * t1.z; }
// Compatible with 1.1 /// <summary> /// Sets the x,y,z components of this point to the corresponding /// components of tuple t1. /// </summary> /// <remarks> /// Sets the x,y,z components of this point to the corresponding /// components of tuple t1. The w component of this point /// is set to 1. /// </remarks> /// <param name="t1">the tuple to be copied</param> /// <since>vecmath 1.2</since> public void Set(Tuple3d t1) { this.x = t1.x; this.y = t1.y; this.z = t1.z; this.w = 1.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(Tuple3d t1, Tuple3d t2) { this.x = t1.x + t2.x; this.y = t1.y + t2.y; this.z = t1.z + t2.z; }
/// <summary> /// Multiply this matrix by the tuple t and and place the result /// into the tuple "result" (result = this*t). /// </summary> /// <remarks> /// Multiply this matrix by the tuple t and and place the result /// into the tuple "result" (result = this*t). /// </remarks> /// <param name="t">the tuple to be multiplied by this matrix</param> /// <param name="result">the tuple into which the product is placed</param> public void Transform(Tuple3d t, Tuple3d result) { double x; double y; double z; x = m00 * t.x + m01 * t.y + m02 * t.z; y = m10 * t.x + m11 * t.y + m12 * t.z; result.z = m20 * t.x + m21 * t.y + m22 * t.z; result.x = x; result.y = y; }
/// <summary>Constructs and initializes a Color3f from the specified Tuple3d.</summary> /// <remarks>Constructs and initializes a Color3f from the specified Tuple3d.</remarks> /// <param name="t1">the Tuple3d containing the initialization x y z data</param> public Color3f(Tuple3d t1) : base(t1) { }
/// <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(Tuple3d t1, Tuple3d t2) { this.x = t1.x - t2.x; this.y = t1.y - t2.y; this.z = t1.z - t2.z; }
/// <summary>Constructs and initializes a Vector3f from the specified Tuple3d.</summary> /// <remarks>Constructs and initializes a Vector3f from the specified Tuple3d.</remarks> /// <param name="t1">the Tuple3d containing the initialization x y z data</param> public Vector3f(Tuple3d t1) : base(t1) { }
public void ClampMin(float min, Tuple3d t) { ClampMin((double)min, t); }
/// <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(double min, Tuple3d 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; } }
public void ClampMax(float max, Tuple3d t) { ClampMax((double)max, t); }
/// <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(double max, Tuple3d 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; } }
/// <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(double min, double max, Tuple3d 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; } } }
public void Clamp(float min, float max, Tuple3d t) { Clamp((double)min, (double)max, t); }
/// <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(Tuple3d t1) { this.x += t1.x; this.y += t1.y; this.z += t1.z; }
/// <summary>Constructs and initializes a Tuple3d from the specified Tuple3d.</summary> /// <remarks>Constructs and initializes a Tuple3d from the specified Tuple3d.</remarks> /// <param name="t1">the Tuple3d containing the initialization x y z data</param> public Tuple3d(Tuple3d t1) { this.x = t1.x; this.y = t1.y; this.z = t1.z; }
/// <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)]. /// </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(Tuple3d t1, double epsilon) { double diff; diff = x - t1.x; if (double.IsNaN(diff)) { return false; } if ((diff < 0 ? -diff : diff) > epsilon) { return false; } diff = y - t1.y; if (double.IsNaN(diff)) { return false; } if ((diff < 0 ? -diff : diff) > epsilon) { return false; } diff = z - t1.z; if (double.IsNaN(diff)) { return false; } if ((diff < 0 ? -diff : diff) > epsilon) { return false; } return true; }
/// <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(double s, Tuple3d t1) { this.x = s * this.x + t1.x; this.y = s * this.y + t1.y; this.z = s * this.z + t1.z; }
/// <summary> /// Returns true if all of the data members of Tuple3d t1 are /// equal to the corresponding data members in this Tuple3d. /// </summary> /// <remarks> /// Returns true if all of the data members of Tuple3d t1 are /// equal to the corresponding data members in this Tuple3d. /// </remarks> /// <param name="t1">the tuple with which the comparison is made</param> /// <returns>true or false</returns> public virtual bool Equals(Tuple3d t1) { try { return (this.x == t1.x && this.y == t1.y && this.z == t1.z); } catch (ArgumentNullException) { return false; } }
/// <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(Tuple3d t1) { this.x -= t1.x; this.y -= t1.y; this.z -= t1.z; }
/// <summary>Copies the x,y,z coordinates of this tuple into the tuple t.</summary> /// <remarks>Copies the x,y,z coordinates of this tuple into the tuple t.</remarks> /// <param name="t">the Tuple3d object into which the values of this object are copied /// </param> public void Get(Tuple3d t) { t.x = this.x; t.y = this.y; t.z = this.z; }
/// <summary> /// Multiply this matrix by the tuple t and place the result /// back into the tuple (t = this*t). /// </summary> /// <remarks> /// Multiply this matrix by the tuple t and place the result /// back into the tuple (t = this*t). /// </remarks> /// <param name="t">the tuple to be multiplied by this matrix and then replaced</param> public void Transform(Tuple3d t) { double x; double y; double z; x = m00 * t.x + m01 * t.y + m02 * t.z; y = m10 * t.x + m11 * t.y + m12 * t.z; z = m20 * t.x + m21 * t.y + m22 * t.z; t.Set(x, y, z); }
public void Interpolate(Tuple3d t1, float alpha) { Interpolate(t1, (double)alpha); }
/// <summary>Constructs and initializes a Point3f from the specified Tuple3d.</summary> /// <remarks>Constructs and initializes a Point3f from the specified Tuple3d.</remarks> /// <param name="t1">the Tuple3d containing the initialization x y z data</param> public Point3f(Tuple3d t1) : base(t1) { }
/// <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 void Interpolate(Tuple3d t1, double 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; }
/// <summary>Constructs and initializes a Vector4d from the specified Tuple3d.</summary> /// <remarks> /// Constructs and initializes a Vector4d from the specified Tuple3d. /// The x,y,z components of this vector are set to the corresponding /// components of tuple t1. The w component of this vector /// is set to 0. /// </remarks> /// <param name="t1">the tuple to be copied</param> /// <since>vecmath 1.2</since> public Vector4d(Tuple3d t1) : base(t1.x, t1.y, t1.z, 0.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(Tuple3d t1) { this.x = -t1.x; this.y = -t1.y; this.z = -t1.z; }
/// <summary>Constructs and initializes a Point4d from the specified Tuple3d.</summary> /// <remarks> /// Constructs and initializes a Point4d from the specified Tuple3d. /// The x,y,z components of this point are set to the corresponding /// components of tuple t1. The w component of this point /// is set to 1. /// </remarks> /// <param name="t1">the tuple to be copied</param> /// <since>vecmath 1.2</since> public Point4d(Tuple3d t1) : base(t1.x, t1.y, t1.z, 1.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(Tuple3d t) { x = Math.Abs(t.x); y = Math.Abs(t.y); z = Math.Abs(t.z); }