/// <summary>Constructs and initializes a Tuple4i from the specified Tuple4i.</summary> /// <remarks>Constructs and initializes a Tuple4i from the specified Tuple4i.</remarks> /// <param name="t1"> /// the Tuple4i containing the initialization x, y, z, /// and w data. /// </param> public Tuple4i(Tuple4i t1) { this.x = t1.x; this.y = t1.y; this.z = t1.z; this.w = t1.w; }
/// <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(Tuple4i t1, Tuple4i 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; }
/// <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(Tuple4i t1) { this.x -= t1.x; this.y -= t1.y; this.z -= t1.z; this.w -= t1.w; }
/// <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(int s, Tuple4i 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; }
/// <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(Tuple4i t1) { this.x = t1.x; this.y = t1.y; this.z = t1.z; this.w = t1.w; }
/// <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(Tuple4i t1) { this.x = -t1.x; this.y = -t1.y; this.z = -t1.z; this.w = -t1.w; }
/// <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(int s, Tuple4i t1) { this.x = s * t1.x; this.y = s * t1.y; this.z = s * t1.z; this.w = s * t1.w; }
/// <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(int min, Tuple4i 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; } }
/// <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(Tuple4i t) { t.x = this.x; t.y = this.y; t.z = this.z; t.w = this.w; }
/// <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(int max, Tuple4i 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; } }
/// <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(int min, int max, Tuple4i 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; } } }
/// <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(Tuple4i t1) { this.x += t1.x; this.y += t1.y; this.z += t1.z; this.w += t1.w; }
/// <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(Tuple4i t1, Tuple4i 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; }
/// <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(Tuple4i t) { x = Math.Abs(t.x); y = Math.Abs(t.y); z = Math.Abs(t.z); w = Math.Abs(t.w); }