Table of Contents

Struct IntVector2

Namespace
PAC.DataStructures

A struct to represent a 2-dimensional vector with integer coordinates.

public struct IntVector2
Inherited Members

Constructors

IntVector2(int, int)

public IntVector2(int x, int y)

Parameters

x int
y int

IntVector2(float, float)

Rounds the coords towards zero.

public IntVector2(float x, float y)

Parameters

x float
y float

IntVector2(Vector2)

Rounds the coords towards zero.

public IntVector2(Vector2 vector2)

Parameters

vector2 Vector2

Fields

down

The vector (0, -1).

public static IntVector2 down

Field Value

IntVector2

left

The vector (-1, 0).

public static IntVector2 left

Field Value

IntVector2

one

The vector (1, 1).

public static IntVector2 one

Field Value

IntVector2

right

The vector (1, 0).

public static IntVector2 right

Field Value

IntVector2

up

The vector (0, 1).

public static IntVector2 up

Field Value

IntVector2

x

public int x

Field Value

int

y

public int y

Field Value

int

zero

The vector (0, 0).

public static IntVector2 zero

Field Value

IntVector2

Properties

magnitude

public float magnitude { get; }

Property Value

float

squaredMagnitude

public float squaredMagnitude { get; }

Property Value

float

Methods

CeilToIntVector2(Vector2)

Ceils component-wise.

public static IntVector2 CeilToIntVector2(Vector2 vector2)

Parameters

vector2 Vector2

Returns

IntVector2

Distance(IntVector2, IntVector2)

Computes the Euclidean distance between the vectors.

