Struct Half3
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Represents a three dimensional mathematical vector with half-precision floats.
[DataContract]
public struct Half3 : IEquatable<Half3>
- Implements
Constructors
Half3(Half)
Initializes a new instance of the Half3 structure.
public Half3(Half value)
Parameters
value
HalfThe value to set for the X, Y, and Z components.
Half3(Half, Half, Half)
Initializes a new instance of the Half3 structure.
public Half3(Half x, Half y, Half z)
Parameters
Half3(Half[])
Initializes a new instance of the Half3 struct.
public Half3(Half[] values)
Parameters
values
Half[]The values to assign to the X, Y, and Z components of the vector. This must be an array with three elements.
Exceptions
- ArgumentNullException
Thrown when
values
isnull
.- ArgumentOutOfRangeException
Thrown when
values
contains more or less than three elements.
Half3(float)
Initializes a new instance of the Half3 structure.
public Half3(float value)
Parameters
value
floatThe value to set for the X, Y, and Z components.
Half3(float, float, float)
Initializes a new instance of the Half3 structure.
public Half3(float x, float y, float z)
Parameters
Fields
One
A Half3 with all of its components set to one.
public static readonly Half3 One
Field Value
SizeInBytes
The size of the Half3 type, in bytes.
public static readonly int SizeInBytes
Field Value
UnitX
The X unit Half3 (1, 0, 0).
public static readonly Half3 UnitX
Field Value
UnitY
The Y unit Half3 (0, 1, 0).
public static readonly Half3 UnitY
Field Value
UnitZ
The Z unit Half3 (0, 0, 1).
public static readonly Half3 UnitZ
Field Value
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 Half3 with all of its components set to zero.
public static readonly Half3 Zero
Field Value
Methods
Deconstruct(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)
Parameters
Equals(Half3)
Returns a value that indicates whether the current instance is equal to the specified object.
public bool Equals(Half3 other)
Parameters
other
Half3Object to make the comparison with.
Returns
- bool
true
if the current instance is equal to the specified object;false
otherwise.
Equals(ref readonly Half3, ref readonly Half3)
Determines whether the specified object instances are considered equal.
public static bool Equals(ref readonly Half3 value1, ref readonly Half3 value2)
Parameters
Returns
- bool
true
ifvalue1
is the same instance asvalue2
or if both arenull
references 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
obj
objectObject to make the comparison with.
Returns
- bool
true
if the current instance is equal to the specified object;false
otherwise.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
Operators
operator ==(Half3, Half3)
Tests for equality between two objects.
public static bool operator ==(Half3 left, Half3 right)
Parameters
Returns
- bool
true
ifleft
has the same value asright
; otherwise,false
.
explicit operator Vector3(Half3)
public static explicit operator Vector3(Half3 value)
Parameters
value
Half3The value.
Returns
- Vector3
The result of the conversion.
explicit operator Half3(Vector3)
public static explicit operator Half3(Vector3 value)
Parameters
value
Vector3The value.
Returns
- Half3
The result of the conversion.
operator !=(Half3, Half3)
Tests for inequality between two objects.
public static bool operator !=(Half3 left, Half3 right)
Parameters
Returns
- bool
true
ifleft
has a different value thanright
; otherwise,false
.