Kaim::Vec2i Class Reference
#include <vec2i.h>
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers.
This class is typically used to identify a cell within a regular two-dimensional grid.
Inherited by Kaim::RasterPoint.
Creates a vector with coordinates (0,0).
Creates a vector with the specified coordinates.
- Parameters
-
_x | The size of the vector on the X axis. |
_y | The size of the vector on the Y axis. |
Kaim::Vec2i::Vec2i |
( |
KyInt32 * |
coords | ) |
|
|
inlineexplicit |
Creates a vector with the specified coordinates.
- Parameters
-
coords | An array of two integers that contains the size of the vector along the X and Y axes respectively. |
Returns the magnitude on the Z axis of the cross product between this vector and v.
KyInt32 Kaim::Vec2i::GetSquareLength |
( |
| ) |
const |
|
inline |
Returns the square of the magnitude of the vector.
bool Kaim::Vec2i::IsInsideNotColinearTriangle |
( |
const Vec2i & |
A, |
|
|
const Vec2i & |
B, |
|
|
const Vec2i & |
C |
|
) |
| const |
|
inline |
Returns true if this vector is inside the clockwise triangle formed by theA,B and C parameters, or if this vector is on any edge between A,B and C.
This method assumes that the three points that make up the triangle are not colinear: i.e. they do not lie all in a straight line.
bool Kaim::Vec2i::IsInsideTriangle |
( |
const Vec2i & |
A, |
|
|
const Vec2i & |
B, |
|
|
const Vec2i & |
C |
|
) |
| const |
|
inline |
Returns true if this vector is inside the clockwise triangle formed by theA,B and C parameters, or if this vector is on any edge between A,B and C.
bool Kaim::Vec2i::IsOnLeftSide |
( |
const Vec2i & |
A, |
|
|
const Vec2i & |
B |
|
) |
| const |
|
inline |
Returns true if this vector is on the left side when moving from A to B, or if this vector is on the line between A and B.
bool Kaim::Vec2i::IsStrictlyInsideTriangle |
( |
const Vec2i & |
A, |
|
|
const Vec2i & |
B, |
|
|
const Vec2i & |
C |
|
) |
| const |
|
inline |
Returns true if this vector is inside the clockwise triangle formed by theA,B and C parameters, but not on any edge between A,B andC.
bool Kaim::Vec2i::IsStrictlyOnLeftSide |
( |
const Vec2i & |
A, |
|
|
const Vec2i & |
B |
|
) |
| const |
|
inline |
Returns true if this vector is on the left side when moving from A to B, but not if this vector is on the line between A and B.
Returns a vector that identifies the next grid cell in the direction of the specified CardinalDir.
Set the neighbor vector coordinates to identify the next grid cell in the direction of the specified CardinalDir.
Vec2i Kaim::Vec2i::NeighborEast |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the East: i.e. in the positive direction of the X axis.
void Kaim::Vec2i::NeighborEast |
( |
Vec2i & |
neighbor | ) |
const |
|
inline |
Set theneighbor vector coordinates to identify the next grid cell to the East: i.e. in the positive direction of the X axis.
Vec2i Kaim::Vec2i::NeighborNorth |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the North: i.e. in the positive direction of the Y axis.
void Kaim::Vec2i::NeighborNorth |
( |
Vec2i & |
neighbor | ) |
const |
|
inline |
Set theneighbor vector coordinates to identify the next grid cell to the North: i.e. in the positive direction of the Y axis.
Vec2i Kaim::Vec2i::NeighborNorthEast |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the North-East: i.e.
in the positive direction of the X and Y axes.
Vec2i Kaim::Vec2i::NeighborNorthWest |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the North-West: i.e.
in the positive direction of the Y axis and the negative direction of the X axis.
Vec2i Kaim::Vec2i::NeighborSouth |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the South: i.e. in the negative direction of the Y axis.
void Kaim::Vec2i::NeighborSouth |
( |
Vec2i & |
neighbor | ) |
const |
|
inline |
Set theneighbor vector coordinates to identify the next grid cell to the South: i.e. in the negative direction of the Y axis.
Vec2i Kaim::Vec2i::NeighborSouthEast |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the South-East: i.e.
in the positive direction of the X axis and the negative direction of the Y axis.
Vec2i Kaim::Vec2i::NeighborSouthWest |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the South-West: i.e.
in the negative direction of the X and Y axes.
Vec2i Kaim::Vec2i::NeighborWest |
( |
| ) |
const |
|
inline |
Returns a vector that identifies the next grid cell to the West: i.e. in the negative direction of the X axis.
void Kaim::Vec2i::NeighborWest |
( |
Vec2i & |
neighbor | ) |
const |
|
inline |
Set theneighbor vector coordinates to identify the next grid cell to the West: i.e. in the negative direction of the X axis.
bool Kaim::Vec2i::operator!= |
( |
const Vec2i & |
v | ) |
const |
|
inline |
Returns true if this object contains at least one different coordinate from v.
Multiplies both the X and Y coordinates of the vector by the specified value.
Returns the dot product of this vector and v.
Multiplies both the X and Y coordinates of this vector by the specified value.
Vec2i Kaim::Vec2i::operator+ |
( |
const Vec2i & |
v | ) |
const |
|
inline |
Adds the X coordinate of v to the X coordinate of this vector, and adds the Y coordinate of v to the Y coordinate of this vector.
Addst to both the X and Y coordinates of this vector.
Adds the X coordinate of v to the X coordinate of this vector, and adds the Y coordinate of v to the Y coordinate of this vector.
Vec2i Kaim::Vec2i::operator- |
( |
const Vec2i & |
v | ) |
const |
|
inline |
Subtracts the X coordinate of v from the X coordinate of this vector, and subtracts the Y coordinate of v from the Y coordinate of this vector.
Vec2i Kaim::Vec2i::operator- |
( |
| ) |
const |
|
inline |
Negates the X and Y coordinates of this vector, effectively flipping it around the origin.
Subtractst from both the X and Y coordinates of this vector.
Subtracts the X coordinate of v from the X coordinate of this vector, and subtracts the Y coordinate of v from the Y coordinate of this vector.
Divides both the X and Y coordinates of the vector by the specified value.
Divides both the X and Y coordinates of this vector by the specified value.
bool Kaim::Vec2i::operator< |
( |
const Vec2i & |
v | ) |
const |
|
inline |
order by x first: (1,9)<(2,8).
bool Kaim::Vec2i::operator<= |
( |
const Vec2i & |
v | ) |
const |
|
inline |
order by x first: (1,9)<=(2,8).
bool Kaim::Vec2i::operator== |
( |
const Vec2i & |
v | ) |
const |
|
inline |
Returns true if this object contains the same coordinates as v.
bool Kaim::Vec2i::operator> |
( |
const Vec2i & |
v | ) |
const |
|
inline |
order by x first: (2,8)>(1,9).
bool Kaim::Vec2i::operator>= |
( |
const Vec2i & |
v | ) |
const |
|
inline |
order by x first: (2,8)>=(1,9).
Retrieves the size of the vector around one of its axes.
Use [0] for the X axis, or [1] for the Y axis.
Retrieves the size of the vector around one of its axes.
Use [0] for the X axis, or [1] for the Y axis. Non-const and returned as a reference to allow modification of the member.
Returns the magnitude on the Z axis of the cross product between this vector and v.
Indicates whether or not the polyline formed by (A to B to this vector ) outlines a triangle in counter-clockwise order when seen from above.
- Returns
- Twice the area of the triangle outlined by (A to B to this vector ).
- If this value is positive, (A to B to this vector ) outlines a triangle in counter-clockwise order.
- If this value is negative, (A to B to this vector ) outlines a triangle in clockwise order.
- If this value is 0, then A,B and this vector are all colinear.
Vec2i Kaim::Vec2i::PerpCCW |
( |
| ) |
const |
|
inline |
Rotates this vector 90 degrees counter-clockwise (negating the Y coordinate).
Vec2i Kaim::Vec2i::PerpCW |
( |
| ) |
const |
|
inline |
Rotates this vector 90 degrees clockwise (negating the X coordinate).
Sets the coordinates of the vector to match the specified values.
- Parameters
-
_x | The size of the vector on the X axis. |
_y | The size of the vector on the Y axis. |
void Kaim::Vec2i::Set |
( |
KyInt32 * |
coords | ) |
|
|
inline |
Sets the coordinates of the vector to match the specified values.
- Parameters
-
coords | An array of two floating-point numbers that contains the size of the vector along the X and Y axes respectively. |
static Vec2i Kaim::Vec2i::UnitX |
( |
| ) |
|
|
inlinestatic |
Returns the normalized orientation of the X axis.
static Vec2i Kaim::Vec2i::UnitY |
( |
| ) |
|
|
inlinestatic |
Returns the normalized orientation of the Y axis.
The size of the vector along the X axis.
The size of the vector along the Y axis.
The documentation for this class was generated from the following file: