Kaim::Vec2i Class Reference

Kaim::Vec2i Class Reference

#include <vec2i.h>

Class Description

2d vector using KyInt32

+ Examples:

Inherited by Kaim::RasterPoint.

Functions

 Vec2i ()
 Constructs x=0.0f, y=0.0f. More...
 
 Vec2i (KyInt32 _x, KyInt32 _y)
 Constructs x=_x, y=_y. More...
 
 Vec2i (KyInt32 *coords)
 Constructs x=coords[0], y=coords[1]. More...
 
void Set (KyInt32 _x, KyInt32 _y)
 Sets x=_x and y=_y. More...
 
void Set (KyInt32 *coords)
 Sets x=coords[0], y=coords[1]. More...
 
void Clear ()
 Sets x = 0 and y = 0. More...
 

Operators

KyInt32operator[] (KyInt32 idx)
 
KyInt32 operator[] (KyInt32 idx) const
 
bool operator== (const Vec2i &v) const
 
bool operator!= (const Vec2i &v) const
 
bool operator< (const Vec2i &v) const
 x is compared first. ex: {1, 5} < {2, 0}. More...
 
bool operator<= (const Vec2i &v) const
 
bool operator> (const Vec2i &v) const
 
bool operator>= (const Vec2i &v) const
 
Vec2ioperator*= (KyInt32 s)
 
Vec2ioperator/= (KyInt32 d)
 
Vec2ioperator+= (const Vec2i &v)
 
Vec2ioperator-= (const Vec2i &v)
 
Vec2i operator* (KyInt32 s) const
 
Vec2i operator/ (KyInt32 d) const
 
Vec2i operator+ (const Vec2i &v) const
 
Vec2i operator- (const Vec2i &v) const
 
Vec2i operator- () const
 

SquareLength

KyInt64 SqLength () const
 
KyInt64 SqLength_15bits () const
 
bool IsZero () const
 

Offset

Vec2i OffsetX (KyInt32 dx) const
 Returns {x + dx, y}. More...
 
Vec2i OffsetY (KyInt32 dy) const
 Returns {x, y + dy}. More...
 
Vec2i Offset (KyInt32 dx, KyInt32 dy) const
 Returns {x + dx, y + dy}. More...
 

Rotation

Vec2i PerpCCW () const
 
Vec2i PerpCW () const
 

Side

KyInt64 Orient2d (const Vec2i &A, const Vec2i &B) const
 CrossProduct(MA, MB) where M=*this. More...
 
bool IsOnLeftSide (const Vec2i &A, const Vec2i &B) const
 
bool IsStrictlyOnLeftSide (const Vec2i &A, const Vec2i &B) const
 

IsInside

bool IsInsideTriangle (const Vec2i &A, const Vec2i &B, const Vec2i &C) const
 
bool IsInsideNotColinearTriangle (const Vec2i &A, const Vec2i &B, const Vec2i &C) const
 
bool IsStrictlyInsideTriangle (const Vec2i &A, const Vec2i &B, const Vec2i &C) const
 

Zero, Unit

static Vec2i Zero ()
 
static Vec2i UnitX ()
 
static Vec2i UnitY ()
 

Neighbors

Vec2i NeighborEast () const
 
Vec2i NeighborWest () const
 
Vec2i NeighborNorth () const
 
Vec2i NeighborSouth () const
 
void NeighborEast (Vec2i &neighbor) const
 
void NeighborWest (Vec2i &neighbor) const
 
void NeighborNorth (Vec2i &neighbor) const
 
void NeighborSouth (Vec2i &neighbor) const
 
Vec2i Neighbor (CardinalDir dir) const
 
void Neighbor (CardinalDir dir, Vec2i &neighbor) const
 
Vec2i NeighborNorthEast () const
 
Vec2i NeighborNorthWest () const
 
Vec2i NeighborSouthEast () const
 
Vec2i NeighborSouthWest () const
 

Data

KyInt32 x
 
KyInt32 y
 

Constructor & Destructor Documentation

Kaim::Vec2i::Vec2i ( )
inline

Constructs x=0.0f, y=0.0f.

Kaim::Vec2i::Vec2i ( KyInt32  _x,
KyInt32  _y 
)
inline

Constructs x=_x, y=_y.

Kaim::Vec2i::Vec2i ( KyInt32 coords)
inlineexplicit

Constructs x=coords[0], y=coords[1].

Member Function Documentation

void Kaim::Vec2i::Clear ( )
inline

Sets x = 0 and y = 0.

Vec2i Kaim::Vec2i::Offset ( KyInt32  dx,
KyInt32  dy 
) const
inline

Returns {x + dx, y + dy}.

Vec2i Kaim::Vec2i::OffsetX ( KyInt32  dx) const
inline

Returns {x + dx, y}.

Vec2i Kaim::Vec2i::OffsetY ( KyInt32  dy) const
inline

Returns {x, y + dy}.

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

x is compared first. ex: {1, 5} < {2, 0}.

KyInt64 Kaim::Vec2i::Orient2d ( const Vec2i A,
const Vec2i B 
) const
inline

CrossProduct(MA, MB) where M=*this.

void Kaim::Vec2i::Set ( KyInt32  _x,
KyInt32  _y 
)
inline

Sets x=_x and y=_y.

void Kaim::Vec2i::Set ( KyInt32 coords)
inline

Sets x=coords[0], y=coords[1].


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