Table of Contents

Struct Vector2DInt

Namespace
Cobilas.GodotEngine.Utility.Numerics
Assembly
com.cobilas.godot.utility.dll

Representation of a two-dimensional vector using integers.

[Serializable]
public struct Vector2DInt : IIntVector, IFormattable
Implements
Inherited Members

Constructors

Vector2DInt(in Vector2DInt)

Starts a new instance of the object.

public Vector2DInt(in Vector2DInt vector)

Parameters

vector Vector2DInt

Vector2DInt(in int, in int)

Starts a new instance of the object.

public Vector2DInt(in int x, in int y)

Parameters

x int
y int

Fields

x

X component of the vector.

public int x

Field Value

int

y

Y component of the vector.

public int y

Field Value

int

Properties

AxisCount

Number of axles.

public readonly int AxisCount { get; }

Property Value

int

Returns the number of axes a vector has.

Down

Shorthand for writing Vector2(0,1).

public static Vector2DInt Down { get; }

Property Value

Vector2DInt

this[int]

Allows you to access the axes of a vector through an index.

public int this[int index] { readonly get; set; }

Parameters

index int

The axis index.

Property Value

int

Sets the value of an axis by specifying its index.

Left

Shorthand for writing Vector2(-1,0).

public static Vector2DInt Left { get; }

Property Value

Vector2DInt

One

Shorthand for writing Vector2(1,1).

public static Vector2DInt One { get; }

Property Value

Vector2DInt

Right

Shorthand for writing Vector2(1,0).

public static Vector2DInt Right { get; }

Property Value

Vector2DInt

Up

Shorthand for writing Vector2(0,-1).

public static Vector2DInt Up { get; }

Property Value

Vector2DInt

Zero

Shorthand for writing Vector2(0,0).

public static Vector2DInt Zero { get; }

Property Value

Vector2DInt

aspect

Returns the aspect ratio of this vector, the ratio of IVector.x to IVector.y.

public readonly float aspect { get; }

Property Value

float

The IVector.x component divided by the IVector.y component.

magnitude

Returns the length (magnitude) of this vector.

public readonly float magnitude { get; }

Property Value

float

The length of this vector.

See Also
LengthSquared()

sqrMagnitude

Returns the squared length (squared magnitude) of this vector. This method runs faster than magnitude, so prefer it if you need to compare vectors or need the squared length for some formula.

public readonly int sqrMagnitude { get; }

Property Value

int

The squared length of this vector.

Methods

Abs(in Vector2DInt)

Returns an absolute value of the vector.

public static Vector2DInt Abs(in Vector2DInt a)

Parameters

a Vector2DInt

The vector to become absolute.

Returns

Vector2DInt

Returns the vector with its absolute value axes.

Abs(bool, bool)

Returns an absolute value of the vector.

public readonly Vector2DInt Abs(bool absX = true, bool absY = true)

Parameters

absX bool

The X axis becomes absolute.

absY bool

The Y axis becomes absolute.

Returns

Vector2DInt

Returns the vector with its absolute value axes.

Aspect(in Vector2DInt)

Returns the aspect ratio of this vector, the ratio of IVector.x to IVector.y.

public static float Aspect(in Vector2DInt a)

Parameters

a Vector2DInt

The vector whose aspect will be calculated.

Returns

float

The IVector.x component divided by the IVector.y component.

CeilToInt(in Vector2D)

Converts a floating-point vector to an integer vector and applies a Ceiling to each value.

public static Vector2DInt CeilToInt(in Vector2D a)

Parameters

a Vector2D

The vector to be converted is ceiling

Returns

Vector2DInt

Returns the converted vector and ceiling

Distance(in Vector2DInt, in Vector2DInt)

Returns the distance between a and b.

public static float Distance(in Vector2DInt a, in Vector2DInt b)

Parameters

a Vector2DInt

One of the values.

b Vector2DInt

The other value.

Returns

float

The distance between two vectors.

Equals(Vector2DInt)

public readonly bool Equals(Vector2DInt other)

