Kaim::Vec2LL Class Reference

Kaim::Vec2LL Class Reference

#include <vec2ll.h>

Class Description

This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers.

This class is typically used to identify a cell within a regular two-dimensional grid.

Creation & Initialization

 Vec2LL ()
 
 Vec2LL (KyInt64 _x, KyInt64 _y)
 
 Vec2LL (KyInt64 *coords)
 
void Set (KyInt64 _x, KyInt64 _y)
 
void Set (KyInt64 *coords)
 

Operators

KyInt64 operator[] (KyInt64 idx) const
 
KyInt64operator[] (KyInt64 idx)
 
bool operator== (const Vec2LL &v) const
 
bool operator!= (const Vec2LL &v) const
 
bool operator< (const Vec2LL &v) const
 
Vec2LLoperator*= (KyInt64 s)
 
Vec2LLoperator/= (KyInt64 d)
 
Vec2LLoperator+= (KyInt64 t)
 
Vec2LLoperator-= (KyInt64 t)
 
Vec2LLoperator+= (const Vec2LL &v)
 
Vec2LLoperator-= (const Vec2LL &v)
 
Vec2LL operator* (KyInt64 s) const
 
Vec2LL operator/ (KyInt64 d) const
 
Vec2LL operator+ (const Vec2LL &v) const
 
Vec2LL operator- (const Vec2LL &v) const
 
Vec2LL operator- () const
 
KyInt64 operator* (const Vec2LL &v) const
 
KyInt64 operator^ (const Vec2LL &v) const
 

Main interface

KyInt64 CrossProd (const Vec2LL &v) const
 
KyInt64 GetSquareLength () const
 
Vec2LL PerpCCW () const
 
Vec2LL PerpCW () const
 
void SetAdditionResult (const Vec2LL &v1, const Vec2LL &v2)
 

Static methods

static Vec2LL UnitX ()
 
static Vec2LL UnitY ()
 

Public Data Members

KyInt64 x
 
KyInt64 y
 

Constructor & Destructor Documentation

Kaim::Vec2LL::Vec2LL ( )
inline

Creates a vector with coordinates (0,0).

Kaim::Vec2LL::Vec2LL ( KyInt64  _x,
KyInt64  _y 
)
inline

Creates a vector with the specified coordinates.

Parameters
_xThe size of the vector on the X axis.
_yThe size of the vector on the Y axis.
Kaim::Vec2LL::Vec2LL ( KyInt64 coords)
inlineexplicit

Creates a vector with the specified coordinates.

Parameters
coordsAn array of two integers that contains the size of the vector along the X and Y axes respectively.

Member Function Documentation

KyInt64 Kaim::Vec2LL::CrossProd ( const Vec2LL v) const
inline

Returns the magnitude on the Z axis of the cross product between this vector and v.

KyInt64 Kaim::Vec2LL::GetSquareLength ( ) const
inline

Returns the square of the magnitude of the vector.

bool Kaim::Vec2LL::operator!= ( const Vec2LL v) const
inline

Returns true if this object contains at least one different coordinate from v.

Vec2LL Kaim::Vec2LL::operator* ( KyInt64  s) const
inline

Multiplies both the X and Y coordinates of the vector by the specified value.

KyInt64 Kaim::Vec2LL::operator* ( const Vec2LL v) const
inline

Returns the dot product of this vector and v.

Vec2LL& Kaim::Vec2LL::operator*= ( KyInt64  s)
inline

Multiplies both the X and Y coordinates of this vector by the specified value.

Vec2LL Kaim::Vec2LL::operator+ ( const Vec2LL 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.

Vec2LL& Kaim::Vec2LL::operator+= ( KyInt64  t)
inline

Addst to both the X and Y coordinates of this vector.

Vec2LL& Kaim::Vec2LL::operator+= ( const Vec2LL v)
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.

Vec2LL Kaim::Vec2LL::operator- ( const Vec2LL 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.

Vec2LL Kaim::Vec2LL::operator- ( ) const
inline

Negates the X and Y coordinates of this vector, effectively flipping it around the origin.

Vec2LL& Kaim::Vec2LL::operator-= ( KyInt64  t)
inline

Subtractst from both the X and Y coordinates of this vector.

Vec2LL& Kaim::Vec2LL::operator-= ( const Vec2LL v)
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.

Vec2LL Kaim::Vec2LL::operator/ ( KyInt64  d) const
inline

Divides both the X and Y coordinates of the vector by the specified value.

Vec2LL& Kaim::Vec2LL::operator/= ( KyInt64  d)
inline

Divides both the X and Y coordinates of this vector by the specified value.

bool Kaim::Vec2LL::operator< ( const Vec2LL v) const
inline

Returns true if the size of this vector along both the X and Y axes is less than that of v.

bool Kaim::Vec2LL::operator== ( const Vec2LL v) const
inline

Returns true if this object contains the same coordinates as v.

KyInt64 Kaim::Vec2LL::operator[] ( KyInt64  idx) const
inline

Retrieves the size of the vector around one of its axes.

Use [0] for the X axis, or [1] for the Y axis.

KyInt64& Kaim::Vec2LL::operator[] ( KyInt64  idx)
inline

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.

KyInt64 Kaim::Vec2LL::operator^ ( const Vec2LL v) const
inline

Returns the magnitude on the Z axis of the cross product between this vector and v.

Vec2LL Kaim::Vec2LL::PerpCCW ( ) const
inline

Rotates this vector 90 degrees counter-clockwise (negating the Y coordinate).

Vec2LL Kaim::Vec2LL::PerpCW ( ) const
inline

Rotates this vector 90 degrees clockwise (negating the X coordinate).

void Kaim::Vec2LL::Set ( KyInt64  _x,
KyInt64  _y 
)
inline

Sets the coordinates of the vector to match the specified values.

Parameters
_xThe size of the vector on the X axis.
_yThe size of the vector on the Y axis.
void Kaim::Vec2LL::Set ( KyInt64 coords)
inline

Sets the coordinates of the vector to match the specified values.

Parameters
coordsAn array of two floating-point numbers that contains the size of the vector along the X and Y axes respectively.
static Vec2LL Kaim::Vec2LL::UnitX ( )
inlinestatic

Returns the normalized orientation of the X axis.

static Vec2LL Kaim::Vec2LL::UnitY ( )
inlinestatic

Returns the normalized orientation of the Y axis.

Member Data Documentation

KyInt64 Kaim::Vec2LL::x

The size of the vector along the X axis.

KyInt64 Kaim::Vec2LL::y

The size of the vector along the Y axis.


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