Struct UInt4
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Represents a four dimensional mathematical vector.
[DataContract]
public struct UInt4 : IEquatable<UInt4>, IFormattable
- Implements
Constructors
UInt4(uint)
Initializes a new instance of the UInt4 struct.
public UInt4(uint value)
Parameters
value
uintThe value that will be assigned to all components.
UInt4(uint, uint, uint, uint)
Initializes a new instance of the UInt4 struct.
public UInt4(uint x, uint y, uint z, uint w)
Parameters
x
uintInitial value for the X component of the vector.
y
uintInitial value for the Y component of the vector.
z
uintInitial value for the Z component of the vector.
w
uintInitial value for the W component of the vector.
UInt4(uint[])
Initializes a new instance of the UInt4 struct.
public UInt4(uint[] values)
Parameters
values
uint[]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
values
isnull
.- ArgumentOutOfRangeException
Thrown when
values
contains more or less than four elements.
Fields
One
A UInt4 with all of its components set to one.
public static readonly UInt4 One
Field Value
SizeInBytes
The size of the UInt4 type, in bytes.
public static readonly int SizeInBytes
Field Value
UnitW
The W unit UInt4 (0, 0, 0, 1).
public static readonly UInt4 UnitW
Field Value
UnitX
The X unit UInt4 (1, 0, 0, 0).
public static readonly UInt4 UnitX
Field Value
UnitY
The Y unit UInt4 (0, 1, 0, 0).
public static readonly UInt4 UnitY
Field Value
UnitZ
The Z unit UInt4 (0, 0, 1, 0).
public static readonly UInt4 UnitZ
Field Value
W
The W component of the vector.
public uint W
Field Value
X
The X component of the vector.
public uint X
Field Value
Y
The Y component of the vector.
public uint Y
Field Value
Z
The Z component of the vector.
public uint Z
Field Value
Zero
A UInt4 with all of its components set to zero.
public static readonly UInt4 Zero
Field Value
Properties
this[uint]
Gets or sets the component at the specified index.
public uint this[uint index] { get; set; }
Parameters
index
uintThe 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
- uint
The value of the X, Y, Z, or W component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
index
is out of the range [0, 3].
Methods
Add(UInt4, UInt4)
Adds two vectors.
public static UInt4 Add(UInt4 left, UInt4 right)
Parameters
Returns
- UInt4
The sum of the two vectors.
Add(ref readonly UInt4, ref readonly UInt4, out UInt4)
Adds two vectors.
public static void Add(ref readonly UInt4 left, ref readonly UInt4 right, out UInt4 result)
Parameters
left
UInt4The first vector to add.
right
UInt4The second vector to add.
result
UInt4When 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
Returns
- UInt4
The clamped value.
Clamp(ref readonly UInt4, ref readonly UInt4, ref readonly UInt4, out UInt4)
Restricts a value to be within a specified range.
public static void Clamp(ref readonly UInt4 value, ref readonly UInt4 min, ref readonly UInt4 max, out UInt4 result)
Parameters
value
UInt4The value to clamp.
min
UInt4The minimum value.
max
UInt4The maximum value.
result
UInt4When the method completes, contains the clamped value.
Deconstruct(out uint, out uint, out uint, out uint)
Deconstructs the vector's components into named variables.
public void Deconstruct(out uint x, out uint y, out uint z, out uint w)
Parameters
Divide(UInt4, uint)
Scales a vector by the given value.
public static UInt4 Divide(UInt4 value, uint scale)
Parameters
Returns
- UInt4
The scaled vector.
Divide(ref readonly UInt4, uint, out UInt4)
Scales a vector by the given value.
public static void Divide(ref readonly UInt4 value, uint scale, out UInt4 result)
Parameters
value
UInt4The vector to scale.
scale
uintThe amount by which to scale the vector.
result
UInt4When 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
Returns
Equals(object)
Determines whether the specified object is equal to this instance.
public override bool Equals(object value)
Parameters
Returns
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Max(UInt4, UInt4)
Returns a vector containing the largest components of the specified vectors.
public static UInt4 Max(UInt4 left, UInt4 right)
Parameters
Returns
- UInt4
A vector containing the largest components of the source vectors.
Max(ref readonly UInt4, ref readonly UInt4, out UInt4)
Returns a vector containing the smallest components of the specified vectors.
public static void Max(ref readonly UInt4 left, ref readonly UInt4 right, out UInt4 result)
Parameters
left
UInt4The first source vector.
right
UInt4The second source vector.
result
UInt4When 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
Returns
- UInt4
A vector containing the smallest components of the source vectors.
Min(ref readonly UInt4, ref readonly UInt4, out UInt4)
Returns a vector containing the smallest components of the specified vectors.
public static void Min(ref readonly UInt4 left, ref readonly UInt4 right, out UInt4 result)
Parameters
left
UInt4The first source vector.
right
UInt4The second source vector.
result
UInt4When 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
Returns
- UInt4
The modulated vector.
Modulate(ref readonly UInt4, ref readonly UInt4, out UInt4)
Modulates a vector with another by performing component-wise multiplication.
public static void Modulate(ref readonly UInt4 left, ref readonly UInt4 right, out UInt4 result)
Parameters
left
UInt4The first vector to modulate.
right
UInt4The second vector to modulate.
result
UInt4When the method completes, contains the modulated vector.
Multiply(UInt4, uint)
Scales a vector by the given value.
public static UInt4 Multiply(UInt4 value, uint scale)
Parameters
Returns
- UInt4
The scaled vector.
Multiply(ref readonly UInt4, uint, out UInt4)
Scales a vector by the given value.
public static void Multiply(ref readonly UInt4 value, uint scale, out UInt4 result)
Parameters
value
UInt4The vector to scale.
scale
uintThe amount by which to scale the vector.
result
UInt4When the method completes, contains the scaled vector.
Subtract(UInt4, UInt4)
Subtracts two vectors.
public static UInt4 Subtract(UInt4 left, UInt4 right)
Parameters
Returns
- UInt4
The difference of the two vectors.
Subtract(ref readonly UInt4, ref readonly UInt4, out UInt4)
Subtracts two vectors.
public static void Subtract(ref readonly UInt4 left, ref readonly UInt4 right, out UInt4 result)
Parameters
left
UInt4The first vector to subtract.
right
UInt4The second vector to subtract.
result
UInt4When the method completes, contains the difference of the two vectors.
ToArray()
Creates an array containing the elements of the vector.
public uint[] ToArray()
Returns
- uint[]
A four-element array containing the components of the vector.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
ToString(IFormatProvider)
Returns a string that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
formatProvider
IFormatProviderThe format provider.
Returns
ToString(string)
Returns a string that represents this instance.
public string ToString(string format)
Parameters
format
stringThe format.
Returns
ToString(string, IFormatProvider)
Returns a string that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
format
stringThe format.
formatProvider
IFormatProviderThe format provider.
Returns
Operators
operator +(UInt4, UInt4)
Adds two vectors.
public static UInt4 operator +(UInt4 left, UInt4 right)
Parameters
Returns
- UInt4
The sum of the two vectors.
operator /(UInt4, uint)
Scales a vector by the given value.
public static UInt4 operator /(UInt4 value, uint scale)
Parameters
Returns
- UInt4
The scaled vector.
operator ==(UInt4, UInt4)
Tests for equality between two objects.
public static bool operator ==(UInt4 left, UInt4 right)
Parameters
Returns
- bool
true
ifleft
has the same value asright
; otherwise,false
.
explicit operator Vector2(UInt4)
public static explicit operator Vector2(UInt4 value)
Parameters
value
UInt4The value.
Returns
- Vector2
The result of the conversion.
explicit operator Vector3(UInt4)
public static explicit operator Vector3(UInt4 value)
Parameters
value
UInt4The value.
Returns
- Vector3
The result of the conversion.
explicit operator Vector4(UInt4)
public static explicit operator Vector4(UInt4 value)
Parameters
value
UInt4The value.
Returns
- Vector4
The result of the conversion.
implicit operator uint[](UInt4)
public static implicit operator uint[](UInt4 input)
Parameters
input
UInt4The input.
Returns
- uint[]
The result of the conversion.
implicit operator UInt4(uint[])
public static implicit operator UInt4(uint[] input)
Parameters
input
uint[]The input.
Returns
- UInt4
The result of the conversion.
operator !=(UInt4, UInt4)
Tests for inequality between two objects.
public static bool operator !=(UInt4 left, UInt4 right)
Parameters
Returns
- bool
true
ifleft
has a different value thanright
; otherwise,false
.
operator *(UInt4, uint)
Scales a vector by the given value.
public static UInt4 operator *(UInt4 value, uint scale)
Parameters
Returns
- UInt4
The scaled vector.
operator *(uint, UInt4)
Scales a vector by the given value.
public static UInt4 operator *(uint scale, UInt4 value)
Parameters
Returns
- UInt4
The scaled vector.
operator -(UInt4, UInt4)
Subtracts two vectors.
public static UInt4 operator -(UInt4 left, UInt4 right)
Parameters
Returns
- UInt4
The difference of the two vectors.
operator +(UInt4)
Assert a vector (return it unchanged).
public static UInt4 operator +(UInt4 value)
Parameters
value
UInt4The vector to assert (unchange).
Returns
- UInt4
The asserted (unchanged) vector.