Parameters

other Vector2DInt

Returns

bool

Equals(object)

Indicates whether this instance and a specified object are equal.

public override readonly bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FloorToInt(in Vector2D)

Converts a floating-point vector to an integer vector and applies a Floor to each value.

public static Vector2DInt FloorToInt(in Vector2D a)

Parameters

a Vector2D

The vector to be converted is floor

Returns

Vector2DInt

Returns the converted vector and floor

GetHashCode()

Returns the hash code for this instance.

public override readonly int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Magnitude(in Vector2DInt)

Returns the length of this vector

public static float Magnitude(in Vector2DInt a)

Parameters

a Vector2DInt

One of the values.

Returns

float

vector length.

Max(Vector2DInt, Vector2DInt)

Returns a vector that is made from the largest components of two vectors.

public static Vector2DInt Max(Vector2DInt lhs, Vector2DInt rhs)

Parameters

lhs Vector2DInt

One of the values.

rhs Vector2DInt

The other value.

Returns

Vector2DInt

Whichever of the two values is higher.

Min(Vector2DInt, Vector2DInt)

Returns a vector that is made from the smallest components of two vectors.

public static Vector2DInt Min(Vector2DInt lhs, Vector2DInt rhs)

Parameters

lhs Vector2DInt

One of the values.

rhs Vector2DInt

The other value.

Returns

Vector2DInt

Whichever of the two values is lower.

Neg(in Vector2DInt)

Inverts the values ​​of a vector.

public static Vector2DInt Neg(in Vector2DInt a)

Parameters

a Vector2DInt

The vector to be inverted.

Returns

Vector2DInt

Returns the axes of an inverted vector.

Neg(bool, bool)

Inverts the values ​​of a vector.

public readonly Vector2DInt Neg(bool negX = true, bool negY = true)

Parameters

negX bool

The X axis becomes inverted.

negY bool

The Y axis becomes inverted.

Returns

Vector2DInt

Returns the axes of an inverted vector.

RoundToInt(in Vector2D)

Converts a floating-point vector to an integer vector by performing a Round for each value.

public static Vector2DInt RoundToInt(in Vector2D a)

Parameters

a Vector2D

The vector that will be converted and rounded

Returns

Vector2DInt

Returns the converted and rounded vector

SqrMagnitude(in Vector2DInt)

Returns the squared length of this vector

public static int SqrMagnitude(in Vector2DInt a)

Parameters

a Vector2DInt

One of the values.

Returns

int

square length of the vector.

ToString()

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string

The fully qualified type name.

ToString(string)

Formats the value of the current instance using the specified format.

public readonly string ToString(string format)

Parameters

format string

The format to use.-or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

Returns

string

The value of the current instance in the specified format.

ToString(string, IFormatProvider)

Formats the value of the current instance using the specified format.

public readonly string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format to use.-or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.-or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.

Operators

operator +(Vector2DInt, Vector2DInt)

Addition operation between two values.(Vector2DInt + Vector2DInt)

public static Vector2DInt operator +(Vector2DInt a, Vector2DInt b)

Parameters

a Vector2DInt

First module.

b Vector2DInt

Second module.

Returns

Vector2DInt

The result of the addition.

operator /(Vector2DInt, Vector2DInt)

Division operation between two values.(Vector2DInt / Vector2DInt)

public static Vector2DInt operator /(Vector2DInt a, Vector2DInt b)

Parameters

a Vector2DInt

First module.

b Vector2DInt

Second module.

Returns

Vector2DInt

The result of the division.

operator /(Vector2DInt, int)

Division operation between two values.(Vector2DInt / int)

public static Vector2DInt operator /(Vector2DInt a, int b)

Parameters

a Vector2DInt

First module.

b int

Second module.

Returns

Vector2DInt

The result of the division.

operator ==(in Vector2DInt, in Vector2DInt)

Indicates whether this instance is equal to another instance of the same type.

public static bool operator ==(in Vector2DInt lhs, in Vector2DInt rhs)

Parameters

lhs Vector2DInt

