cgv
|
A vector with zero based index. More...
#include <fvec.h>
Public Types | |
enum | { dims = N } |
compile-time constant indicating the dimensionality of the vector More... | |
typedef T | value_type |
typedef T & | reference |
typedef const T & | const_reference |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T * | iterator |
typedef const T * | const_iterator |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Public Member Functions | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
reverse iterator pointing to the end of reverse iteration | |
fvec () | |
creates a vector not initialized | |
fvec (const T &a) | |
creates a vector, where all N components are initialized to the constant value a | |
fvec (const T &x, const T &y) | |
construct and init first two coordinates to the given values | |
fvec (const T &x, const T &y, const T &z) | |
construct and init first three coordinates to the given values | |
fvec (const T &x, const T &y, const T &z, const T &w) | |
construct and init first four coordinates to the given values | |
fvec (cgv::type::uint32_type n, const T *a) | |
creates a vector from a n-element array a, if n < N remaining N-n elements are set to zero | |
template<typename S > | |
fvec (cgv::type::uint32_type n, const S *a) | |
creates a column vector initialized to array of a different type with zeros filled to not copied components | |
fvec (const fvec< T, N > &rhs) | |
copy constructor | |
template<typename S > | |
fvec (const fvec< S, N > &fv) | |
copies a column vector of a different type | |
template<typename S1 , typename S2 > | |
fvec (const fvec< S1, N - 1 > &fv, S2 w) | |
construct from vector of one dimension less plus a scalar | |
template<typename S > | |
fvec (const fvec< S, N+1 > &fv) | |
construct from vector of one dimension higher by cutting of the highest dimension | |
fvec (const std::array< T, N > &arr) | |
construct from std::array of same size | |
fvec & | operator= (const fvec< T, N > &rhs) |
assign vector rhs, if vector and rhs have different sizes, vector has been resized to match the size of | |
fvec & | operator= (const T &a) |
set all components of vector to constant value a | |
void | assign (const std::array< T, N > &arr) |
set to the contents of the given std::array with same size | |
void | set (const T &x, const T &y) |
set the first two components | |
void | set (const T &x, const T &y, const T &z) |
set the first three components | |
void | set (const T &x, const T &y, const T &z, const T &w) |
set the first four components | |
void | fill (const T &a) |
fill elements of vector with scalar v | |
void | zeros () |
fill the vector with zeros | |
void | zerosh () |
fill the vector with zeros except for the last component, which will be set to one | |
void | ones () |
fill the vector with ones | |
fvec< T, N+1 > | lift () const |
convert to homogeneous version by adding a 1 | |
vec< T > | to_vec () const |
conversion to vector type | |
T & | x () |
first element | |
const T & | x () const |
first element of const vector | |
T & | y () |
second element | |
const T & | y () const |
second element of const vector | |
T & | z () |
third element | |
const T & | z () const |
third element of const vector | |
T & | w () |
fourth element | |
const T & | w () const |
fourth element of const vector | |
T & | operator() (const int i) |
access i'th element | |
const T & | operator() (const int i) const |
access i'th element of const vector | |
T & | operator[] (const int i) |
access i'th element | |
const T & | operator[] (const int i) const |
access i'th element of const vector | |
T * | data () |
cast into array. This allows calls like glVertex<N><T>v(p.data()) instead of glVertex<N><T,N>(p.x(),p.y(),....) | |
const T * | data () const |
cast into const array | |
fvec< T, N > & | operator+= (const T &s) |
in place addition of a scalar s | |
fvec< T, N > & | operator-= (const T &s) |
in place subtraction by scalar s | |
fvec< T, N > & | operator*= (const T &s) |
in place multiplication with s | |
fvec< T, N > & | operator/= (const T &s) |
in place division by scalar s | |
template<typename S > | |
fvec< T, N > & | operator+= (const fvec< S, N > &_v) |
in place vector addition | |
template<typename S > | |
fvec< T, N > & | operator-= (const fvec< S, N > &_v) |
in place vector subtraction | |
template<typename S > | |
fvec< T, N > & | operator*= (const fvec< S, N > &_v) |
in place componentwise vector multiplication | |
template<typename S > | |
fvec< T, N > & | operator/= (const fvec< S, N > &_v) |
in place componentwise vector division | |
template<typename S > | |
fvec< T, N > | operator+ (const fvec< S, N > &v) const |
vector addition | |
fvec< T, N > | operator+ (const T &s) const |
componentwise addition of scalar | |
fvec< T, N > | operator- (const T &s) const |
componentwise subtraction of scalar | |
template<typename S > | |
fvec< T, N > | operator- (const fvec< S, N > &v) const |
vector subtraction | |
template<typename S > | |
fvec< T, N > | operator* (const fvec< S, N > &v) const |
componentwise vector multiplication | |
template<typename S > | |
fvec< T, N > | operator/ (const fvec< S, N > &v) const |
componentwise vector division | |
fvec< T, N > | operator- (void) const |
negates the vector | |
fvec< T, N > | operator* (const T &s) const |
multiplication with scalar s | |
fvec< T, N > | operator/ (const T &s) const |
divides vector by scalar s | |
template<typename S > | |
bool | operator== (const fvec< S, N > &v) const |
test for equality | |
template<typename S > | |
bool | operator!= (const fvec< S, N > &v) const |
test for inequality | |
T | length () const |
length of the vector L2-Norm | |
void | sign () |
componentwise sign values | |
void | step (const fvec< T, N > &r) |
componentwise sign values | |
void | abs () |
componentwise absolute values | |
void | ceil () |
ceil componentwise | |
void | floor () |
floor componentwise | |
void | round () |
round componentwise | |
T | sqr_length () const |
square length of vector | |
T | normalize () |
normalize the vector using the L2-Norm and return the length | |
T | safe_normalize () |
normalize the vector if length is not zero using the L2-Norm and return the length | |
Static Public Member Functions | |
static fvec< T, N > | zeroh () |
creates a homogeneous zero-vector (yields same result as calling fvec<T,N-1>(0).lift() but is faster) | |
static fvec< T, N > | from_vec (const vec< T > &) |
conversion from vector | |
static cgv::type::uint32_type | size () |
return number of elements | |
Protected Attributes | |
T | v [N] |
A vector with zero based index.
typedef const T* cgv::math::fvec< T, N >::const_iterator |
typedef const T* cgv::math::fvec< T, N >::const_pointer |
typedef const T& cgv::math::fvec< T, N >::const_reference |
typedef std::reverse_iterator<const_iterator> cgv::math::fvec< T, N >::const_reverse_iterator |
typedef std::ptrdiff_t cgv::math::fvec< T, N >::difference_type |
typedef T* cgv::math::fvec< T, N >::iterator |
typedef T* cgv::math::fvec< T, N >::pointer |
typedef T& cgv::math::fvec< T, N >::reference |
typedef std::reverse_iterator<iterator> cgv::math::fvec< T, N >::reverse_iterator |
typedef std::size_t cgv::math::fvec< T, N >::size_type |
typedef T cgv::math::fvec< T, N >::value_type |
anonymous enum |
|
inline |
|
inline |
|
inline |
construct and init first two coordinates to the given values
Definition at line 87 of file fvec.h.
References cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::x(), and cgv::math::fvec< T, N >::y().
|
inline |
construct and init first three coordinates to the given values
Definition at line 89 of file fvec.h.
References cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::x(), cgv::math::fvec< T, N >::y(), and cgv::math::fvec< T, N >::z().
|
inline |
construct and init first four coordinates to the given values
Definition at line 91 of file fvec.h.
References cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::w(), cgv::math::fvec< T, N >::x(), cgv::math::fvec< T, N >::y(), and cgv::math::fvec< T, N >::z().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
construct from vector of one dimension less plus a scalar
Definition at line 112 of file fvec.h.
References cgv::math::fvec< T, N >::w().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
ceil componentwise
Definition at line 275 of file fvec.h.
References cgv::math::fvec< T, N >::ceil().
Referenced by cgv::math::fvec< T, N >::ceil().
|
inline |
cast into array. This allows calls like glVertex<N><T>v(p.data()) instead of glVertex<N><T,N>(p.x(),p.y(),....)
Definition at line 181 of file fvec.h.
Referenced by cgv::render::gl::gl_transparent_renderer::blend_texture_over_viewport(), cgv::audio::OALListener::get_orientation(), cgv::audio::OALListener::get_position(), cgv::audio::OALSource::get_position(), cgv::audio::OALListener::get_velocity(), cgv::audio::OALSource::get_velocity(), vr::get_world_to_eye_transform(), cgv::audio::OALListener::set_position(), cgv::audio::OALSource::set_position(), cgv::audio::OALListener::set_velocity(), and cgv::audio::OALSource::set_velocity().
|
inline |
|
inline |
|
inline |
|
inline |
fill elements of vector with scalar v
Definition at line 131 of file fvec.h.
Referenced by cgv::math::fvec< T, N >::ones(), and cgv::math::fvec< T, N >::zeros().
|
inline |
floor componentwise
Definition at line 281 of file fvec.h.
References cgv::math::fvec< T, N >::floor().
Referenced by cgv::math::fvec< T, N >::floor(), and cgv::math::fvec< T, N >::round().
|
static |
conversion from vector
Definition at line 738 of file fvec.h.
References cgv::math::vec< T >::dim().
|
inline |
length of the vector L2-Norm
Definition at line 249 of file fvec.h.
References cgv::math::fvec< T, N >::sqr_length().
Referenced by cgv::media::mesh::dual_contouring< X, T >::compute_cell_vertex(), cgv::media::mesh::simple_mesh< T >::compute_face_normal(), cgv::math::quaternion< T >::exp(), cgv::render::gl::gl_implicit_surface_drawable_base::extract_mesh(), cgv::math::quaternion< T >::log(), cgv::math::fvec< T, N >::normalize(), cgv::render::view::rotate(), cgv::math::fvec< T, N >::safe_normalize(), cgv::render::view::set_eye_keep_extent(), and cgv::render::view::set_eye_keep_view_angle().
|
inline |
|
inline |
normalize the vector using the L2-Norm and return the length
Definition at line 302 of file fvec.h.
References cgv::math::fvec< T, N >::length().
Referenced by cgv::render::gl::gl_implicit_surface_drawable_base::compute_face_normal(), cgv::media::mesh::convex_polyhedron< T, TCDim >::compute_face_plane(), cgv::media::mesh::simple_mesh< T >::compute_face_tangents(), cgv::media::mesh::simple_mesh< T >::compute_vertex_normals(), cgv::media::mesh::simple_mesh< T >::dual(), cgv::media::mesh::simple_mesh< T >::gyro(), cgv::media::mesh::simple_mesh< T >::join(), cgv::render::gl::gl_implicit_surface_drawable_base::new_vertex(), cgv::math::quaternion< T >::put_axis(), cgv::render::view::put_coordinate_system(), cgv::gui::vr_calibration::read_calibration(), and cgv::gui::vr_calibration::update_driver_calibration().
|
inline |
fill the vector with ones
Definition at line 137 of file fvec.h.
References cgv::math::fvec< T, N >::fill().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
round componentwise
Definition at line 287 of file fvec.h.
References cgv::math::fvec< T, N >::floor().
|
inline |
normalize the vector if length is not zero using the L2-Norm and return the length
Definition at line 311 of file fvec.h.
References cgv::math::fvec< T, N >::length().
|
inline |
set the first two components
Definition at line 125 of file fvec.h.
References cgv::math::fvec< T, N >::x(), and cgv::math::fvec< T, N >::y().
Referenced by cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), and cgv::render::performance_monitor::performance_monitor().
|
inline |
set the first three components
Definition at line 127 of file fvec.h.
References cgv::math::fvec< T, N >::x(), cgv::math::fvec< T, N >::y(), and cgv::math::fvec< T, N >::z().
|
inline |
set the first four components
Definition at line 129 of file fvec.h.
References cgv::math::fvec< T, N >::w(), cgv::math::fvec< T, N >::x(), cgv::math::fvec< T, N >::y(), and cgv::math::fvec< T, N >::z().
|
inline |
|
inlinestatic |
return number of elements
Definition at line 179 of file fvec.h.
Referenced by cgv::render::gl::gl_implicit_surface_drawable_base::compute_face_normal(), cgv::app::overlay::get_local_rectangle(), cgv::app::navigator::handle_mouse_event(), cgv::app::color_map_editor::init_frame(), cgv::render::gl::gl_implicit_surface_drawable_base::new_polygon(), and cgv::plot::plot_base::set_plot_uniforms().
|
inline |
square length of vector
Definition at line 294 of file fvec.h.
Referenced by cgv::math::distorted_pinhole< T >::invert_distortion_model(), and cgv::math::fvec< T, N >::length().
|
inline |
vec< T > cgv::math::fvec< T, N >::to_vec | ( | ) | const |
conversion to vector type
Definition at line 730 of file fvec.h.
References cgv::math::vec< T >::set_extern_data().
Referenced by cgv::media::mesh::dual_contouring< X, T >::compute_cell_vertex(), cgv::render::gl::gl_implicit_surface_drawable_base::draw(), cgv::render::gl::gl_implicit_surface_drawable_base::new_vertex(), cgv::media::mesh::dual_contouring< X, T >::process_edge_plane(), and cgv::media::mesh::cuberille< X, T, P >::process_slice().
|
inline |
fourth element
Definition at line 167 of file fvec.h.
Referenced by cgv::math::quaternion< T >::affin(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::app::gizmo::handle(), cgv::app::navigator::handle_mouse_event(), cgv::math::quaternion< T >::operator*=(), cgv::math::ray< T, 3 >::ray(), and cgv::math::fvec< T, N >::set().
|
inline |
|
inline |
first element
Definition at line 155 of file fvec.h.
Referenced by cgv::math::quaternion< T >::affin(), cgv::media::mesh::simple_mesh< T >::compute_face_tangents(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::render::context::get_gamma(), cgv::app::navigator::handle_mouse_event(), cgv::app::color_selector::handle_mouse_event(), cgv::app::color_selector::init_frame(), cgv::math::quaternion< T >::operator*=(), cgv::math::quaternion< T >::put_im(), cgv::math::ray< T, 3 >::ray(), cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::set(), cgv::math::quaternion< T >::set(), cgv::math::quaternion< T >::set_normal(), and cgv::app::overlay::update_layout().
|
inline |
|
inline |
second element
Definition at line 159 of file fvec.h.
Referenced by cgv::math::quaternion< T >::affin(), cgv::media::mesh::simple_mesh< T >::compute_face_tangents(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::render::context::get_gamma(), cgv::app::gizmo::handle(), cgv::app::color_map_legend::handle_member_change(), cgv::app::performance_monitor::handle_member_change(), cgv::app::navigator::handle_mouse_event(), cgv::math::quaternion< T >::operator*=(), cgv::math::quaternion< T >::put_im(), cgv::math::ray< T, 3 >::ray(), cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::set(), cgv::math::quaternion< T >::set(), cgv::math::quaternion< T >::set_normal(), and cgv::app::overlay::update_layout().
|
inline |
|
inline |
third element
Definition at line 163 of file fvec.h.
Referenced by cgv::math::quaternion< T >::affin(), cgv::media::mesh::simple_mesh< T >::compute_face_tangents(), cgv::math::fvec< T, N >::fvec(), cgv::math::fvec< T, N >::fvec(), cgv::render::context::get_gamma(), cgv::app::gizmo::handle(), cgv::app::navigator::handle_mouse_event(), cgv::math::quaternion< T >::operator*=(), cgv::math::quaternion< T >::put_im(), cgv::math::fvec< T, N >::set(), cgv::math::fvec< T, N >::set(), cgv::math::quaternion< T >::set(), and cgv::math::quaternion< T >::set_normal().
|
inline |
|
inlinestatic |
|
inline |
fill the vector with zeros
Definition at line 133 of file fvec.h.
References cgv::math::fvec< T, N >::fill().
Referenced by cgv::media::mesh::convex_polyhedron< T, TCDim >::construct_box(), and cgv::math::fmat< T, N, M >::operator*().
|
inline |
|
protected |