Table of Contents

Struct HSVA

Namespace
RenderSharp
Assembly
RenderSharp.dll

A MathSharp.IVec4<TSelf, TBase, TFloat, TVFloat> of type double. Values H intended to lie within the range [0, 360] and S, V and A intended to lie within the range [0, 1].

public struct HSVA : IVec4<HSVA, double, double, HSVA>, IEquatable<HSVA>, ISwizzlable<HSVA, double>
Implements
ISwizzlable<HSVA, double>
Inherited Members

Constructors

HSVA(in HSV, double)

Constructs a new color from the given color and alpha channel.

public HSVA(in HSV hsv, double a)

Parameters

hsv HSV

The hue, saturation and value channels of the new color.

a double

The alpha channel of the new color. Intended [0, 1].

HSVA(double, double, double, double)

Constructs a new color from the given hue, saturation, value and alpha channels.

public HSVA(double h, double s, double v, double a)

Parameters

h double

The hue channel of the new color. Intended [0, 1].

s double

The saturation channel of the new color. Intended [0, 1].

v double

The value channel of the new color. Intended [0, 1].

a double

The alpha channel of the new color. Intended [0, 1].

Properties

A

Alpha channel. Intended to range [0, 1].

public double A { get; set; }

Property Value

double

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

double

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

double

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[]

S

Saturation channel. Intended to range [0, 1].

public double S { get; set; }

Property Value

double

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

Dictionary<char, int>

V

Value channel. Intended to range [0, 1].

public double V { get; set; }

Property Value

double

W

The w component of the vector.

public double W { readonly get; set; }

Property Value

double

X

The x component of the vector.

public double X { readonly get; set; }

Property Value

double

Y

The y component of the vector.

public double Y { readonly get; set; }

Property Value

double

Z

The z component of the vector.

public double Z { readonly get; set; }

Property Value

double

Methods

Dot(in HSVA)

Computes the dot product between two vectors (https://en.wikipedia.org/wiki/Dot_product).

public double Dot(in HSVA other)

Parameters

other HSVA

Returns

double

Equals(HSVA)

Computes whether two vectors are equal.

public bool Equals(HSVA other)

Parameters

other HSVA

Returns

bool

Mag()

Computes the magnitude of the vector.

public double Mag()

Returns

double

Mag2()

Computes the squared magnitude of the vector.

public double Mag2()

Returns

double

Norm()

Computes the normalized vector.

public HSVA Norm()

Returns

HSVA

Norm(out double)

Computes the normalized vector.

public HSVA Norm(out double mag)

Parameters

mag double

Returns

HSVA

ToFRGB()

Returns the color expressed in FRGB space.

public FRGB ToFRGB()

Returns

FRGB

A new color with red, green and blue [0, 1], and alpha truncated.

ToFRGBA()

Returns the color expressed in FRGBA space.

public FRGBA ToFRGBA()

Returns

FRGBA

A new color with red, green, blue and alpha [0, 1].

ToHSV()

Returns the color expressed in HSV space.

public HSV ToHSV()

Returns

HSV

A new color with the same channels, but alpha truncated.

ToRGB()

Returns the color expressed in RGB space.

public RGB ToRGB()

Returns

RGB

A new color with red, green and blue [0, 255], and alpha truncated.

ToRGBA()

Returns the color expressed in RGBA space.

public RGBA ToRGBA()

Returns

RGBA

A new color with red, green, blue and alpha [0, 255].

ToString()

Gets the string representation of the vector.

public override string ToString()

Returns

string

Operators

operator +(in HSVA, in HSVA)

Computes the sum of two vectors.

public static HSVA operator +(in HSVA lhs, in HSVA rhs)

Parameters

lhs HSVA
rhs HSVA

Returns

HSVA

operator /(in HSVA, in HSVA)

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 HSVA operator /(in HSVA lhs, in HSVA rhs)

Parameters

lhs HSVA
rhs HSVA

Returns

HSVA

operator /(in HSVA, double)

Computes the division of a vector by a scalar.

public static HSVA operator /(in HSVA lhs, double scalar)

Parameters

lhs HSVA
scalar double

Returns

HSVA

explicit operator FRGB(in HSVA)

Returns the color expressed in FRGB space.

public static explicit operator FRGB(in HSVA hsva)

Parameters

hsva HSVA

Returns

FRGB

A new color with red, green and blue [0, 1], and alpha truncated.

explicit operator HSV(in HSVA)

Returns the color expressed in HSV space.

public static explicit operator HSV(in HSVA hsva)

Parameters

hsva HSVA

Returns

HSV

A new color with the same channels, but alpha truncated.

explicit operator RGB(in HSVA)

Returns the color expressed in RGB space.

public static explicit operator RGB(in HSVA hsva)

Parameters

hsva HSVA

Returns

RGB

A new color with red, green and blue [0, 255], and alpha truncated.

implicit operator FRGBA(in HSVA)

Returns the color expressed in FRGBA space.

public static implicit operator FRGBA(in HSVA hsva)

Parameters

hsva HSVA

Returns

FRGBA

A new color with red, green, blue and alpha [0, 1].

implicit operator RGBA(in HSVA)

Returns the color expressed in RGBA space.

public static implicit operator RGBA(in HSVA hsva)

Parameters

hsva HSVA

Returns

RGBA

A new color with red, green, blue and alpha [0, 255].

implicit operator double[](in HSVA)

For implicitly converting the implementing type to a swizzle. i.e. Vec2 v["yx"] = other2;

public static implicit operator double[](in HSVA swizzler)

Parameters

swizzler HSVA

Returns

double[]

implicit operator HSVA(double[])

For implicitly converting a swizzle to the implementing type. i.e. Vec2 v = vec3["yz"];

public static implicit operator HSVA(double[] swizzle)

Parameters

swizzle double[]

Returns

HSVA

operator *(in HSVA, in HSVA)

Computes the Hadamard product of two vectors, also known as the component-wise product (https://en.wikipedia.org/wiki/Hadamard_product_(matrices)).

public static HSVA operator *(in HSVA lhs, in HSVA rhs)

Parameters

lhs HSVA
rhs HSVA

Returns

HSVA

operator *(in HSVA, double)

Computes the product of a vector and a scalar.

public static HSVA operator *(in HSVA lhs, double scalar)

Parameters

lhs HSVA
scalar double

Returns

HSVA

operator -(in HSVA, in HSVA)

Computes the difference of two vectors.

public static HSVA operator -(in HSVA lhs, in HSVA rhs)

Parameters

lhs HSVA
rhs HSVA

Returns

HSVA