zenilib: Zeni::Vector3f Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
Zeni::Vector3f Class Reference
Zenilib

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...
Vector3f & | normalize ()
| Normalize the vector. More...
Vector3f | normalized () const
| Get the normalized vector. More...
Vector3f | operator% (const Vector3f &rhs) const
| Get the cross-product. More...
Vector3f & | operator%= (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...
Vector3f & | operator*= (const float &rhs)
| Set equal to the scalar multiple. More...
Vector3f | operator+ (const Vector3f &rhs) const
| Get the sum. More...
Vector3f & | operator+= (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...
Vector3f & | operator-= (const Vector3f &rhs)
| Set equal to the difference. More...
Vector3f | operator/ (const float &rhs) const
| Get the scalar... something. More...
Vector3f & | operator/= (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...

## Public Attributes

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.

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

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.

Referenced by divide_by(), get_i(), get_ij(), get_ik(), get_j(), get_jk(), get_k(), multiply_by(), normalized(), operator%(), operator*(), operator+(), operator-(), and operator/().

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().

Referenced by angle_between(), Zeni::Collision::nearest_point(), normalize(), normalized(), Zeni::render_image(), set_spherical(), Zeni::Collision::Plane::shortest_distance(), and Zeni::Collision::Parallelepiped::shortest_distance().

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().

Referenced by Zeni::Quaternion::Axis_Angle(), Zeni::Camera::move_forward_xy(), Zeni::Camera::move_left_xy(), Zeni::Widget_Renderer_Slider::render_to(), and Zeni::Matrix4f::View().

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.

Referenced by Zeni::Quaternion::Axis_Angle(), divide_by(), multiply_by(), normalize(), operator%(), operator%=(), operator*(), Zeni::Quaternion::operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), and set_spherical().

float Zeni::Vector3f::i

Definition at line 111 of file Vector3f.h.

Referenced by divide_by(), get_i(), get_ij(), get_ik(), Zeni::Quaternion::get_matrix(), magnitude2(), Zeni::Matrix4f::Matrix4f(), multiply_by(), Zeni::Collision::nearest_point(), normalize(), normalized(), operator%(), operator*(), Zeni::Quaternion::operator*(), Zeni::Matrix4f::operator*(), operator*=(), operator+(), Zeni::Point3f::operator+(), operator+=(), Zeni::Point3f::operator+=(), operator-(), Zeni::Point3f::operator-(), operator-=(), Zeni::Point3f::operator-=(), operator/(), operator/=(), operator[](), Zeni::Collision::Parallelepiped::Parallelepiped(), phi(), Zeni::Quaternion::Quaternion(), Zeni::Video_GL_Shader::rotate_scene(), Zeni::Video_GL_Fixed::rotate_scene(), Zeni::Matrix4f::Scale(), Zeni::Video_GL_Fixed::scale_scene(), Zeni::Video_GL_Shader::scale_scene(), Zeni::Video_DX9::scale_scene(), Zeni::serialize(), Zeni::Sound_Renderer_AL::set_listener_forward_and_up(), Zeni::Sound_Renderer_AL::set_listener_velocity(), set_spherical(), theta(), Zeni::Matrix4f::Translate(), Zeni::Video_GL_Fixed::translate_scene(), Zeni::Video_GL_Shader::translate_scene(), Zeni::Video_DX9::translate_scene(), Zeni::unserialize(), Zeni::Quaternion::Vector3f_to_Vector3f(), and Zeni::Matrix4f::View().

float Zeni::Vector3f::j

Definition at line 115 of file Vector3f.h.

Referenced by divide_by(), get_ij(), get_j(), get_jk(), Zeni::Quaternion::get_matrix(), magnitude2(), Zeni::Matrix4f::Matrix4f(), multiply_by(), Zeni::Collision::nearest_point(), normalize(), normalized(), operator%(), operator*(), Zeni::Quaternion::operator*(), Zeni::Matrix4f::operator*(), operator*=(), operator+(), Zeni::Point3f::operator+(), operator+=(), Zeni::Point3f::operator+=(), operator-(), Zeni::Point3f::operator-(), operator-=(), Zeni::Point3f::operator-=(), operator/(), operator/=(), Zeni::Collision::Parallelepiped::Parallelepiped(), phi(), Zeni::Quaternion::Quaternion(), Zeni::Video_GL_Shader::rotate_scene(), Zeni::Video_GL_Fixed::rotate_scene(), Zeni::Matrix4f::Scale(), Zeni::Video_GL_Shader::scale_scene(), Zeni::Video_GL_Fixed::scale_scene(), Zeni::Video_DX9::scale_scene(), Zeni::serialize(), Zeni::Sound_Renderer_AL::set_listener_forward_and_up(), Zeni::Sound_Renderer_AL::set_listener_velocity(), set_spherical(), theta(), Zeni::Matrix4f::Translate(), Zeni::Video_GL_Shader::translate_scene(), Zeni::Video_GL_Fixed::translate_scene(), Zeni::Video_DX9::translate_scene(), Zeni::unserialize(), Zeni::Quaternion::Vector3f_to_Vector3f(), and Zeni::Matrix4f::View().

float Zeni::Vector3f::k

Definition at line 119 of file Vector3f.h.

Referenced by divide_by(), get_ik(), get_jk(), get_k(), Zeni::Quaternion::get_matrix(), magnitude2(), Zeni::Matrix4f::Matrix4f(), multiply_by(), Zeni::Collision::nearest_point(), normalize(), normalized(), operator%(), operator*(), Zeni::Quaternion::operator*(), Zeni::Matrix4f::operator*(), operator*=(), operator+(), Zeni::Point3f::operator+(), operator+=(), Zeni::Point3f::operator+=(), operator-(), Zeni::Point3f::operator-(), operator-=(), Zeni::Point3f::operator-=(), operator/(), operator/=(), Zeni::Collision::Parallelepiped::Parallelepiped(), phi(), Zeni::Quaternion::Quaternion(), Zeni::Video_GL_Fixed::rotate_scene(), Zeni::Video_GL_Shader::rotate_scene(), Zeni::Matrix4f::Scale(), Zeni::Video_GL_Shader::scale_scene(), Zeni::Video_GL_Fixed::scale_scene(), Zeni::Video_DX9::scale_scene(), Zeni::serialize(), Zeni::Sound_Renderer_AL::set_listener_forward_and_up(), Zeni::Sound_Renderer_AL::set_listener_velocity(), set_spherical(), Zeni::Matrix4f::Translate(), Zeni::Video_GL_Shader::translate_scene(), Zeni::Video_GL_Fixed::translate_scene(), Zeni::Video_DX9::translate_scene(), Zeni::Projector3D::unproject(), Zeni::unserialize(), Zeni::Quaternion::Vector3f_to_Vector3f(), and Zeni::Matrix4f::View().

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:

- zenilib/jni/external/zenilib/zeni/Zeni/Vector3f.h
- zenilib/jni/external/zenilib/zeni/Vector3f.cpp
- zenilib/jni/external/zenilib/zeni/Zeni/Vector3f.hxx