Struct FRGB
- Namespace
- RenderSharp
- Assembly
- RenderSharp.dll
A MathSharp.IVec3<TSelf, TBase, TFloat, TVFloat> of type double. Values R, G and B. all intended to lie within the range [0, 1].
public struct FRGB : IVec3<FRGB, double, double, FRGB>, IEquatable<FRGB>, ISwizzlable<FRGB, double>
- Implements
- Inherited Members
Constructors
FRGB(double, double, double)
Constructs a new color from the given r, g and b components.
public FRGB(double r, double g, double b)
Parameters
r
doubleThe red component of the new color. Intended [0, 1].
g
doubleThe green component of the new color. Intended [0, 1].
b
doubleThe blue component of the new color. Intended [0, 1].
Properties
B
Blue channel. Intended to range [0, 1].
public double B { get; set; }
Property Value
Components
A new array representing the components of the vector.
public double[] Components { get; }
Property Value
- double[]
G
Green channel. Intended to range [0, 1].
public double G { 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
i
int
Property Value
this[string]
Used to perform a swizzle. i.e. vec3["yz"] = vec3["xz"];
public double[] this[string swizzle] { get; set; }
Parameters
swizzle
string
Property Value
- double[]
R
Red channel. Intended to range [0, 1].
public double R { 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
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 FRGB)
Computes the cross product between two vectors. (https://en.wikipedia.org/wiki/Cross_product).
public FRGB Cross(in FRGB other)
Parameters
other
FRGB
Returns
Dot(in FRGB)
Computes the dot product between two vectors (https://en.wikipedia.org/wiki/Dot_product).
public double Dot(in FRGB other)
Parameters
other
FRGB
Returns
Equals(FRGB)
Computes whether two vectors are equal.
public bool Equals(FRGB other)
Parameters
other
FRGB
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 FRGB Norm()
Returns
Norm(out double)
Computes the normalized vector.
public FRGB Norm(out double mag)
Parameters
mag
double
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 FRGB Rotate(in RVec3 angle)
Parameters
angle
RVec3
Returns
- FRGB
A new floating point vector with the result of the rotation.
ToFRGBA()
Returns the color expressed in FRGBA space.
public FRGBA ToFRGBA()
Returns
- FRGBA
A new color with the same values, and an additional alpha 1.
ToHSV()
Returns the color expressed in HSV space.
public HSV ToHSV()
Returns
- HSV
A new color with hue [0, 360], saturation and value [0, 1].
ToHSVA()
Returns the color expressed in HSVA space.
public HSVA ToHSVA()
Returns
- HSVA
A new color with hue [0, 360], saturation and value [0, 1], and an additional alpha 1.
ToRGB()
Returns the color expressed in RGB space.
public RGB ToRGB()
Returns
- RGB
A new color with values scaled by 255.
ToRGBA()
Returns the color expressed in RGBA space.
public RGBA ToRGBA()
Returns
- RGBA
A new color with values scaled by 255, and an additional alpha 255.
ToString()
Gets the string representation of the vector.
public override string ToString()
Returns
Operators
operator +(in FRGB, in FRGB)
Computes the sum of two vectors.
public static FRGB operator +(in FRGB lhs, in FRGB rhs)
Parameters
Returns
operator /(in FRGB, in FRGB)
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 FRGB operator /(in FRGB lhs, in FRGB rhs)
Parameters
Returns
operator /(in FRGB, double)
Computes the division of a vector by a scalar.
public static FRGB operator /(in FRGB lhs, double scalar)
Parameters
Returns
implicit operator FRGBA(in FRGB)
Returns the color expressed in FRGBA space.
public static implicit operator FRGBA(in FRGB rgbf)
Parameters
rgbf
FRGB
Returns
- FRGBA
A new color with the same values, and an additional alpha 1.
implicit operator HSV(in FRGB)
Returns the color expressed in HSV space.
public static implicit operator HSV(in FRGB rgbf)
Parameters
rgbf
FRGB
Returns
- HSV
A new color with hue [0, 360], saturation and value [0, 1].
implicit operator HSVA(in FRGB)
Returns the color expressed in HSVA space.
public static implicit operator HSVA(in FRGB rgbf)
Parameters
rgbf
FRGB
Returns
- HSVA
A new color with hue [0, 360], saturation and value [0, 1], and an additional alpha 1.
implicit operator RGB(in FRGB)
Returns the color expressed in RGB space.
public static implicit operator RGB(in FRGB rgbf)
Parameters
rgbf
FRGB
Returns
- RGB
A new color with values scaled by 255.
implicit operator RGBA(in FRGB)
Returns the color expressed in RGBA space.
public static implicit operator RGBA(in FRGB rgbf)
Parameters
rgbf
FRGB
Returns
- RGBA
A new color with values scaled by 255, and an additional alpha 255.
implicit operator double[](in FRGB)
For implicitly converting the implementing type to a swizzle. i.e. Vec2 v["yx"] = other2;
public static implicit operator double[](in FRGB self)
Parameters
self
FRGB
Returns
- double[]
implicit operator FRGB(double[])
For implicitly converting a swizzle to the implementing type. i.e. Vec2 v = vec3["yz"];
public static implicit operator FRGB(double[] swizzle)
Parameters
swizzle
double[]
Returns
operator *(in FRGB, in FRGB)
Computes the Hadamard product of two vectors, also known as the component-wise product (https://en.wikipedia.org/wiki/Hadamard_product_(matrices)).
public static FRGB operator *(in FRGB lhs, in FRGB rhs)
Parameters
Returns
operator *(in FRGB, double)
Computes the product of a vector and a scalar.
public static FRGB operator *(in FRGB lhs, double scalar)
Parameters
Returns
operator -(in FRGB, in FRGB)
Computes the difference of two vectors.
public static FRGB operator -(in FRGB lhs, in FRGB rhs)