public static float Distance(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

float

Dot(IntVector2, IntVector2)

Computes the dot product.

public static int Dot(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

int

Equals(object)

Indicates whether this instance and a specified object are equal.

public override 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.

FloorToIntVector2(Vector2)

Floors component-wise.

public static IntVector2 FloorToIntVector2(Vector2 vector2)

Parameters

vector2 Vector2

Returns

IntVector2

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

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

Magnitude(IntVector2)

public static float Magnitude(IntVector2 a)

Parameters

a IntVector2

Returns

float

Max(IntVector2, IntVector2)

Takes the maximum of a and b component-wise.

public static IntVector2 Max(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

IntVector2

Max(params IntVector2[])

Takes the maximum of the vectors component-wise.

public static IntVector2 Max(params IntVector2[] intVectors)

Parameters

intVectors IntVector2[]

Returns

IntVector2

Min(IntVector2, IntVector2)

Takes the minimum of a and b component-wise.

public static IntVector2 Min(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

IntVector2

Min(params IntVector2[])

Takes the minimum of the vectors component-wise.

public static IntVector2 Min(params IntVector2[] intVectors)

Parameters

intVectors IntVector2[]

Returns

IntVector2

RoundToIntVector2(Vector2)

Rounds component-wise.

public static IntVector2 RoundToIntVector2(Vector2 vector2)

Parameters

vector2 Vector2

Returns

IntVector2

SqrDistance(IntVector2, IntVector2)

public static float SqrDistance(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

float

SqrMagnitude(IntVector2)

public static float SqrMagnitude(IntVector2 a)

Parameters

a IntVector2

Returns

float

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToVector2()

Cast to Unity Vector2.

public Vector2 ToVector2()

Returns

Vector2

ToVector3()

Cast to Unity Vector3, with a 0 in the z-coord.

public Vector3 ToVector3()

Returns

Vector3

Operators

operator +(IntVector2, IntVector2)

Adds component-wise.

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

Parameters

a IntVector2
b IntVector2

Returns

IntVector2

operator +(IntVector2, IntVector2[])

Adds the vector to each element of the array.

public static IntVector2[] operator +(IntVector2 intVector, IntVector2[] intVectorArray)

Parameters

intVector IntVector2
intVectorArray IntVector2[]

Returns

IntVector2[]

operator +(IntVector2[], IntVector2)

Adds the vector to each element of the array.

public static IntVector2[] operator +(IntVector2[] intVectorArray, IntVector2 intVector)

Parameters

intVectorArray IntVector2[]
intVector IntVector2

Returns

IntVector2[]

operator /(IntVector2, IntVector2)

Divides (integer division) component-wise.

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

Parameters

a IntVector2
b IntVector2

Returns

IntVector2

operator /(IntVector2, IntVector2[])

Divides the vector by each element of the array.

public static IntVector2[] operator /(IntVector2 intVector, IntVector2[] intVectorArray)

Parameters

intVector IntVector2
intVectorArray IntVector2[]

Returns

IntVector2[]

operator /(IntVector2, int)

Divides (integer division) component-wise.

public static IntVector2 operator /(IntVector2 vector, int scalar)

Parameters

vector IntVector2
scalar int

Returns

IntVector2

operator /(IntVector2[], IntVector2)

Divides each element of the array by the vector.

public static IntVector2[] operator /(IntVector2[] intVectorArray, IntVector2 intVector)

Parameters

intVectorArray IntVector2[]
intVector IntVector2

Returns

IntVector2[]

operator ==(IntVector2, IntVector2)

public static bool operator ==(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

bool

operator >(IntVector2, IntVector2)

Compares component-wise.

public static bool operator >(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

bool

operator >=(IntVector2, IntVector2)

Compares component-wise.

public static bool operator >=(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

bool

implicit operator Vector2(IntVector2)

Cast to Unity Vector2.

public static implicit operator Vector2(IntVector2 intVector)

Parameters

intVector IntVector2

Returns

Vector2

implicit operator Vector3(IntVector2)

Cast to Unity Vector3, with a 0 in the z-coord.

public static implicit operator Vector3(IntVector2 intVector)

Parameters

intVector IntVector2

Returns

Vector3

operator !=(IntVector2, IntVector2)

public static bool operator !=(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

bool

operator <(IntVector2, IntVector2)

Compares component-wise.

public static bool operator <(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

bool

operator <=(IntVector2, IntVector2)

Compares component-wise.

public static bool operator <=(IntVector2 a, IntVector2 b)

Parameters

a IntVector2
b IntVector2

Returns

bool

operator *(IntVector2, IntVector2)

Multiplies component-wise.

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

Parameters

a IntVector2
b IntVector2

Returns

IntVector2

operator *(IntVector2, IntVector2[])

Multiplies each element of the array by the vector.

public static IntVector2[] operator *(IntVector2 intVector, IntVector2[] intVectorArray)

Parameters

intVector IntVector2
intVectorArray IntVector2[]

Returns

IntVector2[]

operator *(IntVector2, int)

Multiplies component-wise.

public static IntVector2 operator *(IntVector2 vector, int scalar)

Parameters

vector IntVector2
scalar int

Returns

IntVector2

operator *(IntVector2[], IntVector2)

Multiplies each element of the array by the vector.

public static IntVector2[] operator *(IntVector2[] intVectorArray, IntVector2 intVector)

Parameters

intVectorArray IntVector2[]
intVector IntVector2

Returns

IntVector2[]

operator *(int, IntVector2)

Multiplies component-wise.

public static IntVector2 operator *(int scalar, IntVector2 vector)

Parameters

scalar int
vector IntVector2

Returns

IntVector2

operator -(IntVector2, IntVector2)

Subtracts component-wise.

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

Parameters

a IntVector2
b IntVector2

Returns

IntVector2

operator -(IntVector2, IntVector2[])

Subtracts each element of the array from the vector.

public static IntVector2[] operator -(IntVector2 intVector, IntVector2[] intVectorArray)

Parameters

intVector IntVector2
intVectorArray IntVector2[]

Returns

IntVector2[]

operator -(IntVector2[], IntVector2)

Subtracts the vector from each element of the array.

public static IntVector2[] operator -(IntVector2[] intVectorArray, IntVector2 intVector)

Parameters

intVectorArray IntVector2[]
intVector IntVector2

Returns

IntVector2[]

operator -(IntVector2)

Negates component-wise.

public static IntVector2 operator -(IntVector2 a)

Parameters

a IntVector2

Returns

IntVector2