Struct Vector2b
Represents a 2D boolean vector.
Implements
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector2b : IEquatable<Vector2b>
Remarks
As bools in C# are not blittable this type is not necessarily suitable for interoperation with unmanaged code.
Constructors
Vector2b(Vector2b)
Initializes a new instance of the Vector2b struct.
Declaration
public Vector2b(Vector2b xy)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | xy | The x, and y component of the Vector2b. |
Vector2b(bool)
Initializes a new instance of the Vector2b struct.
Declaration
public Vector2b(bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | The value that will initialize this instance. |
Vector2b(bool, bool)
Initializes a new instance of the Vector2b struct.
Declaration
public Vector2b(bool x, bool y)
Parameters
Type | Name | Description |
---|---|---|
bool | x | The x component of the Vector2b. |
bool | y | The y component of the Vector2b. |
Fields
False
Defines an instance with all components set to false.
Declaration
public static readonly Vector2b False
Field Value
Type | Description |
---|---|
Vector2b |
True
Defines an instance with all components set to true.
Declaration
public static readonly Vector2b True
Field Value
Type | Description |
---|---|
Vector2b |
UnitX
Defines an instance with only the X components set to true.
Declaration
public static readonly Vector2b UnitX
Field Value
Type | Description |
---|---|
Vector2b |
UnitY
Defines an instance with only the Y components set to true.
Declaration
public static readonly Vector2b UnitY
Field Value
Type | Description |
---|---|
Vector2b |
X
The X component of the vector.
Declaration
public bool X
Field Value
Type | Description |
---|---|
bool |
Y
The Y component of the vector.
Declaration
public bool Y
Field Value
Type | Description |
---|---|
bool |
Properties
this[int]
Gets or sets the value at the index of the vector.
Declaration
public bool this[int index] { readonly get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the component from the vector. |
Property Value
Type | Description |
---|---|
bool |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if the index is less than 0 or greater than 1. |
Yx
Gets or sets an OpenTK.Vector2 with the Y and X components of this instance.
Declaration
public Vector2b Yx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2b |
Methods
All()
Declaration
public readonly bool All()
Returns
Type | Description |
---|---|
bool | If all of the components of the vector were true. |
All(Vector2b)
Declaration
public static bool All(Vector2b vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | vector | The vector to check if all components are true. |
Returns
Type | Description |
---|---|
bool | If all of the components of the vector were true. |
And(Vector2b, Vector2b)
Returns the component-wise logical and of two vectors.
Declaration
public static Vector2b And(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | The first vector to and. |
Vector2b | right | The second vector to and. |
Returns
Type | Description |
---|---|
Vector2b | A vector were each component is the logical and of the input vector components. |
Any()
Declaration
public readonly bool Any()
Returns
Type | Description |
---|---|
bool | If any of the components of the vector were true. |
Any(Vector2b)
Declaration
public static bool Any(Vector2b vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | vector | The vector to check if any components are true. |
Returns
Type | Description |
---|---|
bool | If any of the components of the vector were true. |
Deconstruct(out bool, out bool)
Deconstructs the vector into it's individual components.
Declaration
[Pure]
public readonly void Deconstruct(out bool x, out bool y)
Parameters
Type | Name | Description |
---|---|---|
bool | x | The X component of the vector. |
bool | y | The Y component of the vector. |
Equals(Vector2b)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(Vector2b other)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
Not()
Returns the logical negation of this vector.
Declaration
public readonly Vector2b Not()
Returns
Type | Description |
---|---|
Vector2b | A vector with each component negated. |
Not(Vector2b)
Returns the logical negation of a vector.
Declaration
public static Vector2b Not(Vector2b vec)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | vec | The vector to logically negate. |
Returns
Type | Description |
---|---|
Vector2b | A vector with each component negated. |
Or(Vector2b, Vector2b)
Returns the component-wise logical or of two vectors.
Declaration
public static Vector2b Or(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | The first vector to or. |
Vector2b | right | The second vector to or. |
Returns
Type | Description |
---|---|
Vector2b | A vector were each component is the logical or of the input vector components. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
ToString(IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public readonly string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
Xor(Vector2b, Vector2b)
Returns the component-wise logical xor of two vectors.
Declaration
public static Vector2b Xor(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | The first vector to xor. |
Vector2b | right | The second vector to xor. |
Returns
Type | Description |
---|---|
Vector2b | A vector were each component is the logical xor of the input vector components. |
Operators
operator &(Vector2b, Vector2b)
ANDs the specified instances.
Declaration
public static Vector2b operator &(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | Left operand. |
Vector2b | right | Right operand. |
Returns
Type | Description |
---|---|
Vector2b | Result of the logical AND operation. |
operator |(Vector2b, Vector2b)
ORs the specified instances.
Declaration
public static Vector2b operator |(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | Left operand. |
Vector2b | right | Right operand. |
Returns
Type | Description |
---|---|
Vector2b | Result of the logical OR operation. |
operator ==(Vector2b, Vector2b)
Compares the specified instances for equality.
Declaration
public static bool operator ==(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | Left operand. |
Vector2b | right | Right operand. |
Returns
Type | Description |
---|---|
bool | True if both instances are equal; false otherwise. |
operator ^(Vector2b, Vector2b)
XORs the specified instances.
Declaration
public static Vector2b operator ^(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | Left operand. |
Vector2b | right | Right operand. |
Returns
Type | Description |
---|---|
Vector2b | Result of the logical XOR operation. |
implicit operator Vector2b((bool X, bool Y))
Initializes a new instance of the Vector2b struct using a tuple containing the component values.
Declaration
[Pure]
public static implicit operator Vector2b((bool X, bool Y) values)
Parameters
Type | Name | Description |
---|---|---|
(bool X, bool Y) | values | A tuple containing the component values. |
Returns
Type | Description |
---|---|
Vector2b | A new instance of the Vector2b struct with the given component values. |
operator !=(Vector2b, Vector2b)
Compares the specified instances for inequality.
Declaration
public static bool operator !=(Vector2b left, Vector2b right)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | left | Left operand. |
Vector2b | right | Right operand. |
Returns
Type | Description |
---|---|
bool | True if both instances are not equal; false otherwise. |
operator !(Vector2b)
Negates the specified instance.
Declaration
public static Vector2b operator !(Vector2b vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2b | vector | Operand. |
Returns
Type | Description |
---|---|
Vector2b | Result of negation. |