Struct Half4
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Represents a four dimensional mathematical vector with half-precision floats.
[DataContract]
public struct Half4 : IEquatable<Half4>
- Implements
- Inherited Members
Constructors
Half4(Half)
Initializes a new instance of the Half4 structure.
public Half4(Half value)
Parameters
valueHalfThe value to set for the X, Y, Z, and W components.
Half4(Half, Half, Half, Half)
Initializes a new instance of the Half4 structure.
public Half4(Half x, Half y, Half z, Half w)
Parameters
Half4(Half[])
Initializes a new instance of the Half4 struct.
public Half4(Half[] values)
Parameters
valuesHalf[]The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements.
Exceptions
- ArgumentNullException
Thrown when
valuesisnull.- ArgumentOutOfRangeException
Thrown when
valuescontains more or less than four elements.
Half4(float)
Initializes a new instance of the Half4 structure.
public Half4(float value)
Parameters
valuefloatThe value to set for the X, Y, Z, and W components.
Half4(float, float, float, float)
Initializes a new instance of the Half4 structure.
public Half4(float x, float y, float z, float w)
Parameters
Fields
One
A Half4 with all of its components set to one.
public static readonly Half4 One
Field Value
SizeInBytes
The size of the Half4 type, in bytes.
public static readonly int SizeInBytes
Field Value
UnitW
The W unit Half4 (0, 0, 0, 1).
public static readonly Half4 UnitW
Field Value
UnitX
The X unit Half4 (1, 0, 0, 0).
public static readonly Half4 UnitX
Field Value
UnitY
The Y unit Half4 (0, 1, 0, 0).
public static readonly Half4 UnitY
Field Value
UnitZ
The Z unit Half4 (0, 0, 1, 0).
public static readonly Half4 UnitZ
Field Value
W
Gets or sets the W component of the vector.
public Half W
Field Value
- Half
The W component of the vector.
X
Gets or sets the X component of the vector.
public Half X
Field Value
- Half
The X component of the vector.
Y
Gets or sets the Y component of the vector.
public Half Y
Field Value
- Half
The Y component of the vector.
Z
Gets or sets the Z component of the vector.
public Half Z
Field Value
- Half
The Z component of the vector.
Zero
A Half4 with all of its components set to zero.
public static readonly Half4 Zero
Field Value
Methods
Deconstruct(out Half, out Half, out Half, out Half)
Deconstructs the vector's components into named variables.
public void Deconstruct(out Half x, out Half y, out Half z, out Half w)
Parameters
Equals(Half4)
Returns a value that indicates whether the current instance is equal to the specified object.
public bool Equals(Half4 other)
Parameters
otherHalf4Object to make the comparison with.
Returns
- bool
trueif the current instance is equal to the specified object;falseotherwise.
Equals(ref Half4, ref Half4)
Determines whether the specified object instances are considered equal.
public static bool Equals(ref Half4 value1, ref Half4 value2)
Parameters
Returns
- bool
trueifvalue1is the same instance asvalue2or if both arenullreferences or ifvalue1.Equals(value2)returnstrue; otherwise,false.
Equals(object)
Returns a value that indicates whether the current instance is equal to a specified object.
public override bool Equals(object obj)
Parameters
objobjectObject to make the comparison with.
Returns
- bool
trueif the current instance is equal to the specified object;falseotherwise.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
Operators
operator ==(Half4, Half4)
Tests for equality between two objects.
public static bool operator ==(Half4 left, Half4 right)
Parameters
Returns
- bool
trueiflefthas the same value asright; otherwise,false.
explicit operator Vector4(Half4)
public static explicit operator Vector4(Half4 value)
Parameters
valueHalf4The value.
Returns
- Vector4
The result of the conversion.
explicit operator Half4(Vector4)
public static explicit operator Half4(Vector4 value)
Parameters
valueVector4The value.
Returns
- Half4
The result of the conversion.
operator !=(Half4, Half4)
Tests for inequality between two objects.
public static bool operator !=(Half4 left, Half4 right)
Parameters
Returns
- bool
trueiflefthas a different value thanright; otherwise,false.