Kaim::Vec3f Class Reference

Kaim::Vec3f Class Reference

#include <vec3f.h>

Class Description

Creation & Initialization

 Vec3f ()
 
 Vec3f (KyFloat32 _x, KyFloat32 _y, KyFloat32 _z)
 
 Vec3f (const KyFloat32 *coords)
 
 Vec3f (const Vec2f &v)
 
 Vec3f (const Vec2f &v, KyFloat32 _z)
 
void Set (KyFloat32 _x, KyFloat32 _y, KyFloat32 _z)
 
void Set (const KyFloat32 *coords)
 
void Set (const Vec2f &v)
 
void Set (const Vec2f &v, KyFloat32 _z)
 

Operators

KyFloat32operator[] (KyInt32 i)
 
KyFloat32 operator[] (KyInt32 i) const
 
bool operator== (const Vec3f &v) const
 
bool operator!= (const Vec3f &v) const
 
bool operator< (const Vec3f &v) const
 
bool operator> (const Vec3f &v) const
 
bool operator<= (const Vec3f &v) const
 
bool operator>= (const Vec3f &v) const
 
Vec3foperator*= (KyFloat32 s)
 
Vec3foperator/= (KyFloat32 d)
 
Vec3foperator+= (const Vec3f &v)
 
Vec3foperator-= (const Vec3f &v)
 
Vec3f operator* (KyFloat32 s) const
 
Vec3f operator/ (KyFloat32 d) const
 
Vec3f operator+ (const Vec3f &v) const
 
Vec3f operator- (const Vec3f &v) const
 
Vec3f operator- () const
 
KyFloat32 operator* (const Vec3f &v) const
 
Vec3f operator^ (const Vec3f &v) const
 

Operations with Vec2f

Vec3foperator+= (const Vec2f &v)
 
Vec3foperator-= (const Vec2f &v)
 
Vec3f operator+ (const Vec2f &v) const
 
Vec3f operator- (const Vec2f &v) const
 

Main interface

void Cross (const Vec3f &u, const Vec3f &v)
 
KyFloat32 GetSquareLength () const
 
KyFloat32 GetSquareLength2d () const
 
KyFloat32 GetLength () const
 
KyFloat32 GetLength2d () const
 
KyFloat32 Normalize ()
 
KyFloat32 GetNormalized (Vec3f &normalized) const
 
bool IsNormalized () const
 
Vec2f Get2d () const
 
KyFloat32 GetNormalized2d (Vec2f &normalized) const
 
bool IsZero () const
 

Static methods

static Vec3f Zero ()
 
static Vec3f UnitX ()
 
static Vec3f UnitY ()
 
static Vec3f UnitZ ()
 

Public Data Members

KyFloat32 x
 
KyFloat32 y
 
KyFloat32 z
 

Constructor & Destructor Documentation

Kaim::Vec3f::Vec3f ( )
inline

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

Kaim::Vec3f::Vec3f ( KyFloat32  _x,
KyFloat32  _y,
KyFloat32  _z 
)
inline

Creates a vector with the specified coordinates.

Kaim::Vec3f::Vec3f ( const KyFloat32 coords)
inlineexplicit

Creates a vector with the specified coordinates.

Parameters
coordsarray of coordinates {x, y, z}
Kaim::Vec3f::Vec3f ( const Vec2f v)
inlineexplicit

Creates a vector with provided Vec2f horizontal coordinates and z = 0.

Kaim::Vec3f::Vec3f ( const Vec2f v,
KyFloat32  _z 
)
inline

Creates a vector with provided Vec2f horizontal coordinates and the provided z.

Member Function Documentation

void Kaim::Vec3f::Cross ( const Vec3f u,
const Vec3f v 
)
inline

Calculates the cross product ofu and v, and stores the result in this vector.

Vec2f Kaim::Vec3f::Get2d ( ) const
inline

Returns a Vec2f that contains the X and Y coordinates of this vector. The Z coordinate is ignored.

KyFloat32 Kaim::Vec3f::GetLength ( ) const
inline

Returns the magnitude of the vector.

KyFloat32 Kaim::Vec3f::GetLength2d ( ) const
inline

Returns the magnitude of the vector on the plane of the (X,Y) axes.

