Struct Bool4
- Namespace
- HelixToolkit.Maths
- Assembly
- HelixToolkit.Maths.dll
Represents a four dimensional mathematical vector of bool (32 bits per bool value).
public struct Bool4 : IEquatable<Bool4>, IFormattable
- Implements
- Inherited Members
- Extension Methods
Constructors
Bool4(bool)
Initializes a new instance of the Bool4 struct.
public Bool4(bool value)
Parameters
valueboolThe value that will be assigned to all components.
Bool4(bool, bool, bool, bool)
Initializes a new instance of the Bool4 struct.
public Bool4(bool x, bool y, bool z, bool w)
Parameters
xboolInitial value for the X component of the vector.
yboolInitial value for the Y component of the vector.
zboolInitial value for the Z component of the vector.
wboolInitial value for the W component of the vector.
Bool4(bool[])
Initializes a new instance of the Bool4 struct.
public Bool4(bool[] values)
Parameters
valuesbool[]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
valuesisnull.- ArgumentOutOfRangeException
Thrown when
valuescontains more or less than four elements.
Fields
False
A Bool4 with all of its components set to false.
public static readonly Bool4 False
Field Value
One
A Bool4 with all of its components set to true.
public static readonly Bool4 One
Field Value
SizeInBytes
The size of the Bool4 type, in bytes.
public static readonly int SizeInBytes
Field Value
UnitW
The W unit Bool4 (0, 0, 0, true).
public static readonly Bool4 UnitW
Field Value
UnitX
The X unit Bool4 (true, 0, 0, 0).
public static readonly Bool4 UnitX
Field Value
UnitY
The Y unit Bool4 (0, true, 0, 0).
public static readonly Bool4 UnitY
Field Value
UnitZ
The Z unit Bool4 (0, 0, true, 0).
public static readonly Bool4 UnitZ
Field Value
Properties
this[int]
Gets or sets the component at the specified index.
public bool this[int index] { readonly get; set; }
Parameters
indexintThe 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
- bool
The value of the X, Y, Z, or W component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
indexis out of the range [0, 3].
W
The W component of the vector.
public bool W { readonly get; set; }
Property Value
X
The X component of the vector.
public bool X { readonly get; set; }
Property Value
Y
The Y component of the vector.
public bool Y { readonly get; set; }
Property Value
Z
The Z component of the vector.
public bool Z { readonly get; set; }
Property Value
Methods
Equals(Bool4)
Determines whether the specified Bool4 is equal to this instance.
public readonly bool Equals(Bool4 other)
Parameters
Returns
Equals(ref Bool4)
Determines whether the specified Bool4 is equal to this instance.
public readonly bool Equals(ref Bool4 other)
Parameters
Returns
Equals(object?)
Determines whether the specified object is equal to this instance.
public override readonly bool Equals(object? obj)
Parameters
Returns
GetHashCode()
Returns a hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
ToArray()
Creates an array containing the elements of the vector.
public readonly bool[] ToArray()
Returns
- bool[]
A four-element array containing the components of the vector.
ToString()
Returns a string that represents this instance.
public override readonly string ToString()
Returns
ToString(IFormatProvider)
public readonly string ToString(IFormatProvider formatProvider)
Parameters
formatProviderIFormatProvider
Returns
ToString(string?, IFormatProvider?)
Returns a string that represents this instance.
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format.
formatProviderIFormatProviderThe format provider.
Returns
Operators
operator ==(Bool4, Bool4)
Tests for equality between two objects.
public static bool operator ==(Bool4 left, Bool4 right)
Parameters
Returns
- bool
trueiflefthas the same value asright; otherwise,false.
implicit operator bool[](Bool4)
public static implicit operator bool[](Bool4 input)
Parameters
inputBool4The input.
Returns
- bool[]
The result of the conversion.
implicit operator Bool4(bool[])
public static implicit operator Bool4(bool[] input)
Parameters
inputbool[]The input.
Returns
- Bool4
The result of the conversion.
operator !=(Bool4, Bool4)
Tests for inequality between two objects.
public static bool operator !=(Bool4 left, Bool4 right)
Parameters
Returns
- bool
trueiflefthas a different value thanright; otherwise,false.