Struct HSV
- Namespace
- RenderSharp
- Assembly
- RenderSharp.dll
A MathSharp.IVec3<TSelf, TBase, TFloat, TVFloat> of type double. Values H intended to lie within the range [0, 360] and S and V intended to lie within the range [0, 1].
public struct HSV : IVec3<HSV, double, double, HSV>, IEquatable<HSV>, ISwizzlable<HSV, double>
- Implements
- Inherited Members
Constructors
HSV(double, double, double)
Constructs a new color from the given hue, saturation and value.
public HSV(double h, double s, double v)
Parameters
hdoubleThe hue channel of the new color. Intended [0, 360].
sdoubleThe saturation channel of the new color. Intended [0, 1].
vdoubleThe value channel of the new color. Intended [0, 1].
Properties
Components
A new array representing the components of the vector.
public double[] Components { get; }
Property Value
- double[]
H
Hue channel. Intended to range [0, 360].
public double H { get; set; }
Property Value
this[int]
Indexer for the vector. 0 is the x component and so on.
public double this[int i] { get; set; }
Parameters
iint
Property Value
this[string]
Used to perform a swizzle. i.e. vec3["yz"] = vec3["xz"];
public double[] this[string swizzle] { get; set; }
Parameters
swizzlestring
Property Value
- double[]
S
Saturation channel. Intended to range [0, 1].
public double S { get; set; }
Property Value
SwizzleMap
Mapping of swizzle characters to their index in the implementing type. i.e. SwizzleMap['x'] = 0, SwizzleMap['y'] = 1, etc.
public static Dictionary<char, int> SwizzleMap { get; }
Property Value
V
Value channel. Intended to range [0, 1].
public double V { get; set; }
Property Value
X
The x component of the vector.
public double X { readonly get; set; }
Property Value
Y
The y component of the vector.
public double Y { readonly get; set; }
Property Value
Z
The z component of the vector.
public double Z { readonly get; set; }
Property Value
Methods
Cross(in HSV)
Computes the cross product between two vectors. (https://en.wikipedia.org/wiki/Cross_product).
public HSV Cross(in HSV rhs)
Parameters
rhsHSV
Returns
Dot(in HSV)
Computes the dot product between two vectors (https://en.wikipedia.org/wiki/Dot_product).
public double Dot(in HSV other)
Parameters
otherHSV
Returns
Equals(HSV)
Computes whether two vectors are equal.
public bool Equals(HSV other)
Parameters
otherHSV
Returns
Mag()
Computes the magnitude of the vector.
public double Mag()
Returns
Mag2()
Computes the squared magnitude of the vector.
public double Mag2()
Returns
Norm()
Computes the normalized vector.
public HSV Norm()
Returns
Norm(out double)
Computes the normalized vector.
public HSV Norm(out double mag)
Parameters
magdouble
Returns
Rotate(in RVec3)
Computes the rotated vector by the given angle vector using Euler rotation https://en.wikipedia.org/wiki/Rotation_matrix#General_3D_rotations.
public HSV Rotate(in RVec3 angle)
Parameters
angleRVec3
Returns
- HSV
A new floating point vector with the result of the rotation.
ToFRGB()
Returns the color expressed in FRGB space.
public FRGB ToFRGB()
Returns
- FRGB
A new color with red, green and blue [0, 1].
ToFRGBA()
Returns the color expressed in FRGBA space.
public FRGBA ToFRGBA()
Returns
- FRGBA
A new color with red, green and blue [0, 1], and an addition alpha 1.
ToHSVA()
Returns the color expressed in HSVA space.
public HSVA ToHSVA()
Returns
- HSVA
A new color with the same values, and an addition alpha 1.
ToRGB()
Returns the color expressed in RGB space.
public RGB ToRGB()
Returns
- RGB
A new color with red, green and blue [0, 255].
ToRGBA()
Returns the color expressed in RGBA space.
public RGBA ToRGBA()
Returns
- RGBA
A new color with red, green and blue [0, 255], and an additional alpha 255.
ToString()
Gets the string representation of the vector.
public override string ToString()
Returns
Operators
operator +(in HSV, in HSV)
Computes the sum of two vectors.
public static HSV operator +(in HSV lhs, in HSV rhs)
Parameters
Returns
operator /(in HSV, in HSV)
Computes the Hadamar inverse product (division) of two vectors, also known as the component-wise inverse product (https://en.wikipedia.org/wiki/Hadamard_product_(matrices)).
public static HSV operator /(in HSV lhs, in HSV rhs)
Parameters
Returns
operator /(in HSV, double)
Computes the division of a vector by a scalar.
public static HSV operator /(in HSV lhs, double scalar)
Parameters
Returns
implicit operator FRGB(in HSV)
Returns the color expressed in FRGB space.
public static implicit operator FRGB(in HSV hsv)
Parameters
hsvHSV
Returns
- FRGB
A new color with red, green and blue [0, 1].
implicit operator FRGBA(in HSV)
Returns the color expressed in FRGBA space.
public static implicit operator FRGBA(in HSV hsv)
Parameters
hsvHSV
Returns
- FRGBA
A new color with red, green and blue [0, 1], and an addition alpha 1.
implicit operator HSVA(in HSV)
Returns the color expressed in HSVA space.
public static implicit operator HSVA(in HSV hsv)
Parameters
hsvHSV
Returns
- HSVA
A new color with the same values, and an addition alpha 1.
implicit operator RGB(in HSV)
Returns the color expressed in RGB space.
public static implicit operator RGB(in HSV hsv)
Parameters
hsvHSV
Returns
- RGB
A new color with red, green and blue [0, 255].
implicit operator RGBA(in HSV)
Returns the color expressed in RGBA space.
public static implicit operator RGBA(in HSV hsv)
Parameters
hsvHSV
Returns
- RGBA
A new color with red, green and blue [0, 255], and an additional alpha 255.
implicit operator double[](in HSV)
For implicitly converting the implementing type to a swizzle. i.e. Vec2 v["yx"] = other2;
public static implicit operator double[](in HSV swizzler)
Parameters
swizzlerHSV
Returns
- double[]
implicit operator HSV(double[])
For implicitly converting a swizzle to the implementing type. i.e. Vec2 v = vec3["yz"];
public static implicit operator HSV(double[] swizzle)
Parameters
swizzledouble[]
Returns
operator *(in HSV, in HSV)
Computes the Hadamard product of two vectors, also known as the component-wise product (https://en.wikipedia.org/wiki/Hadamard_product_(matrices)).
public static HSV operator *(in HSV lhs, in HSV rhs)
Parameters
Returns
operator *(in HSV, double)
Computes the product of a vector and a scalar.
public static HSV operator *(in HSV lhs, double scalar)
Parameters
Returns
operator -(in HSV, in HSV)
Computes the difference of two vectors.
public static HSV operator -(in HSV lhs, in HSV rhs)