Kaim::Vec3i Class Reference

Kaim::Vec3i Class Reference

#include <vec3i.h>

Class Description

This class defines a three-dimensional vector whose coordinates are stored using 32-bit integers.

Creation & Initialization

 Vec3i ()
 
 Vec3i (KyInt32 _x, KyInt32 _y, KyInt32 _z)
 
 Vec3i (KyInt32 *coords)
 
void Set (KyInt32 _x, KyInt32 _y, KyInt32 _z)
 
void Set (const Vec2i &v, KyInt32 _z)
 
void Set (KyInt32 *coords)
 

Operators

KyInt32operator[] (KyInt32 i)
 
KyInt32 operator[] (KyInt32 i) const
 
bool operator== (const Vec3i &v) const
 
bool operator!= (const Vec3i &v) const
 
bool operator< (const Vec3i &v) const
 
Vec3ioperator*= (KyInt32 s)
 
Vec3ioperator/= (KyInt32 d)
 
Vec3ioperator+= (const Vec3i &v)
 
Vec3ioperator-= (const Vec3i &v)
 
Vec3i operator* (KyInt32 s) const
 
Vec3i operator/ (KyInt32 d) const
 
Vec3i operator+ (const Vec3i &v) const
 
Vec3i operator- (const Vec3i &v) const
 
Vec3i operator- () const
 
KyInt32 operator* (const Vec3i &v) const
 
Vec3i operator^ (const Vec3i &v) const
 

Main interface

KyInt32 Orient2d (const Vec3i &A, const Vec3i &B) const
 
bool IsOnLeftSide (const Vec3i &A, const Vec3i &B) const
 
bool IsStrictlyOnLeftSide (const Vec3i &A, const Vec3i &B) const
 
KyInt32 GetSquareLength () const
 

Static methods

static Vec3i UnitX ()
 
static Vec3i UnitY ()
 
static Vec3i UnitZ ()
 

Public Data Members

KyInt32 x
 
KyInt32 y
 
KyInt32 z
 

Constructor & Destructor Documentation

Kaim::Vec3i::Vec3i ( )
inline

Creates a vector with coordinates (0,0,0).

Kaim::Vec3i::Vec3i ( KyInt32  _x,
KyInt32  _y,
KyInt32  _z 
)
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.
_zThe size of the vector on the Z axis.
Kaim::Vec3i::Vec3i ( KyInt32 coords)
inlineexplicit

Creates a vector with the specified coordinates.

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

Member Function Documentation

KyInt32 Kaim::Vec3i::GetSquareLength ( ) const
inline

Returns the square of the magnitude of the vector.

bool Kaim::Vec3i::IsOnLeftSide ( const Vec3i A,
const Vec3i 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::Vec3i::IsStrictlyOnLeftSide ( const Vec3i A,
const Vec3i 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.

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

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

Vec3i Kaim::Vec3i::operator* ( KyInt32  s) const
inline

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

KyInt32 Kaim::Vec3i::operator* ( const Vec3i v) const
inline

Returns the dot product of this vector and v.

Vec3i& Kaim::Vec3i::operator*= ( KyInt32  s)
inline

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

Vec3i Kaim::Vec3i::operator+ ( const Vec3i v) const
inline

Adds the X coordinate of v to the X coordinate of this vector, adds the Y coordinate of v to the Y coordinate of this vector, and adds the Z coordinate of v to the Z coordinate of this vector.

Vec3i& Kaim::Vec3i::operator+= ( const Vec3i v)
inline

Adds the X coordinate of v to the X coordinate of this vector, adds the Y coordinate of v to the Y coordinate of this vector, and adds the Z coordinate of v to the Z coordinate of this vector.

Vec3i Kaim::Vec3i::operator- ( const Vec3i v) const
inline

Subtracts the X coordinate of v from the X coordinate of this vector, subtracts the Y coordinate of v from the Y coordinate of this vector, and subtracts the Z coordinate of v from the Z coordinate of this vector.

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

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

Vec3i& Kaim::Vec3i::operator-= ( const Vec3i v)
inline

Subtracts the X coordinate of v from the X coordinate of this vector, subtracts the Y coordinate of v from the Y coordinate of this vector, and subtracts the Z coordinate of v from the Z coordinate of this vector.

Vec3i Kaim::Vec3i::operator/ ( KyInt32  d) const
inline

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

Vec3i& Kaim::Vec3i::operator/= ( KyInt32  d)
inline

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

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

Returns true if the size of this vector along all three of the X, Y and Z axes is less than that of v.

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

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

KyInt32& Kaim::Vec3i::operator[] ( KyInt32  i)
inline

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

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

KyInt32 Kaim::Vec3i::operator[] ( KyInt32  i) const
inline

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

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

Vec3i Kaim::Vec3i::operator^ ( const Vec3i v) const
inline

Returns the cross product of this vector and v.

KyInt32 Kaim::Vec3i::Orient2d ( const Vec3i A,
const Vec3i B 
) const
inline

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.
void Kaim::Vec3i::Set ( KyInt32  _x,
KyInt32  _y,
KyInt32  _z 
)
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.
_zThe size of the vector on the Z axis.
void Kaim::Vec3i::Set ( const Vec2i v,
KyInt32  _z 
)
inline

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

Parameters
vA two-dimensional vector that specifies the size on the X and Y axes.
_zThe size of the vector on the Z axis.
void Kaim::Vec3i::Set ( KyInt32 coords)
inline

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

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

Returns the normalized orientation of the X axis.

static Vec3i Kaim::Vec3i::UnitY ( )
inlinestatic

Returns the normalized orientation of the Y axis.

static Vec3i Kaim::Vec3i::UnitZ ( )
inlinestatic

Returns the normalized orientation of the Y axis.

Member Data Documentation

KyInt32 Kaim::Vec3i::x

The size of the vector along the X axis.

KyInt32 Kaim::Vec3i::y

The size of the vector along the Y axis.

KyInt32 Kaim::Vec3i::z

The size of the vector along the Z axis.


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