A* Pathfinding Project  4.2.6
The A* Pathfinding Project for Unity 3D
Int3 Struct Reference

Holds a coordinate in integers. More...

Detailed Description

Holds a coordinate in integers.

Public Member Functions

 Int3 (Vector3 position)
 
 Int3 (int _x, int _y, int _z)
 
override bool Equals (System.Object obj)
 
bool Equals (Int3 other)
 
override int GetHashCode ()
 
Int3 Normal2D ()
 Normal in 2D space (XZ). More...
 
override string ToString ()
 Returns a nicely formatted string representing the vector. More...
 

Static Public Member Functions

static float Angle (Int3 lhs, Int3 rhs)
 Angle between the vectors in radians. More...
 
static int Dot (Int3 lhs, Int3 rhs)
 
static long DotLong (Int3 lhs, Int3 rhs)
 
static operator Int3 (Vector3 ob)
 
static implicit operator string (Int3 obj)
 
static operator Vector3 (Int3 ob)
 
static bool operator!= (Int3 lhs, Int3 rhs)
 
static Int3 operator* (Int3 lhs, int rhs)
 
static Int3 operator* (Int3 lhs, float rhs)
 
static Int3 operator* (Int3 lhs, double rhs)
 
static Int3 operator+ (Int3 lhs, Int3 rhs)
 
static Int3 operator- (Int3 lhs, Int3 rhs)
 
static Int3 operator- (Int3 lhs)
 
static Int3 operator/ (Int3 lhs, float rhs)
 
static bool operator== (Int3 lhs, Int3 rhs)
 

Public Attributes

const float FloatPrecision = 1000F
 Precision as a float More...
 
const int Precision = 1000
 Precision for the integer coordinates. More...
 
const float PrecisionFactor = 0.001F
 1 divided by Precision More...
 
int x
 
int y
 
int z
 

Properties

int costMagnitude [get]
 Magnitude used for the cost between two nodes. More...
 
float magnitude [get]
 Returns the magnitude of the vector. More...
 
float sqrMagnitude [get]
 The squared magnitude of the vector. More...
 
long sqrMagnitudeLong [get]
 The squared magnitude of the vector. More...
 
int this[int i] [get, set]
 
static Int3 zero [get]
 

Constructor & Destructor Documentation

◆ Int3() [1/2]

Int3 ( Vector3  position)

◆ Int3() [2/2]

Int3 ( int  _x,
int  _y,
int  _z 
)

Member Function Documentation

◆ Angle()

static float Angle ( Int3  lhs,
Int3  rhs 
)
static

Angle between the vectors in radians.

◆ Dot()

static int Dot ( Int3  lhs,
Int3  rhs 
)
static

◆ DotLong()

static long DotLong ( Int3  lhs,
Int3  rhs 
)
static

◆ Equals() [1/2]

override bool Equals ( System.Object  obj)

◆ Equals() [2/2]

bool Equals ( Int3  other)

◆ GetHashCode()

override int GetHashCode ( )

◆ Normal2D()

Int3 Normal2D ( )

Normal in 2D space (XZ).

Equivalent to Cross(this, Int3(0,1,0) ) except that the Y coordinate is left unchanged with this operation.

◆ operator Int3()

static operator Int3 ( Vector3  ob)
explicitstatic

◆ operator string()

static implicit operator string ( Int3  obj)
static

◆ operator Vector3()

static operator Vector3 ( Int3  ob)
explicitstatic

◆ operator!=()

static bool operator!= ( Int3  lhs,
Int3  rhs 
)
static

◆ operator*() [1/3]

static Int3 operator* ( Int3  lhs,
int  rhs 
)
static

◆ operator*() [2/3]

static Int3 operator* ( Int3  lhs,
float  rhs 
)
static

◆ operator*() [3/3]

static Int3 operator* ( Int3  lhs,
double  rhs 
)
static

◆ operator+()

static Int3 operator+ ( Int3  lhs,
Int3  rhs 
)
static

◆ operator-() [1/2]

static Int3 operator- ( Int3  lhs,
Int3  rhs 
)
static

◆ operator-() [2/2]

static Int3 operator- ( Int3  lhs)
static

◆ operator/()

static Int3 operator/ ( Int3  lhs,
float  rhs 
)
static

◆ operator==()

static bool operator== ( Int3  lhs,
Int3  rhs 
)
static

◆ ToString()

override string ToString ( )

Returns a nicely formatted string representing the vector.

Member Data Documentation

◆ FloatPrecision

const float FloatPrecision = 1000F

Precision as a float

◆ Precision

const int Precision = 1000

Precision for the integer coordinates.

One world unit is divided into [value] pieces. A value of 1000 would mean millimeter precision, a value of 1 would mean meter precision (assuming 1 world unit = 1 meter). This value affects the maximum coordinates for nodes as well as how large the cost values are for moving between two nodes. A higher value means that you also have to set all penalty values to a higher value to compensate since the normal cost of moving will be higher.

◆ PrecisionFactor

const float PrecisionFactor = 0.001F

1 divided by Precision

◆ x

int x

◆ y

int y

◆ z

int z

Property Documentation

◆ costMagnitude

int costMagnitude
get

Magnitude used for the cost between two nodes.

The default cost between two nodes can be calculated like this:

int cost = (node1.position-node2.position).costMagnitude;

This is simply the magnitude, rounded to the nearest integer

◆ magnitude

float magnitude
get

Returns the magnitude of the vector.

The magnitude is the 'length' of the vector from 0,0,0 to this point. Can be used for distance calculations:

Debug.Log ("Distance between 3,4,5 and 6,7,8 is: "+(new Int3(3,4,5) - new Int3(6,7,8)).magnitude);

◆ sqrMagnitude

float sqrMagnitude
get

The squared magnitude of the vector.

◆ sqrMagnitudeLong

long sqrMagnitudeLong
get

The squared magnitude of the vector.

◆ this[int i]

int this[int i]
getset

◆ zero

Int3 zero
staticget

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