|
CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
|
Two dimensional vector. More...
#include <vector_2d.hpp>
Public Types | |
| typedef T | value_type |
| The type of the values we store. | |
| typedef vector_2d< value_type > | self_type |
| The type of the current class. | |
| typedef coordinate_2d< value_type > | super |
| The type of the parent class. | |
Public Member Functions | |
| vector_2d () | |
| Constructor. | |
| template<class U > | |
| vector_2d (const coordinate_2d< U > &that) | |
| Copy constructor. | |
| template<class U > | |
| vector_2d (const coordinate_2d< U > &p1, const coordinate_2d< U > &p2) | |
| Construct a vector from two points. | |
| vector_2d (const value_type &_x, const value_type &_y) | |
| Constructor with initialization. | |
| value_type | length () const |
| Gets vector length. | |
| void | normalize () |
| Normalize the vector. | |
| self_type | get_orthonormal_clockwise () const |
| Get a vector orthonormal to this vector. | |
| self_type | get_orthonormal_anticlockwise () const |
| Get a vector orthonormal to this vector. | |
| value_type | dot_product (const self_type &vect) const |
| Dot product. | |
Two dimensional vector.
Definition at line 44 of file vector_2d.hpp.
| typedef vector_2d<value_type> claw::math::vector_2d< T >::self_type |
The type of the current class.
Reimplemented from claw::math::coordinate_2d< T >.
Definition at line 52 of file vector_2d.hpp.
| typedef coordinate_2d<value_type> claw::math::vector_2d< T >::super |
The type of the parent class.
Definition at line 55 of file vector_2d.hpp.
| typedef T claw::math::vector_2d< T >::value_type |
The type of the values we store.
Reimplemented from claw::math::coordinate_2d< T >.
Definition at line 49 of file vector_2d.hpp.
| claw::math::vector_2d< T >::vector_2d | ( | ) |
Constructor.
Definition at line 37 of file vector_2d.tpp.
{
} // vector_2d::vector_2d() [constructor]
| claw::math::vector_2d< T >::vector_2d | ( | const coordinate_2d< U > & | that | ) |
Copy constructor.
Definition at line 48 of file vector_2d.tpp.
: super(that) { } // vector_2d::vector_2d() [copy constructor]
| claw::math::vector_2d< T >::vector_2d | ( | const coordinate_2d< U > & | p1, |
| const coordinate_2d< U > & | p2 | ||
| ) |
Construct a vector from two points.
Definition at line 61 of file vector_2d.tpp.
: super( p2.x - p1.x, p2.y - p1.y ) { } // vector_2d::vector_2d() [constructor from two points]
| claw::math::vector_2d< T >::vector_2d | ( | const value_type & | _x, |
| const value_type & | _y | ||
| ) |
Constructor with initialization.
| _x | x value. |
| _y | y Value. |
Definition at line 74 of file vector_2d.tpp.
: super(_x, _y) { } // vector_2d::vector_2d() [constructor whit values]
| claw::math::vector_2d< T >::value_type claw::math::vector_2d< T >::dot_product | ( | const self_type & | that | ) | const |
Dot product.
| that | The other operand. |
Definition at line 136 of file vector_2d.tpp.
References claw::math::coordinate_2d< T >::x, and claw::math::coordinate_2d< T >::y.
| claw::math::vector_2d< T > claw::math::vector_2d< T >::get_orthonormal_anticlockwise | ( | ) | const |
Get a vector orthonormal to this vector.
Definition at line 124 of file vector_2d.tpp.
| claw::math::vector_2d< T > claw::math::vector_2d< T >::get_orthonormal_clockwise | ( | ) | const |
Get a vector orthonormal to this vector.
Definition at line 113 of file vector_2d.tpp.
| claw::math::vector_2d< T >::value_type claw::math::vector_2d< T >::length | ( | ) | const |
| void claw::math::vector_2d< T >::normalize | ( | ) |
Normalize the vector.
Definition at line 96 of file vector_2d.tpp.
{
value_type l = length();
if (l != 0)
{
this->x /= l;
this->y /= l;
}
} // vector_2d::normalize()
1.7.3