KyFloat32 Kaim::Vec3f::GetNormalized ( Vec3f normalized) const
inline

Normalizes the vector, making it one unit in length without changing its orientation.

This method does not change this object. Instead, it stores the computed normal in the normalized parameter.

Parameters
[out]normalizedStores the normalized vector computed from this vector.
Returns
The magnitude of this vector before normalization.
KyFloat32 Kaim::Vec3f::GetNormalized2d ( Vec2f normalized) const
inline

Normalizes the (X,Y) coordinates of the vector, making it one unit in length without changing its orientation.

This method ignores the Z coordinate of the vector. This method does not change this object. Instead, it stores the computed normal in the normalized parameter.

Parameters
[out]normalizedStores the normalized vector computed from X and Y coordinates of this vector.
Returns
The magnitude of the vector on the plane of the (X,Y) axes before normalization.
+ Examples:
KyFloat32 Kaim::Vec3f::GetSquareLength ( ) const
inline

Returns the square of the magnitude of the vector.

+ Examples:
KyFloat32 Kaim::Vec3f::GetSquareLength2d ( ) const
inline

Returns the square of the magnitude of the vector on the plane of the (X,Y) axes.

bool Kaim::Vec3f::IsZero ( ) const
inline

Returns true if the X, Y and Z coordinates of this vector are all 0.

KyFloat32 Kaim::Vec3f::Normalize ( )
inline

Normalizes the vector, making it one unit in length without changing its orientation.

Returns
The previous magnitude of this vector before normalization.
+ Examples:
bool Kaim::Vec3f::operator!= ( const Vec3f v) const
inline

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

Vec3f Kaim::Vec3f::operator* ( KyFloat32  s) const
inline

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

KyFloat32 Kaim::Vec3f::operator* ( const Vec3f v) const
inline

Returns the dot product of this vector and v.

Vec3f& Kaim::Vec3f::operator*= ( KyFloat32  s)
inline

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

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

Vec3f Kaim::Vec3f::operator+ ( const Vec2f v) const
inline

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

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

Vec3f& Kaim::Vec3f::operator+= ( const Vec2f v)
inline

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

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

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

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

Vec3f Kaim::Vec3f::operator- ( const Vec2f v) const
inline

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

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

Vec3f& Kaim::Vec3f::operator-= ( const Vec2f v)
inline

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

Vec3f Kaim::Vec3f::operator/ ( KyFloat32  d) const
inline

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

Vec3f& Kaim::Vec3f::operator/= ( KyFloat32  d)
inline

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

bool Kaim::Vec3f::operator< ( const Vec3f 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::Vec3f::operator== ( const Vec3f v) const
inline

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

KyFloat32& Kaim::Vec3f::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.

KyFloat32 Kaim::Vec3f::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.

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

Returns the cross product of this vector and v.

void Kaim::Vec3f::Set ( KyFloat32  _x,
KyFloat32  _y,
KyFloat32  _z 
)
inline

Sets the coordinates.

+ Examples:
void Kaim::Vec3f::Set ( const KyFloat32 coords)
inline

Sets the coordinates.

Parameters
coordsarray of coordinates {x, y, z}
void Kaim::Vec3f::Set ( const Vec2f v)
inline

Sets x = v.x, y = v.y and z = 0.0f.

void Kaim::Vec3f::Set ( const Vec2f v,
KyFloat32  _z 
)
inline

Sets x = v.x, y = v.y and z = z.

static Vec3f Kaim::Vec3f::UnitX ( )
inlinestatic

Returns the normalized orientation of the X axis.

+ Examples:
static Vec3f Kaim::Vec3f::UnitY ( )
inlinestatic

Returns the normalized orientation of the Y axis.

static Vec3f Kaim::Vec3f::UnitZ ( )
inlinestatic

Returns the normalized orientation of the Z axis.

+ Examples:

Member Data Documentation

KyFloat32 Kaim::Vec3f::x

The size of the vector along the X axis.

+ Examples:
KyFloat32 Kaim::Vec3f::y

The size of the vector along the Y axis.

+ Examples:
KyFloat32 Kaim::Vec3f::z

The size of the vector along the Z axis.

+ Examples:

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