Table of Contents

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 uint

The 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 uint

Initial value for the X component of the vector.

y uint

Initial value for the Y component of the vector.

z uint

Initial value for the Z component of the vector.

w uint

Initial 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 is null.

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

UInt4

SizeInBytes

The size of the UInt4 type, in bytes.

public static readonly int SizeInBytes

Field Value

int

UnitW

The W unit UInt4 (0, 0, 0, 1).

public static readonly UInt4 UnitW

Field Value

UInt4

UnitX

The X unit UInt4 (1, 0, 0, 0).

public static readonly UInt4 UnitX

Field Value

UInt4

UnitY

The Y unit UInt4 (0, 1, 0, 0).

public static readonly UInt4 UnitY

Field Value

UInt4

UnitZ

The Z unit UInt4 (0, 0, 1, 0).

public static readonly UInt4 UnitZ

Field Value

UInt4

W

The W component of the vector.

public uint W

Field Value

uint

X

The X component of the vector.

public uint X

Field Value

uint

Y

The Y component of the vector.

public uint Y

Field Value

uint

Z

The Z component of the vector.

public uint Z

Field Value

uint

Zero

A UInt4 with all of its components set to zero.

public static readonly UInt4 Zero

Field Value

UInt4

Properties

this[uint]

Gets or sets the component at the specified index.

public uint this[uint index] { get; set; }

Parameters

index uint

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

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

left UInt4

The first vector to add.

right UInt4

The second vector to add.

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 UInt4

The first vector to add.

right UInt4

The second vector to add.

result UInt4

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

value UInt4

The value to clamp.

min UInt4

The minimum value.

max UInt4

The maximum value.

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 UInt4

The value to clamp.

min UInt4

The minimum value.

max UInt4

The maximum value.

result UInt4

When 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

x uint

The X component

y uint

The Y component

z uint

The Z component

w uint

The W component

Divide(UInt4, uint)

Scales a vector by the given value.

public static UInt4 Divide(UInt4 value, uint scale)

Parameters

value UInt4

The vector to scale.

scale uint

The amount by which to scale the vector.

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 UInt4

The vector to scale.

scale uint

The amount by which to scale the vector.

result UInt4

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

other UInt4

The UInt4 to compare with this instance.

Returns

bool

true if the specified UInt4 is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

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

left UInt4

The first source vector.

right UInt4

The second source vector.

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 UInt4

The first source vector.

right UInt4

The second source vector.

result UInt4

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

left UInt4

The first source vector.

right UInt4

The second source vector.

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 UInt4

The first source vector.

right UInt4

The second source vector.

result UInt4

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

left UInt4

The first vector to modulate.

right UInt4

The second vector to modulate.

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 UInt4

The first vector to modulate.

right UInt4

The second vector to modulate.

result UInt4

When 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

value UInt4

The vector to scale.

scale uint

The amount by which to scale the vector.

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 UInt4

The vector to scale.

scale uint

The amount by which to scale the vector.

result UInt4

When the method completes, contains the scaled vector.

Subtract(UInt4, UInt4)

Subtracts two vectors.

public static UInt4 Subtract(UInt4 left, UInt4 right)

Parameters

left UInt4

The first vector to subtract.

right UInt4

The second vector to subtract.

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 UInt4

The first vector to subtract.

right UInt4

The second vector to subtract.

result UInt4

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

uint[]

A four-element array containing the components of the vector.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Operators

operator +(UInt4, UInt4)

Adds two vectors.

public static UInt4 operator +(UInt4 left, UInt4 right)

Parameters

left UInt4

The first vector to add.

right UInt4

The second vector to add.

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

value UInt4

The vector to scale.

scale uint

The amount by which to scale the vector.

Returns

UInt4

The scaled vector.

operator ==(UInt4, UInt4)

Tests for equality between two objects.

public static bool operator ==(UInt4 left, UInt4 right)

Parameters

left UInt4

The first value to compare.

right UInt4

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

explicit operator Vector2(UInt4)

Performs an explicit conversion from UInt4 to Vector2.

public static explicit operator Vector2(UInt4 value)

Parameters

value UInt4

The value.

Returns

Vector2

The result of the conversion.

explicit operator Vector3(UInt4)

Performs an explicit conversion from UInt4 to Vector3.

public static explicit operator Vector3(UInt4 value)

Parameters

value UInt4

The value.

Returns

Vector3

The result of the conversion.

explicit operator Vector4(UInt4)

Performs an explicit conversion from UInt4 to Vector4.

public static explicit operator Vector4(UInt4 value)

Parameters

value UInt4

The value.

Returns

Vector4

The result of the conversion.

implicit operator uint[](UInt4)

Performs an implicit conversion from UInt4 to int array.

public static implicit operator uint[](UInt4 input)

Parameters

input UInt4

The input.

Returns

uint[]

The result of the conversion.

implicit operator UInt4(uint[])

Performs an implicit conversion from uint array to UInt4.

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

left UInt4

The first value to compare.

right UInt4

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.

operator *(UInt4, uint)

Scales a vector by the given value.

public static UInt4 operator *(UInt4 value, uint scale)

Parameters

value UInt4

The vector to scale.

scale uint

The amount by which to scale the vector.

Returns

UInt4

The scaled vector.

operator *(uint, UInt4)

Scales a vector by the given value.

public static UInt4 operator *(uint scale, UInt4 value)

Parameters

scale uint

The amount by which to scale the vector.

value UInt4

The vector to scale.

Returns

UInt4

The scaled vector.

operator -(UInt4, UInt4)

Subtracts two vectors.

public static UInt4 operator -(UInt4 left, UInt4 right)

Parameters

left UInt4

The first vector to subtract.

right UInt4

The second vector to subtract.

Returns

UInt4

The difference of the two vectors.

operator +(UInt4)

Assert a vector (return it unchanged).

public static UInt4 operator +(UInt4 value)

Parameters

value UInt4

The vector to assert (unchange).

Returns

UInt4

The asserted (unchanged) vector.