UInt4 Struct
Namespace: Stride.Core.MathematicsAssembly: Stride.Core.Mathematics.dll
Represents a four dimensional mathematical vector.
[DataContract]
public struct UInt4 : IEquatable<UInt4>, IFormattable
Name | Description | |
---|---|---|
Constructors | ||
UInt4(UInt32) | Initializes a new instance of the UInt4 struct. |
|
UInt4(UInt32, UInt32, UInt32, UInt32) | Initializes a new instance of the UInt4 struct. |
|
UInt4(UInt32[]) | Initializes a new instance of the UInt4 struct. |
|
Fields | ||
One | A UInt4 with all of its components set to one. |
|
SizeInBytes | The size of the UInt4 type, in bytes. |
|
UnitW | The W unit UInt4 (0, 0, 0, 1). |
|
UnitX | The X unit UInt4 (1, 0, 0, 0). |
|
UnitY | The Y unit UInt4 (0, 1, 0, 0). |
|
UnitZ | The Z unit UInt4 (0, 0, 1, 0). |
|
W | The W component of the vector. |
|
X | The X component of the vector. |
|
Y | The Y component of the vector. |
|
Z | The Z component of the vector. |
|
Zero | A UInt4 with all of its components set to zero. |
|
Properties | ||
Item[UInt32] | Gets or sets the component at the specified index. |
|
Methods | ||
Add(UInt4, UInt4) | Adds two vectors. |
|
Add(ref UInt4, ref UInt4, out UInt4) | Adds two vectors. |
|
Clamp(UInt4, UInt4, UInt4) | Restricts a value to be within a specified range. |
|
Clamp(ref UInt4, ref UInt4, ref UInt4, out UInt4) | Restricts a value to be within a specified range. |
|
Divide(UInt4, UInt32) | Scales a vector by the given value. |
|
Divide(ref UInt4, UInt32, out UInt4) | Scales a vector by the given value. |
|
Equals(UInt4) | Determines whether the specified UInt4 is equal to this instance. |
|
Equals(Object) | Determines whether the specified System.Object is equal to this instance. |
|
GetHashCode() | Returns a hash code for this instance. |
|
Max(UInt4, UInt4) | Returns a vector containing the largest components of the specified vectors. |
|
Max(ref UInt4, ref UInt4, out UInt4) | Returns a vector containing the smallest components of the specified vectors. |
|
Min(UInt4, UInt4) | Returns a vector containing the smallest components of the specified vectors. |
|
Min(ref UInt4, ref UInt4, out UInt4) | Returns a vector containing the smallest components of the specified vectors. |
|
Modulate(UInt4, UInt4) | Modulates a vector with another by performing component-wise multiplication. |
|
Modulate(ref UInt4, ref UInt4, out UInt4) | Modulates a vector with another by performing component-wise multiplication. |
|
Multiply(UInt4, UInt32) | Scales a vector by the given value. |
|
Multiply(ref UInt4, UInt32, out UInt4) | Scales a vector by the given value. |
|
Subtract(UInt4, UInt4) | Subtracts two vectors. |
|
Subtract(ref UInt4, ref UInt4, out UInt4) | Subtracts two vectors. |
|
ToArray() | Creates an array containing the elements of the vector. |
|
ToString() | Returns a System.String that represents this instance. |
|
ToString(IFormatProvider) | Returns a System.String that represents this instance. |
|
ToString(String) | Returns a System.String that represents this instance. |
|
ToString(String, IFormatProvider) | Returns a System.String that represents this instance. |
|
Operators | ||
Addition(UInt4, UInt4) | Adds two vectors. |
|
Division(UInt4, UInt32) | Scales a vector by the given value. |
|
Equality(UInt4, UInt4) | Tests for equality between two objects. |
|
Explicit(UInt4 to Vector2) | ||
Explicit(UInt4 to Vector3) | ||
Explicit(UInt4 to Vector4) | ||
Implicit(UInt4 to UInt32[]) | Performs an implicit conversion from UInt4 to System.Int32 array. |
|
Implicit(UInt32[] to UInt4) | Performs an implicit conversion from System.UInt32 array to UInt4. |
|
Inequality(UInt4, UInt4) | Tests for inequality between two objects. |
|
Multiply(UInt4, UInt32) | Scales a vector by the given value. |
|
Multiply(UInt32, UInt4) | Scales a vector by the given value. |
|
Subtraction(UInt4, UInt4) | Subtracts two vectors. |
|
UnaryPlus(UInt4) | Assert a vector (return it unchanged). |
Constructors
UInt4(UInt32)
Initializes a new instance of the UInt4 struct.
public UInt4(uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | The value that will be assigned to all components. |
UInt4(UInt32, UInt32, UInt32, UInt32)
Initializes a new instance of the UInt4 struct.
public UInt4(uint x, uint y, uint z, uint w)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | x | Initial value for the X component of the vector. |
System.UInt32 | y | Initial value for the Y component of the vector. |
System.UInt32 | z | Initial value for the Z component of the vector. |
System.UInt32 | w | Initial value for the W component of the vector. |
UInt4(UInt32[])
Initializes a new instance of the UInt4 struct.
public UInt4(uint[] values)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32[] | values | The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentOutOfRangeException | Thrown when |
Fields
One
A UInt4 with all of its components set to one.
public static readonly UInt4 One
Field Value
Type | Description |
---|---|
UInt4 |
SizeInBytes
The size of the UInt4 type, in bytes.
public static readonly int SizeInBytes
Field Value
Type | Description |
---|---|
System.Int32 |
UnitW
The W unit UInt4 (0, 0, 0, 1).
public static readonly UInt4 UnitW
Field Value
Type | Description |
---|---|
UInt4 |
UnitX
The X unit UInt4 (1, 0, 0, 0).
public static readonly UInt4 UnitX
Field Value
Type | Description |
---|---|
UInt4 |
UnitY
The Y unit UInt4 (0, 1, 0, 0).
public static readonly UInt4 UnitY
Field Value
Type | Description |
---|---|
UInt4 |
UnitZ
The Z unit UInt4 (0, 0, 1, 0).
public static readonly UInt4 UnitZ
Field Value
Type | Description |
---|---|
UInt4 |
W
The W component of the vector.
public uint W
Field Value
Type | Description |
---|---|
System.UInt32 |
X
The X component of the vector.
public uint X
Field Value
Type | Description |
---|---|
System.UInt32 |
Y
The Y component of the vector.
public uint Y
Field Value
Type | Description |
---|---|
System.UInt32 |
Z
The Z component of the vector.
public uint Z
Field Value
Type | Description |
---|---|
System.UInt32 |
Zero
A UInt4 with all of its components set to zero.
public static readonly UInt4 Zero
Field Value
Type | Description |
---|---|
UInt4 |
Properties
Item[UInt32]
Gets or sets the component at the specified index.
public uint this[uint index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | index | The index of the component to access. Use 0 for the X component, 1 for the Y component, 2 for the Z component, and 3 for the W component. |
Property Value
Type | Description |
---|---|
System.UInt32 | The value of the X, Y, Z, or W component, depending on the index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
Methods
Add(UInt4, UInt4)
Adds two vectors.
public static UInt4 Add(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to add. |
UInt4 | right | The second vector to add. |
Returns
Type | Description |
---|---|
UInt4 | The sum of the two vectors. |
Add(ref UInt4, ref UInt4, out UInt4)
Adds two vectors.
public static void Add(ref UInt4 left, ref UInt4 right, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to add. |
UInt4 | right | The second vector to add. |
UInt4 | result | When the method completes, contains the sum of the two vectors. |
Clamp(UInt4, UInt4, UInt4)
Restricts a value to be within a specified range.
public static UInt4 Clamp(UInt4 value, UInt4 min, UInt4 max)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The value to clamp. |
UInt4 | min | The minimum value. |
UInt4 | max | The maximum value. |
Returns
Type | Description |
---|---|
UInt4 | The clamped value. |
Clamp(ref UInt4, ref UInt4, ref UInt4, out UInt4)
Restricts a value to be within a specified range.
public static void Clamp(ref UInt4 value, ref UInt4 min, ref UInt4 max, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The value to clamp. |
UInt4 | min | The minimum value. |
UInt4 | max | The maximum value. |
UInt4 | result | When the method completes, contains the clamped value. |
Divide(UInt4, UInt32)
Scales a vector by the given value.
public static UInt4 Divide(UInt4 value, uint scale)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to scale. |
System.UInt32 | scale | The amount by which to scale the vector. |
Returns
Type | Description |
---|---|
UInt4 | The scaled vector. |
Divide(ref UInt4, UInt32, out UInt4)
Scales a vector by the given value.
public static void Divide(ref UInt4 value, uint scale, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to scale. |
System.UInt32 | scale | The amount by which to scale the vector. |
UInt4 | result | When the method completes, contains the scaled vector. |
Equals(UInt4)
Determines whether the specified UInt4 is equal to this instance.
public bool Equals(UInt4 other)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | other | The UInt4 to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
public override bool Equals(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Max(UInt4, UInt4)
Returns a vector containing the largest components of the specified vectors.
public static UInt4 Max(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first source vector. |
UInt4 | right | The second source vector. |
Returns
Type | Description |
---|---|
UInt4 | A vector containing the largest components of the source vectors. |
Max(ref UInt4, ref UInt4, out UInt4)
Returns a vector containing the smallest components of the specified vectors.
public static void Max(ref UInt4 left, ref UInt4 right, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first source vector. |
UInt4 | right | The second source vector. |
UInt4 | result | When the method completes, contains an new vector composed of the largest components of the source vectors. |
Min(UInt4, UInt4)
Returns a vector containing the smallest components of the specified vectors.
public static UInt4 Min(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first source vector. |
UInt4 | right | The second source vector. |
Returns
Type | Description |
---|---|
UInt4 | A vector containing the smallest components of the source vectors. |
Min(ref UInt4, ref UInt4, out UInt4)
Returns a vector containing the smallest components of the specified vectors.
public static void Min(ref UInt4 left, ref UInt4 right, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first source vector. |
UInt4 | right | The second source vector. |
UInt4 | result | When the method completes, contains an new vector composed of the smallest components of the source vectors. |
Modulate(UInt4, UInt4)
Modulates a vector with another by performing component-wise multiplication.
public static UInt4 Modulate(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to modulate. |
UInt4 | right | The second vector to modulate. |
Returns
Type | Description |
---|---|
UInt4 | The modulated vector. |
Modulate(ref UInt4, ref UInt4, out UInt4)
Modulates a vector with another by performing component-wise multiplication.
public static void Modulate(ref UInt4 left, ref UInt4 right, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to modulate. |
UInt4 | right | The second vector to modulate. |
UInt4 | result | When the method completes, contains the modulated vector. |
Multiply(UInt4, UInt32)
Scales a vector by the given value.
public static UInt4 Multiply(UInt4 value, uint scale)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to scale. |
System.UInt32 | scale | The amount by which to scale the vector. |
Returns
Type | Description |
---|---|
UInt4 | The scaled vector. |
Multiply(ref UInt4, UInt32, out UInt4)
Scales a vector by the given value.
public static void Multiply(ref UInt4 value, uint scale, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to scale. |
System.UInt32 | scale | The amount by which to scale the vector. |
UInt4 | result | When the method completes, contains the scaled vector. |
Subtract(UInt4, UInt4)
Subtracts two vectors.
public static UInt4 Subtract(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to subtract. |
UInt4 | right | The second vector to subtract. |
Returns
Type | Description |
---|---|
UInt4 | The difference of the two vectors. |
Subtract(ref UInt4, ref UInt4, out UInt4)
Subtracts two vectors.
public static void Subtract(ref UInt4 left, ref UInt4 right, out UInt4 result)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to subtract. |
UInt4 | right | The second vector to subtract. |
UInt4 | result | When the method completes, contains the difference of the two vectors. |
ToArray()
Creates an array containing the elements of the vector.
public uint[] ToArray()
Returns
Type | Description |
---|---|
System.UInt32[] | A four-element array containing the components of the vector. |
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Overrides
ToString(IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
System.IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |
Operators
Addition(UInt4, UInt4)
Adds two vectors.
public static UInt4 operator +(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to add. |
UInt4 | right | The second vector to add. |
Returns
Type | Description |
---|---|
UInt4 | The sum of the two vectors. |
Division(UInt4, UInt32)
Scales a vector by the given value.
public static UInt4 operator /(UInt4 value, uint scale)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to scale. |
System.UInt32 | scale | The amount by which to scale the vector. |
Returns
Type | Description |
---|---|
UInt4 | The scaled vector. |
Equality(UInt4, UInt4)
Tests for equality between two objects.
public static bool operator ==(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first value to compare. |
UInt4 | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Explicit(UInt4 to Vector2)
public static explicit operator Vector2(UInt4 value)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The value. |
Returns
Type | Description |
---|---|
Vector2 | The result of the conversion. |
Explicit(UInt4 to Vector3)
public static explicit operator Vector3(UInt4 value)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The value. |
Returns
Type | Description |
---|---|
Vector3 | The result of the conversion. |
Explicit(UInt4 to Vector4)
public static explicit operator Vector4(UInt4 value)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The value. |
Returns
Type | Description |
---|---|
Vector4 | The result of the conversion. |
Implicit(UInt4 to UInt32[])
Performs an implicit conversion from UInt4 to System.Int32 array.
public static implicit operator uint[](UInt4 input)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | input | The input. |
Returns
Type | Description |
---|---|
System.UInt32[] | The result of the conversion. |
Implicit(UInt32[] to UInt4)
Performs an implicit conversion from System.UInt32 array to UInt4.
public static implicit operator UInt4(uint[] input)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32[] | input | The input. |
Returns
Type | Description |
---|---|
UInt4 | The result of the conversion. |
Inequality(UInt4, UInt4)
Tests for inequality between two objects.
public static bool operator !=(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first value to compare. |
UInt4 | right | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Multiply(UInt4, UInt32)
Scales a vector by the given value.
public static UInt4 operator *(UInt4 value, uint scale)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to scale. |
System.UInt32 | scale | The amount by which to scale the vector. |
Returns
Type | Description |
---|---|
UInt4 | The scaled vector. |
Multiply(UInt32, UInt4)
Scales a vector by the given value.
public static UInt4 operator *(uint scale, UInt4 value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | scale | The amount by which to scale the vector. |
UInt4 | value | The vector to scale. |
Returns
Type | Description |
---|---|
UInt4 | The scaled vector. |
Subtraction(UInt4, UInt4)
Subtracts two vectors.
public static UInt4 operator -(UInt4 left, UInt4 right)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | left | The first vector to subtract. |
UInt4 | right | The second vector to subtract. |
Returns
Type | Description |
---|---|
UInt4 | The difference of the two vectors. |
UnaryPlus(UInt4)
Assert a vector (return it unchanged).
public static UInt4 operator +(UInt4 value)
Parameters
Type | Name | Description |
---|---|---|
UInt4 | value | The vector to assert (unchange). |
Returns
Type | Description |
---|---|
UInt4 | The asserted (unchanged) vector. |