Object to be compared.

rhs Vector2DInt

Object of comparison.

Returns

bool

Returns the result of the comparison.

explicit operator Vector2DInt(Vector2D)

Explicit conversion operator.(Vector2D to Vector2DInt)

public static explicit operator Vector2DInt(Vector2D v)

Parameters

v Vector2D

Object to be converted.

Returns

Vector2DInt

explicit operator Vector2DInt(Vector3D)

Explicit conversion operator.(Vector3D to Vector2DInt)

public static explicit operator Vector2DInt(Vector3D v)

Parameters

v Vector3D

Object to be converted.

Returns

Vector2DInt

explicit operator Vector2DInt(Vector4D)

Explicit conversion operator.(Vector4D to Vector2DInt)

public static explicit operator Vector2DInt(Vector4D v)

Parameters

v Vector4D

Object to be converted.

Returns

Vector2DInt

explicit operator Vector2DInt(Vector2)

Explicit conversion operator.(Godot.Vector2 to Vector2DInt)

public static explicit operator Vector2DInt(Vector2 v)

Parameters

v Vector2

Object to be converted.

Returns

Vector2DInt

implicit operator Vector2D(Vector2DInt)

Implicit conversion operator.(Vector2DInt to Vector2D)

public static implicit operator Vector2D(Vector2DInt v)

Parameters

v Vector2DInt

Object to be converted.

Returns

Vector2D

implicit operator Vector3D(Vector2DInt)

Implicit conversion operator.(Vector2DInt to Vector3D)

public static implicit operator Vector3D(Vector2DInt v)

Parameters

v Vector2DInt

Object to be converted.

Returns

Vector3D

implicit operator Vector3DInt(Vector2DInt)

Implicit conversion operator.(Vector2DInt to Vector3DInt)

public static implicit operator Vector3DInt(Vector2DInt v)

Parameters

v Vector2DInt

Object to be converted.

Returns

Vector3DInt

implicit operator Vector4D(Vector2DInt)

Implicit conversion operator.(Vector2DInt to Vector4D)

public static implicit operator Vector4D(Vector2DInt v)

Parameters

v Vector2DInt

Object to be converted.

Returns

Vector4D

implicit operator Vector2(Vector2DInt)

Implicit conversion operator.(Vector2DInt to Godot.Vector2)

public static implicit operator Vector2(Vector2DInt v)

Parameters

v Vector2DInt

Object to be converted.

Returns

Vector2

operator !=(in Vector2DInt, in Vector2DInt)

Indicates whether this instance is different from another instance of the same type.

public static bool operator !=(in Vector2DInt lhs, in Vector2DInt rhs)

Parameters

lhs Vector2DInt

Object to be compared.

rhs Vector2DInt

Object of comparison.

Returns

bool

Returns the result of the comparison.

operator *(Vector2DInt, Vector2DInt)

Multiplication operation between two values.(Vector2DInt * Vector2DInt)

public static Vector2DInt operator *(Vector2DInt a, Vector2DInt b)

Parameters

a Vector2DInt

First module.

b Vector2DInt

Second module.

Returns

Vector2DInt

The result of the multiplication.

operator *(Vector2DInt, int)

Multiplication operation between two values.(Vector2DInt * int)

public static Vector2DInt operator *(Vector2DInt a, int b)

Parameters

a Vector2DInt

First module.

b int

Second module.

Returns

Vector2DInt

The result of the multiplication.

operator -(Vector2DInt, Vector2DInt)

Subtraction operation between two values.(Vector2DInt - Vector2DInt)

public static Vector2DInt operator -(Vector2DInt a, Vector2DInt b)

Parameters

a Vector2DInt

First module.

b Vector2DInt

Second module.

Returns

Vector2DInt

The result of the subtraction.

operator -(Vector2DInt)

The operator allows us to reverse the value.

public static Vector2DInt operator -(Vector2DInt a)

Parameters

a Vector2DInt

Or value that will be invested.

Returns

Vector2DInt

Returns the result of the inversion.