Half2 Struct
Namespace: Stride.Core.MathematicsAssembly: Stride.Core.Mathematics.dll
Represents a two dimensional mathematical vector with half-precision floats.
[DataContract]
public struct Half2 : IEquatable<Half2>
Name | Description | |
---|---|---|
Constructors | ||
Half2(Half) | Initializes a new instance of the Half2 structure. |
|
Half2(Half, Half) | Initializes a new instance of the Half2 structure. |
|
Half2(Half[]) | Initializes a new instance of the Half2 struct. |
|
Half2(Single) | Initializes a new instance of the Half2 structure. |
|
Half2(Single, Single) | Initializes a new instance of the Half2 structure. |
|
Fields | ||
One | A Half2 with all of its components set to one. |
|
SizeInBytes | The size of the Half2 type, in bytes. |
|
UnitX | The X unit Half2 (1, 0). |
|
UnitY | The Y unit Half2 (0, 1). |
|
X | Gets or sets the X component of the vector. |
|
Y | Gets or sets the Y component of the vector. |
|
Zero | A Half2 with all of its components set to zero. |
|
Methods | ||
Equals(Half2) | Returns a value that indicates whether the current instance is equal to the specified object. |
|
Equals(ref Half2, ref Half2) | Determines whether the specified object instances are considered equal. |
|
Equals(Object) | Returns a value that indicates whether the current instance is equal to a specified object. |
|
GetHashCode() | Returns the hash code for this instance. |
|
Operators | ||
Equality(Half2, Half2) | Tests for equality between two objects. |
|
Explicit(Half2 to Vector2) | ||
Explicit(Vector2 to Half2) | ||
Inequality(Half2, Half2) | Tests for inequality between two objects. |
Constructors
Half2(Half)
Initializes a new instance of the Half2 structure.
public Half2(Half value)
Parameters
Type | Name | Description |
---|---|---|
Half | value | The value to set for both the X and Y components. |
Half2(Half, Half)
Initializes a new instance of the Half2 structure.
public Half2(Half x, Half y)
Parameters
Type | Name | Description |
---|---|---|
Half | x | The X component. |
Half | y | The Y component. |
Half2(Half[])
Initializes a new instance of the Half2 struct.
public Half2(Half[] values)
Parameters
Type | Name | Description |
---|---|---|
Half[] | values | The values to assign to the X and Y components of the vector. This must be an array with two elements. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentOutOfRangeException | Thrown when |
Half2(Single)
Initializes a new instance of the Half2 structure.
public Half2(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | The value to set for both the X and Y components. |
Half2(Single, Single)
Initializes a new instance of the Half2 structure.
public Half2(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The X component. |
System.Single | y | The Y component. |
Fields
One
A Half2 with all of its components set to one.
public static readonly Half2 One
Field Value
Type | Description |
---|---|
Half2 |
SizeInBytes
The size of the Half2 type, in bytes.
public static readonly int SizeInBytes
Field Value
Type | Description |
---|---|
System.Int32 |
UnitX
The X unit Half2 (1, 0).
public static readonly Half2 UnitX
Field Value
Type | Description |
---|---|
Half2 |
UnitY
The Y unit Half2 (0, 1).
public static readonly Half2 UnitY
Field Value
Type | Description |
---|---|
Half2 |
X
Gets or sets the X component of the vector.
public Half X
Field Value
Type | Description |
---|---|
Half | The X component of the vector. |
Y
Gets or sets the Y component of the vector.
public Half Y
Field Value
Type | Description |
---|---|
Half | The Y component of the vector. |
Zero
A Half2 with all of its components set to zero.
public static readonly Half2 Zero
Field Value
Type | Description |
---|---|
Half2 |
Methods
Equals(Half2)
Returns a value that indicates whether the current instance is equal to the specified object.
public bool Equals(Half2 other)
Parameters
Type | Name | Description |
---|---|---|
Half2 | other | Object to make the comparison with. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(ref Half2, ref Half2)
Determines whether the specified object instances are considered equal.
public static bool Equals(ref Half2 value1, ref Half2 value2)
Parameters
Type | Name | Description |
---|---|---|
Half2 | value1 | The first value. |
Half2 | value2 | The second value. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Returns a value that indicates whether the current instance is equal to a specified object.
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to make the comparison with. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer hash code. |
Overrides
Operators
Equality(Half2, Half2)
Tests for equality between two objects.
public static bool operator ==(Half2 left, Half2 right)
Parameters
Type | Name | Description |
---|---|---|
Half2 | left | The first value to compare. |
Half2 | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Explicit(Half2 to Vector2)
public static explicit operator Vector2(Half2 value)
Parameters
Type | Name | Description |
---|---|---|
Half2 | value | The value. |
Returns
Type | Description |
---|---|
Vector2 | The result of the conversion. |
Explicit(Vector2 to Half2)
public static explicit operator Half2(Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | The value. |
Returns
Type | Description |
---|---|
Half2 | The result of the conversion. |
Inequality(Half2, Half2)
Tests for inequality between two objects.
public static bool operator !=(Half2 left, Half2 right)
Parameters
Type | Name | Description |
---|---|---|
Half2 | left | The first value to compare. |
Half2 | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|