#include <vector.hpp>
In this implementation the homogenous coordinate is always 1.0, so the first three values may be used for 3-d coordinates.
Definition at line 53 of file vector.hpp.
Public Member Functions | |
vector | cross (const vector &) const |
gsgl::real_t | dot (const vector &) const |
void | from_stream (io::text_stream &s) |
gsgl::real_t & | get_w () |
const gsgl::real_t & | get_w () const |
gsgl::real_t & | get_x () |
const gsgl::real_t & | get_x () const |
gsgl::real_t & | get_y () |
const gsgl::real_t & | get_y () const |
gsgl::real_t & | get_z () |
const gsgl::real_t & | get_z () const |
T & | item (int i, int j) |
const T & | item (int i, int j) const |
gsgl::real_t | mag () const |
Returns the magnitide of the vector. | |
gsgl::real_t | mag2 () const |
Returns the magnitude squared of the vector. | |
void | normalize () |
Normalize the 3d vector (make its length equal to 1). | |
void | normalize_h () |
Makes sure the homogenous coordinate is 1.0 (does not make the length equal to 1). | |
vector | operator* (const gsgl::real_t) |
vector & | operator*= (const gsgl::real_t) |
vector | operator+ (const vector &) const |
vector & | operator+ () |
vector & | operator+= (const vector &) |
vector | operator- (const vector &) const |
vector | operator- () const |
vector & | operator-= (const vector &) |
vector & | operator= (const matrix< 4, 1, gsgl::real_t > &) |
vector & | operator= (const vector &) |
bool | operator== (const matrix< R, C, T > &m) const |
T * | ptr () |
const T * | ptr () const |
Returns an array containing the matrix's data, in column-major order. | |
void | to_stream (io::text_stream &s) const |
vector (const gsgl::string &) | |
vector (const gsgl::real_t *) | |
vector (const matrix< 4, 1, gsgl::real_t > &) | |
vector (const vector &) | |
vector (gsgl::real_t x=0, gsgl::real_t y=0, gsgl::real_t z=0) | |
virtual | ~vector () |
Static Public Member Functions | |
static vector | interpolate (const vector &start, const vector &end, const gsgl::real_t &percent) |
static vector | parse (const gsgl::string &) |
Static Public Attributes | |
static const vector | NEG_X_AXIS |
static const vector | NEG_Y_AXIS |
static const vector | NEG_Z_AXIS |
static const vector | X_AXIS |
static const vector | Y_AXIS |
static const vector | Z_AXIS |
static const vector | ZERO |
Protected Attributes | |
T | data [R *C] |
vector | ( | gsgl::real_t | x = 0 , |
|
gsgl::real_t | y = 0 , |
|||
gsgl::real_t | z = 0 | |||
) |
Definition at line 56 of file vector.cpp.
References matrix::data.
Referenced by vector::cross(), vector::operator*(), vector::operator+(), and vector::operator-().
Definition at line 70 of file vector.cpp.
vector | ( | const matrix< 4, 1, gsgl::real_t > & | v | ) |
vector | ( | const gsgl::real_t * | ptr | ) | [explicit] |
Definition at line 65 of file vector.cpp.
vector | ( | const gsgl::string & | s | ) | [explicit] |
Definition at line 98 of file vector.cpp.
References matrix::data, iterable::iter(), and string::split().
~vector | ( | ) | [virtual] |
Definition at line 94 of file vector.cpp.
Definition at line 218 of file vector.cpp.
References matrix::data, and vector::vector().
Referenced by gsgl::scenegraph::utils::draw_billboard().
gsgl::real_t dot | ( | const vector & | v | ) | const |
Definition at line 210 of file vector.cpp.
References matrix::data.
Referenced by gsgl::scenegraph::utils::dot_in_eye_space(), and gsgl::scenegraph::utils::is_on_screen().
void from_stream | ( | io::text_stream & | s | ) | [inline, inherited] |
gsgl::real_t& get_w | ( | ) | [inline] |
Definition at line 76 of file vector.hpp.
const gsgl::real_t& get_w | ( | ) | const [inline] |
Definition at line 71 of file vector.hpp.
Referenced by rigid_body_state::derivative(), quaternion::quaternion(), satellite_element_propagator::update(), and keplerian_element_propagator::update().
gsgl::real_t& get_x | ( | ) | [inline] |
Definition at line 73 of file vector.hpp.
const gsgl::real_t& get_x | ( | ) | const [inline] |
Definition at line 68 of file vector.hpp.
Referenced by stellar_db::add_star_name(), vehicle::calculate_inertia_tensor(), rigid_body_state::derivative(), display::draw_3d_text(), stellar_db::load_db(), gsgl::math::operator*(), gsgl::scenegraph::utils::pos_in_screen_space(), quaternion::quaternion(), transform::set_basis_x(), transform::set_basis_y(), transform::set_basis_z(), transform::translation_transform(), spherical_quadtree::update(), satellite_element_propagator::update(), and keplerian_element_propagator::update().
gsgl::real_t& get_y | ( | ) | [inline] |
Definition at line 74 of file vector.hpp.
const gsgl::real_t& get_y | ( | ) | const [inline] |
Definition at line 69 of file vector.hpp.
Referenced by stellar_db::add_star_name(), vehicle::calculate_inertia_tensor(), rigid_body_state::derivative(), display::draw_3d_text(), stellar_db::load_db(), gsgl::math::operator*(), gsgl::scenegraph::utils::pos_in_screen_space(), quaternion::quaternion(), transform::set_basis_x(), transform::set_basis_y(), transform::set_basis_z(), transform::translation_transform(), spherical_quadtree::update(), satellite_element_propagator::update(), and keplerian_element_propagator::update().
gsgl::real_t& get_z | ( | ) | [inline] |
Definition at line 75 of file vector.hpp.
const gsgl::real_t& get_z | ( | ) | const [inline] |
Definition at line 70 of file vector.hpp.
Referenced by stellar_db::add_star_name(), vehicle::calculate_inertia_tensor(), rigid_body_state::derivative(), coord_system::draw(), star::draw(), large_rocky_body::draw(), celestial_body::draw(), display::draw_3d_text(), stellar_db::load_db(), gsgl::math::operator*(), gsgl::scenegraph::utils::pos_in_screen_space(), quaternion::quaternion(), transform::set_basis_x(), transform::set_basis_y(), transform::set_basis_z(), transform::translation_transform(), spherical_quadtree::update(), satellite_element_propagator::update(), and keplerian_element_propagator::update().
vector interpolate | ( | const vector & | start, | |
const vector & | end, | |||
const gsgl::real_t & | percent | |||
) | [static] |
Definition at line 226 of file vector.cpp.
T& item | ( | int | i, | |
int | j | |||
) | [inline, inherited] |
Definition at line 67 of file matrix.hpp.
const T& item | ( | int | i, | |
int | j | |||
) | const [inline, inherited] |
Definition at line 66 of file matrix.hpp.
Referenced by matrix::from_stream(), list_iterator::operator*(), matrix::to_stream(), and transform::transpose().
gsgl::real_t mag | ( | ) | const |
Returns the magnitide of the vector.
Returns the magnitude of the 3-d vector.
Definition at line 138 of file vector.cpp.
References matrix::data.
Referenced by star::draw(), large_rocky_body::draw(), celestial_body::draw(), node::draw_scene(), freeview::handle_event(), gsgl::scenegraph::utils::is_on_screen(), vector::normalize(), and spherical_clipmap::update().
gsgl::real_t mag2 | ( | ) | const |
Returns the magnitude squared of the vector.
Returns the square of the magnitude of the 3-d vector (more efficient than vector::mag()).
Definition at line 147 of file vector.cpp.
References matrix::data.
Referenced by test_frame::get_priority(), planet_system::get_priority(), large_rocky_body::get_priority(), celestial_body::get_priority(), and freeview::handle_event().
void normalize | ( | ) |
Normalize the 3d vector (make its length equal to 1).
Definition at line 114 of file vector.cpp.
References matrix::data, and vector::mag().
Referenced by gsgl::scenegraph::utils::dot_in_eye_space(), gsgl::scenegraph::utils::draw_billboard(), spherical_quadtree::fill_in_normals(), freeview::handle_event(), gsgl::scenegraph::utils::is_on_screen(), spherical_quadtree::node_cos_angle(), and planet_earth::update().
void normalize_h | ( | ) |
Makes sure the homogenous coordinate is 1.0 (does not make the length equal to 1).
Definition at line 125 of file vector.cpp.
References matrix::data.
Referenced by transform::operator*(), and vector::vector().
vector operator* | ( | const gsgl::real_t | n | ) |
Definition at line 204 of file vector.cpp.
References matrix::data, and vector::vector().
vector & operator*= | ( | const gsgl::real_t | n | ) |
Definition at line 194 of file vector.cpp.
References matrix::data.
Definition at line 163 of file vector.cpp.
References matrix::data, and vector::vector().
vector& operator+ | ( | ) | [inline] |
Definition at line 87 of file vector.hpp.
Definition at line 176 of file vector.cpp.
References matrix::data.
Definition at line 169 of file vector.cpp.
References matrix::data, and vector::vector().
vector operator- | ( | ) | const |
Definition at line 157 of file vector.cpp.
References matrix::data, and vector::vector().
Definition at line 185 of file vector.cpp.
References matrix::data.
vector & operator= | ( | const matrix< 4, 1, gsgl::real_t > & | m | ) |
bool operator== | ( | const matrix< R, C, T > & | m | ) | const [inline, inherited] |
vector parse | ( | const gsgl::string & | str | ) | [static] |
Definition at line 232 of file vector.cpp.
References matrix::data, iterable::iter(), gsgl::math::units::parse(), string::split(), and vector::ZERO.
T* ptr | ( | ) | [inline, inherited] |
Definition at line 71 of file matrix.hpp.
const T* ptr | ( | ) | const [inline, inherited] |
Returns an array containing the matrix's data, in column-major order.
Definition at line 70 of file matrix.hpp.
Referenced by planet_system::draw(), large_rocky_body::draw(), celestial_body::draw(), gsgl::scenegraph::utils::draw_billboard(), node::draw_scene(), gsgl::math::matrix_utils::multiply(), vector::operator=(), transform::operator=(), quaternion::operator=(), display::record_3d_text_info(), and gsgl::scenegraph::utils::save_screen_info().
void to_stream | ( | io::text_stream & | s | ) | const [inline, inherited] |
T data[R *C] [protected, inherited] |
Definition at line 58 of file matrix.hpp.
Referenced by vector::cross(), vector::dot(), transform::get_basis_x(), transform::get_basis_y(), transform::get_basis_z(), transform::inverse(), matrix< 4, 1, float >::item(), vector::mag(), vector::mag2(), matrix::matrix(), vector::normalize(), vector::normalize_h(), vector::operator*(), vector::operator*=(), vector::operator+(), vector::operator+=(), vector::operator-(), vector::operator-=(), vector::operator=(), transform::operator=(), matrix::operator=(), matrix::operator==(), vector::parse(), matrix< 4, 1, float >::ptr(), transform::rotation_part(), transform::scale(), transform::set_basis_x(), transform::set_basis_y(), transform::set_basis_z(), transform::translation_part(), transform::translation_transform(), and vector::vector().
const vector NEG_X_AXIS [static] |
Definition at line 109 of file vector.hpp.
const vector NEG_Y_AXIS [static] |
Definition at line 110 of file vector.hpp.
const vector NEG_Z_AXIS [static] |
Definition at line 111 of file vector.hpp.
Referenced by gsgl::scenegraph::utils::dot_in_eye_space(), and gsgl::scenegraph::utils::is_on_screen().
Definition at line 106 of file vector.hpp.
Referenced by test_frame::recalc(), freeview::rot_absolute(), and freeview::rot_relative().
Definition at line 107 of file vector.hpp.
Referenced by gsgl::scenegraph::utils::draw_billboard(), freeview::rot_absolute(), and freeview::rot_relative().
Definition at line 108 of file vector.hpp.
Referenced by test_frame::recalc(), freeview::reset(), freeview::rot_absolute(), and freeview::rot_relative().
Definition at line 105 of file vector.hpp.
Referenced by light::bind(), node::draw_scene(), vector::parse(), and freeview::reset().