A* Pathfinding Project  4.1.13
The A* Pathfinding Project for Unity 3D
Int2 Struct Reference

Two Dimensional Integer Coordinate Pair. More...

Detailed Description

Two Dimensional Integer Coordinate Pair.

Public Member Functions

 Int2 (int x, int y)
 
override bool Equals (System.Object o)
 
bool Equals (Int2 other)
 
override int GetHashCode ()
 
override string ToString ()
 

Static Public Member Functions

static long DotLong (Int2 a, Int2 b)
 Dot product of the two coordinates. More...
 
static Int2 FromInt3XZ (Int3 o)
 
static Int2 Max (Int2 a, Int2 b)
 
static Int2 Min (Int2 a, Int2 b)
 
static bool operator!= (Int2 a, Int2 b)
 
static Int2 operator+ (Int2 a, Int2 b)
 
static Int2 operator- (Int2 a, Int2 b)
 
static bool operator== (Int2 a, Int2 b)
 
static Int2 Rotate (Int2 v, int r)
 Returns a new Int2 rotated 90*r degrees around the origin. More...
 
static Int3 ToInt3XZ (Int2 o)
 

Public Attributes

int x
 
int y
 

Properties

long sqrMagnitudeLong [get]
 

Static Private Attributes

static readonly int [] Rotations
 Matrices for rotation. More...
 

Constructor & Destructor Documentation

◆ Int2()

Int2 ( int  x,
int  y 
)

Member Function Documentation

◆ DotLong()

static long DotLong ( Int2  a,
Int2  b 
)
static

Dot product of the two coordinates.

◆ Equals() [1/2]

override bool Equals ( System.Object  o)

◆ Equals() [2/2]

bool Equals ( Int2  other)

◆ FromInt3XZ()

static Int2 FromInt3XZ ( Int3  o)
static

◆ GetHashCode()

override int GetHashCode ( )

◆ Max()

static Int2 Max ( Int2  a,
Int2  b 
)
static

◆ Min()

static Int2 Min ( Int2  a,
Int2  b 
)
static

◆ operator!=()

static bool operator!= ( Int2  a,
Int2  b 
)
static

◆ operator+()

static Int2 operator+ ( Int2  a,
Int2  b 
)
static

◆ operator-()

static Int2 operator- ( Int2  a,
Int2  b 
)
static

◆ operator==()

static bool operator== ( Int2  a,
Int2  b 
)
static

◆ Rotate()

static Int2 Rotate ( Int2  v,
int  r 
)
static

Returns a new Int2 rotated 90*r degrees around the origin.

Deprecated:
Deprecated becuase it is not used by any part of the A* Pathfinding Project

◆ ToInt3XZ()

static Int3 ToInt3XZ ( Int2  o)
static

◆ ToString()

override string ToString ( )

Member Data Documentation

◆ Rotations

readonly int [] Rotations
staticprivate
Initial value:
= {
1, 0,
0, 1,
0, 1,
-1, 0,
-1, 0,
0, -1,
0, -1,
1, 0
}

Matrices for rotation.

Each group of 4 elements is a 2x2 matrix. The XZ position is multiplied by this. So

//A rotation by 90 degrees clockwise, second matrix in the array
(5,2) * ((0, 1), (-1, 0)) = (2,-5)

◆ x

int x

◆ y

int y

Property Documentation

◆ sqrMagnitudeLong

long sqrMagnitudeLong
get

The documentation for this struct was generated from the following file: