zenilib  0.5.3.0
Zeni::Vector3f Class Reference

A Featureful 3-Space Vector Class. More...

`#include <Vector3f.h>`

## Public Member Functions

Vector3f (const bool &degenerate_=false)
The best way to create a Vector3f. More...

Vector3f (const float &i_, const float &j_, const float &k_, const bool &degenerate_=false)

Vector3f (const Vector3f &rhs, const bool &degenerate_=false)

Vector3f (const Point3f &rhs)

Vector3f (const Vector2f &rhs)

float angle_between (const Vector3f &rhs) const
Find the angle between the Vector3fs. More...

Vector3f divide_by (const Vector3f &rhs) const
Divide corresponding members. More...

Vector3f get_i () const
Get just the i-part. More...

Vector3f get_ij () const
Get just the i and j parts. More...

Vector3f get_ik () const
Get just the i and k parts. More...

Vector3f get_j () const
Get just the j-part. More...

Vector3f get_jk () const
Get just the j and k parts. More...

Vector3f get_k () const
Get just the k-part. More...

float magnitude () const
Get the magnitude of the vector. More...

float magnitude2 () const
Get the 'magnitude squared' of the vector. More...

Vector3f multiply_by (const Vector3f &rhs) const
Multiply corresponding members. More...

Vector3fnormalize ()
Normalize the vector. More...

Vector3f normalized () const
Get the normalized vector. More...

Vector3f operator% (const Vector3f &rhs) const
Get the cross-product. More...

Vector3foperator%= (const Vector3f &rhs)
Set equal to the cross-product. More...

float operator* (const Vector3f &rhs) const
Get the dot-product. More...

Vector3f operator* (const float &rhs) const
Get the scalar multiple. More...

Vector3foperator*= (const float &rhs)
Set equal to the scalar multiple. More...

Vector3f operator+ (const Vector3f &rhs) const
Get the sum. More...

Vector3foperator+= (const Vector3f &rhs)
Set equal to the sum. More...

Vector3f operator- (const Vector3f &rhs) const
Get the difference. More...

Vector3f operator- () const
Get the negation. More...

Vector3foperator-= (const Vector3f &rhs)
Set equal to the difference. More...

Vector3f operator/ (const float &rhs) const
Get the scalar... something. More...

Vector3foperator/= (const float &rhs)
Set equal to the scalar something. More...

const float & operator[] (const int &index) const
Get 'index'. More...

float & operator[] (const int &index)
Get 'index'. More...

float phi () const
phi == radians down from k More...

void set_spherical (const float &theta, const float &phi, const float &magnitude=1)
Set the vector using spherical coordinates. More...

float theta () const
theta == radians north of vector i More...

union {
float   i

float   x

};

union {
float   j

float   y

};

union {
float   k

float   z

};

bool degenerate

## Detailed Description

A Featureful 3-Space Vector Class.

Vector3f provides everything you might expect from a specialized vector class: addition and subtraction, scalar multiplication, dot products, cross products, normalization functions, and a handful of useful constants.

Definition at line 58 of file Vector3f.h.

## Constructor & Destructor Documentation

 Zeni::Vector3f::Vector3f ( const bool & degenerate_ = `false` )
inlineexplicit

The best way to create a Vector3f.

Definition at line 33 of file Vector3f.hxx.

 Zeni::Vector3f::Vector3f ( const float & i_, const float & j_, const float & k_, const bool & degenerate_ = `false` )
inline

Definition at line 38 of file Vector3f.hxx.

 Zeni::Vector3f::Vector3f ( const Vector3f & rhs, const bool & degenerate_ = `false` )
inline

Definition at line 43 of file Vector3f.hxx.

 Zeni::Vector3f::Vector3f ( const Point3f & rhs )
inline

Definition at line 48 of file Vector3f.hxx.

 Zeni::Vector3f::Vector3f ( const Vector2f & rhs )
inlineexplicit

Definition at line 53 of file Vector3f.hxx.

## Member Function Documentation

 float Zeni::Vector3f::angle_between ( const Vector3f & rhs ) const
inline

Find the angle between the Vector3fs.

Definition at line 178 of file Vector3f.hxx.

References magnitude().

Referenced by Zeni::Quaternion::Forward_Up(), and Zeni::Quaternion::Vector3f_to_Vector3f().

 Vector3f Zeni::Vector3f::divide_by ( const Vector3f & rhs ) const
inline

Divide corresponding members.

Definition at line 174 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

Referenced by Zeni::Collision::nearest_point(), and Zeni::Projector3D::project().

 Vector3f Zeni::Vector3f::get_i ( ) const
inline

Get just the i-part.

Definition at line 146 of file Vector3f.hxx.

References i, and Vector3f().

 Vector3f Zeni::Vector3f::get_ij ( ) const
inline

Get just the i and j parts.

Definition at line 158 of file Vector3f.hxx.

References i, j, and Vector3f().

Referenced by Zeni::Camera::move_forward_xy(), and Zeni::Camera::move_left_xy().

 Vector3f Zeni::Vector3f::get_ik ( ) const
inline

Get just the i and k parts.

Definition at line 162 of file Vector3f.hxx.

References i, k, and Vector3f().

 Vector3f Zeni::Vector3f::get_j ( ) const
inline

Get just the j-part.

Definition at line 150 of file Vector3f.hxx.

References j, and Vector3f().

 Vector3f Zeni::Vector3f::get_jk ( ) const
inline

Get just the j and k parts.

Definition at line 166 of file Vector3f.hxx.

References j, k, and Vector3f().

 Vector3f Zeni::Vector3f::get_k ( ) const
inline

Get just the k-part.

Definition at line 154 of file Vector3f.hxx.

References k, and Vector3f().

 float Zeni::Vector3f::magnitude ( ) const
inline

Get the magnitude of the vector.

Definition at line 142 of file Vector3f.hxx.

References magnitude2().

 float Zeni::Vector3f::magnitude2 ( ) const
inline

Get the 'magnitude squared' of the vector.

Definition at line 138 of file Vector3f.hxx.

References i, j, and k.

Referenced by magnitude().

 Vector3f Zeni::Vector3f::multiply_by ( const Vector3f & rhs ) const
inline

Multiply corresponding members.

Definition at line 170 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

Referenced by Zeni::Model::get_position().

 Vector3f & Zeni::Vector3f::normalize ( )

Normalize the vector.

Definition at line 39 of file Vector3f.cpp.

References degenerate, i, INFINTESSIMAL, j, k, and magnitude().

 Vector3f Zeni::Vector3f::normalized ( ) const

Get the normalized vector.

Definition at line 58 of file Vector3f.cpp.

References i, INFINTESSIMAL, j, k, magnitude(), and Vector3f().

 Vector3f Zeni::Vector3f::operator% ( const Vector3f & rhs ) const
inline

Get the cross-product.

Definition at line 95 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

 Vector3f & Zeni::Vector3f::operator%= ( const Vector3f & rhs )
inline

Set equal to the cross-product.

Definition at line 102 of file Vector3f.hxx.

References degenerate.

 float Zeni::Vector3f::operator* ( const Vector3f & rhs ) const
inline

Get the dot-product.

Definition at line 88 of file Vector3f.hxx.

References i, j, and k.

 Vector3f Zeni::Vector3f::operator* ( const float & rhs ) const
inline

Get the scalar multiple.

Definition at line 107 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

 Vector3f & Zeni::Vector3f::operator*= ( const float & rhs )
inline

Set equal to the scalar multiple.

Definition at line 115 of file Vector3f.hxx.

References i, j, and k.

 Vector3f Zeni::Vector3f::operator+ ( const Vector3f & rhs ) const
inline

Get the sum.

Definition at line 58 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

 Vector3f & Zeni::Vector3f::operator+= ( const Vector3f & rhs )
inline

Set equal to the sum.

Definition at line 72 of file Vector3f.hxx.

References degenerate, i, j, and k.

 Vector3f Zeni::Vector3f::operator- ( const Vector3f & rhs ) const
inline

Get the difference.

Definition at line 65 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

 Vector3f Zeni::Vector3f::operator- ( ) const
inline

Get the negation.

Definition at line 129 of file Vector3f.hxx.

 Vector3f & Zeni::Vector3f::operator-= ( const Vector3f & rhs )
inline

Set equal to the difference.

Definition at line 80 of file Vector3f.hxx.

References degenerate, i, j, and k.

 Vector3f Zeni::Vector3f::operator/ ( const float & rhs ) const
inline

Get the scalar... something.

Definition at line 111 of file Vector3f.hxx.

References degenerate, i, j, k, and Vector3f().

 Vector3f & Zeni::Vector3f::operator/= ( const float & rhs )
inline

Set equal to the scalar something.

Definition at line 122 of file Vector3f.hxx.

References i, j, and k.

 const float & Zeni::Vector3f::operator[] ( const int & index ) const
inline

Get 'index'.

Definition at line 186 of file Vector3f.hxx.

References assert, and i.

 float & Zeni::Vector3f::operator[] ( const int & index )
inline

Get 'index'.

Definition at line 192 of file Vector3f.hxx.

References assert, and i.

 float Zeni::Vector3f::phi ( ) const

phi == radians down from k

Definition at line 81 of file Vector3f.cpp.

References atan(), i, j, k, Zeni::Global::pi, and Zeni::Global::pi_over_two.

Referenced by Zeni::render_image().

 void Zeni::Vector3f::set_spherical ( const float & theta, const float & phi, const float & magnitude = `1` )

Set the vector using spherical coordinates.

Definition at line 93 of file Vector3f.cpp.

References cos(), degenerate, i, j, k, magnitude(), and sin().

Referenced by Zeni::render_image().

 float Zeni::Vector3f::theta ( ) const

theta == radians north of vector i

Definition at line 69 of file Vector3f.cpp.

References atan(), i, j, Zeni::Global::pi, Zeni::Global::pi_over_two, and Zeni::Global::three_pi_over_two.

Referenced by Zeni::render_image().

## Member Data Documentation

 union { ... }
 union { ... }
 union { ... }
 bool Zeni::Vector3f::degenerate

Definition at line 123 of file Vector3f.h.

 float Zeni::Vector3f::x

Definition at line 112 of file Vector3f.h.

 float Zeni::Vector3f::y

Definition at line 116 of file Vector3f.h.

 float Zeni::Vector3f::z

Definition at line 120 of file Vector3f.h.

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