Struct Vector3i
Represents a 3D vector using three 32-bit integer numbers.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector3i : IEquatable<Vector3i>, IFormattable
Remarks
The Vector3i structure is suitable for interoperation with unmanaged code requiring three consecutive integers.
Constructors
Vector3i(Vector2i, int)
Initializes a new instance of the Vector3i struct.
Declaration
public Vector3i(Vector2i v, int z)
Parameters
Type | Name | Description |
---|---|---|
Vector2i | v | The Vector2i to copy components from. |
int | z | The z component of the new Vector3. |
Vector3i(Vector2i)
Initializes a new instance of the Vector3i struct.
Declaration
public Vector3i(Vector2i v)
Parameters
Type | Name | Description |
---|---|---|
Vector2i | v | The Vector2i to copy components from. |
Vector3i(int, int, int)
Initializes a new instance of the Vector3i struct.
Declaration
public Vector3i(int x, int y, int z)
Parameters
Type | Name | Description |
---|---|---|
int | x | The x component of the Vector3. |
int | y | The y component of the Vector3. |
int | z | The z component of the Vector3. |
Vector3i(int)
Initializes a new instance of the Vector3i struct.
Declaration
public Vector3i(int value)
Parameters
Type | Name | Description |
---|---|---|
int | value | The value that will initialize this instance. |
Fields
One
Defines an instance with all components set to 1.
Declaration
public static readonly Vector3i One
Field Value
Type | Description |
---|---|
Vector3i |
SizeInBytes
Defines the size of the Vector3i struct in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
Type | Description |
---|---|
int |
UnitX
Defines a unit-length Vector3i that points towards the X-axis.
Declaration
public static readonly Vector3i UnitX
Field Value
Type | Description |
---|---|
Vector3i |
UnitY
Defines a unit-length Vector3i that points towards the Y-axis.
Declaration
public static readonly Vector3i UnitY
Field Value
Type | Description |
---|---|
Vector3i |
UnitZ
Defines a unit-length Vector3i that points towards the Z-axis.
Declaration
public static readonly Vector3i UnitZ
Field Value
Type | Description |
---|---|
Vector3i |
X
The X component of the Vector3i.
Declaration
public int X
Field Value
Type | Description |
---|---|
int |
Y
The Y component of the Vector3i.
Declaration
public int Y
Field Value
Type | Description |
---|---|
int |
Z
The Z component of the Vector3i.
Declaration
public int Z
Field Value
Type | Description |
---|---|
int |
Zero
Defines an instance with all components set to 0.
Declaration
public static readonly Vector3i Zero
Field Value
Type | Description |
---|---|
Vector3i |
Properties
EuclideanLength
Gets the euclidean length of the vector.
Declaration
public float EuclideanLength { get; }
Property Value
Type | Description |
---|---|
float |
EuclideanLengthSquared
Gets the squared euclidean length of the vector.
Declaration
public int EuclideanLengthSquared { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Gets or sets the value at the index of the vector.
Declaration
public int this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the component from the vector. |
Property Value
Type | Description |
---|---|
int |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if the index is less than 0 or greater than 2. |
ManhattanLength
Gets the manhattan length of the vector.
Declaration
public int ManhattanLength { get; }
Property Value
Type | Description |
---|---|
int |
Xy
Gets or sets a Vector2i with the X and Y components of this instance.
Declaration
public Vector2i Xy { get; set; }
Property Value
Type | Description |
---|---|
Vector2i |
Xz
Gets or sets a Vector2i with the X and Z components of this instance.
Declaration
public Vector2i Xz { get; set; }
Property Value
Type | Description |
---|---|
Vector2i |
Xzy
Gets or sets a Vector3i with the X, Z, and Y components of this instance.
Declaration
public Vector3i Xzy { get; set; }
Property Value
Type | Description |
---|---|
Vector3i |
Yx
Gets or sets a Vector2i with the Y and X components of this instance.
Declaration
public Vector2i Yx { get; set; }
Property Value
Type | Description |
---|---|
Vector2i |
Yxz
Gets or sets a Vector3i with the Y, X, and Z components of this instance.
Declaration
public Vector3i Yxz { get; set; }
Property Value
Type | Description |
---|---|
Vector3i |
Yz
Gets or sets a Vector2i with the Y and Z components of this instance.
Declaration
public Vector2i Yz { get; set; }
Property Value
Type | Description |
---|---|
Vector2i |
Yzx
Gets or sets a Vector3i with the Y, Z, and X components of this instance.
Declaration
public Vector3i Yzx { get; set; }
Property Value
Type | Description |
---|---|
Vector3i |
Zx
Gets or sets a Vector2i with the Z and X components of this instance.
Declaration
public Vector2i Zx { get; set; }
Property Value
Type | Description |
---|---|
Vector2i |
Zxy
Gets or sets a Vector3i with the Z, X, and Y components of this instance.
Declaration
public Vector3i Zxy { get; set; }
Property Value
Type | Description |
---|---|
Vector3i |
Zy
Gets or sets a Vector2i with the Z and Y components of this instance.
Declaration
public Vector2i Zy { get; set; }
Property Value
Type | Description |
---|---|
Vector2i |
Zyx
Gets or sets a Vector3i with the Z, Y, and X components of this instance.
Declaration
public Vector3i Zyx { get; set; }
Property Value
Type | Description |
---|---|
Vector3i |
Methods
Add(Vector3i, Vector3i)
Adds two vectors.
Declaration
[Pure]
public static Vector3i Add(Vector3i a, Vector3i b)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | Left operand. |
Vector3i | b | Right operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of operation. |
Add(in Vector3i, in Vector3i, out Vector3i)
Adds two vectors.
Declaration
public static void Add(in Vector3i a, in Vector3i b, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | Left operand. |
Vector3i | b | Right operand. |
Vector3i | result | Result of operation. |
Clamp(Vector3i, Vector3i, Vector3i)
Clamp a vector to the given minimum and maximum vectors.
Declaration
[Pure]
public static Vector3i Clamp(Vector3i vec, Vector3i min, Vector3i max)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | Input vector. |
Vector3i | min | Minimum vector. |
Vector3i | max | Maximum vector. |
Returns
Type | Description |
---|---|
Vector3i | The clamped vector. |
Clamp(in Vector3i, in Vector3i, in Vector3i, out Vector3i)
Clamp a vector to the given minimum and maximum vectors.
Declaration
public static void Clamp(in Vector3i vec, in Vector3i min, in Vector3i max, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | Input vector. |
Vector3i | min | Minimum vector. |
Vector3i | max | Maximum vector. |
Vector3i | result | The clamped vector. |
ComponentMax(Vector3i, Vector3i)
Returns a vector created from the largest of the corresponding components of the given vectors.
Declaration
[Pure]
public static Vector3i ComponentMax(Vector3i a, Vector3i b)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | First operand. |
Vector3i | b | Second operand. |
Returns
Type | Description |
---|---|
Vector3i | The component-wise maximum. |
ComponentMax(in Vector3i, in Vector3i, out Vector3i)
Returns a vector created from the largest of the corresponding components of the given vectors.
Declaration
public static void ComponentMax(in Vector3i a, in Vector3i b, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | First operand. |
Vector3i | b | Second operand. |
Vector3i | result | The component-wise maximum. |
ComponentMin(Vector3i, Vector3i)
Returns a vector created from the smallest of the corresponding components of the given vectors.
Declaration
[Pure]
public static Vector3i ComponentMin(Vector3i a, Vector3i b)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | First operand. |
Vector3i | b | Second operand. |
Returns
Type | Description |
---|---|
Vector3i | The component-wise minimum. |
ComponentMin(in Vector3i, in Vector3i, out Vector3i)
Returns a vector created from the smallest of the corresponding components of the given vectors.
Declaration
public static void ComponentMin(in Vector3i a, in Vector3i b, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | First operand. |
Vector3i | b | Second operand. |
Vector3i | result | The component-wise minimum. |
Deconstruct(out int, out int, out int)
Deconstructs the vector into it's individual components.
Declaration
[Pure]
public void Deconstruct(out int x, out int y, out int z)
Parameters
Type | Name | Description |
---|---|---|
int | x | The X component of the vector. |
int | y | The Y component of the vector. |
int | z | The Z component of the vector. |
Divide(Vector3i, Vector3i)
Divides a vector by the components of a vector using integer division, floor(a/b).
Declaration
[Pure]
public static Vector3i Divide(Vector3i vector, Vector3i scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
Vector3i | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of the operation. |
Divide(Vector3i, int)
Divides a vector by a scalar using integer division, floor(a/b).
Declaration
[Pure]
public static Vector3i Divide(Vector3i vector, int scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
int | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of the operation. |
Divide(in Vector3i, in Vector3i, out Vector3i)
Divides a vector by the components of a vector using integer division, floor(a/b).
Declaration
public static void Divide(in Vector3i vector, in Vector3i scale, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
Vector3i | scale | Right operand. |
Vector3i | result | Result of the operation. |
Divide(in Vector3i, int, out Vector3i)
Divides a vector by a scalar using integer division, floor(a/b).
Declaration
public static void Divide(in Vector3i vector, int scale, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
int | scale | Right operand. |
Vector3i | result | Result of the operation. |
Equals(Vector3i)
Declaration
public bool Equals(Vector3i other)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | other |
Returns
Type | Description |
---|---|
bool |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
Multiply(Vector3i, Vector3i)
Multiplies a vector by the components a vector (scale).
Declaration
[Pure]
public static Vector3i Multiply(Vector3i vector, Vector3i scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
Vector3i | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of the operation. |
Multiply(Vector3i, int)
Multiplies a vector by a scalar.
Declaration
[Pure]
public static Vector3i Multiply(Vector3i vector, int scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
int | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of the operation. |
Multiply(in Vector3i, in Vector3i, out Vector3i)
Multiplies a vector by the components of a vector (scale).
Declaration
public static void Multiply(in Vector3i vector, in Vector3i scale, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
Vector3i | scale | Right operand. |
Vector3i | result | Result of the operation. |
Multiply(in Vector3i, int, out Vector3i)
Multiplies a vector by a scalar.
Declaration
public static void Multiply(in Vector3i vector, int scale, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vector | Left operand. |
int | scale | Right operand. |
Vector3i | result | Result of the operation. |
Subtract(Vector3i, Vector3i)
Subtract one vector from another.
Declaration
[Pure]
public static Vector3i Subtract(Vector3i a, Vector3i b)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | First operand. |
Vector3i | b | Second operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of subtraction. |
Subtract(in Vector3i, in Vector3i, out Vector3i)
Subtract one vector from another.
Declaration
public static void Subtract(in Vector3i a, in Vector3i b, out Vector3i result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | a | First operand. |
Vector3i | b | Second operand. |
Vector3i | result | Result of subtraction. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
ToString(IFormatProvider)
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
string |
ToString(string, IFormatProvider)
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
string | format | |
IFormatProvider | formatProvider |
Returns
Type | Description |
---|---|
string |
ToString(string)
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format |
Returns
Type | Description |
---|---|
string |
ToVector3()
Declaration
public Vector3 ToVector3()
Returns
Type | Description |
---|---|
Vector3 | The resulting Vector3 instance. |
ToVector3(in Vector3i, out Vector3)
Declaration
public static void ToVector3(in Vector3i input, out Vector3 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | input | The given Vector3i to convert. |
Vector3 | result | The resulting Vector3. |
Operators
operator +(Vector3i, Vector3i)
Adds two instances.
Declaration
[Pure]
public static Vector3i operator +(Vector3i left, Vector3i right)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | left | The first instance. |
Vector3i | right | The second instance. |
Returns
Type | Description |
---|---|
Vector3i | The result of the calculation. |
operator /(Vector3i, Vector3i)
Component-wise division between the specified instance by a scale vector.
Declaration
[Pure]
public static Vector3i operator /(Vector3i vec, Vector3i scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | Left operand. |
Vector3i | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of the division. |
operator /(Vector3i, int)
Divides the instance by a scalar using integer division, floor(a/b).
Declaration
[Pure]
public static Vector3i operator /(Vector3i vec, int scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | The instance. |
int | scale | The scalar. |
Returns
Type | Description |
---|---|
Vector3i | The result of the calculation. |
operator ==(Vector3i, Vector3i)
Compares two instances for equality.
Declaration
public static bool operator ==(Vector3i left, Vector3i right)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | left | The first instance. |
Vector3i | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left equals right; false otherwise. |
explicit operator Vector3h(Vector3i)
Converts OpenTK.Vector3i to OpenTK.Vector3h.
Declaration
[Pure]
public static explicit operator Vector3h(Vector3i vec)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | The Vector3i to convert. |
Returns
Type | Description |
---|---|
Vector3h | The resulting Vector3h. |
implicit operator Vector3(Vector3i)
Converts OpenTK.Vector3i to OpenTK.Vector3.
Declaration
[Pure]
public static implicit operator Vector3(Vector3i vec)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | The Vector3i to convert. |
Returns
Type | Description |
---|---|
Vector3 | The resulting Vector3. |
implicit operator Vector3d(Vector3i)
Converts OpenTK.Vector3i to OpenTK.Vector3d.
Declaration
[Pure]
public static implicit operator Vector3d(Vector3i vec)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | The Vector3i to convert. |
Returns
Type | Description |
---|---|
Vector3d | The resulting Vector3d. |
implicit operator Vector3i((int X, int Y, int Z))
Initializes a new instance of the Vector3i struct using a tuple containing the component values.
Declaration
[Pure]
public static implicit operator Vector3i((int X, int Y, int Z) values)
Parameters
Type | Name | Description |
---|---|---|
(int X, int Y, int Z) | values | A tuple containing the component values. |
Returns
Type | Description |
---|---|
Vector3i | A new instance of the Vector3i struct with the given component values. |
operator !=(Vector3i, Vector3i)
Compares two instances for inequality.
Declaration
public static bool operator !=(Vector3i left, Vector3i right)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | left | The first instance. |
Vector3i | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left does not equal right; false otherwise. |
operator *(Vector3i, Vector3i)
Component-wise multiplication between the specified instance by a scale vector.
Declaration
[Pure]
public static Vector3i operator *(Vector3i vec, Vector3i scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | Right operand. |
Vector3i | scale | Left operand. |
Returns
Type | Description |
---|---|
Vector3i | Result of multiplication. |
operator *(Vector3i, int)
Multiplies an instance by an integer scalar.
Declaration
[Pure]
public static Vector3i operator *(Vector3i vec, int scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | The instance. |
int | scale | The scalar. |
Returns
Type | Description |
---|---|
Vector3i | The result of the calculation. |
operator *(int, Vector3i)
Multiplies an instance by an integer scalar.
Declaration
[Pure]
public static Vector3i operator *(int scale, Vector3i vec)
Parameters
Type | Name | Description |
---|---|---|
int | scale | The scalar. |
Vector3i | vec | The instance. |
Returns
Type | Description |
---|---|
Vector3i | The result of the calculation. |
operator -(Vector3i, Vector3i)
Subtracts two instances.
Declaration
[Pure]
public static Vector3i operator -(Vector3i left, Vector3i right)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | left | The first instance. |
Vector3i | right | The second instance. |
Returns
Type | Description |
---|---|
Vector3i | The result of the calculation. |
operator -(Vector3i)
Negates an instance.
Declaration
[Pure]
public static Vector3i operator -(Vector3i vec)
Parameters
Type | Name | Description |
---|---|---|
Vector3i | vec | The instance. |
Returns
Type | Description |
---|---|
Vector3i | The result of the calculation. |