|
Horizon
|
Define a general 2D-vector/point. More...
#include <vector2d.h>
Public Types | |
| typedef VECTOR2_TRAITS< T >::extended_type | extended_type |
| typedef T | coord_type |
Public Member Functions | |
| VECTOR2 () | |
| Construct a 2D-vector with x, y = 0. | |
| VECTOR2 (const wxPoint &aPoint) | |
| Constructor with a wxPoint as argument. | |
| VECTOR2 (const wxSize &aSize) | |
| Constructor with a wxSize as argument. | |
| VECTOR2 (T x, T y) | |
| Construct a vector with given components x, y. | |
| template<typename CastingType > | |
| VECTOR2 (const VECTOR2< CastingType > &aVec) | |
| Initializes a vector from another specialization. Beware of rounding issues. | |
| VECTOR2 (const VECTOR2< T > &aVec) | |
| Copy a vector. | |
| template<typename CastedType > | |
| VECTOR2< CastedType > | operator() () const |
| Cast a vector to another specialized subclass. Beware of rounding issues. | |
| operator wxPoint () const | |
| Implement the cast to wxPoint. More... | |
| T | EuclideanNorm () const |
| Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2). More... | |
| extended_type | SquaredEuclideanNorm () const |
| Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2). More... | |
| VECTOR2< T > | Perpendicular () const |
| Compute the perpendicular vector. More... | |
| VECTOR2< T > | Resize (T aNewLength) const |
| Return a vector of the same direction, but length specified in aNewLength. More... | |
| double | Angle () const |
| Compute the angle of the vector. More... | |
| VECTOR2< T > | Rotate (double aAngle) const |
| Rotate the vector by a given angle. More... | |
| const std::string | Format () const |
| Return the vector formatted as a string. More... | |
| extended_type | Cross (const VECTOR2< T > &aVector) const |
| Compute cross product of self with aVector. | |
| extended_type | Dot (const VECTOR2< T > &aVector) const |
| Compute dot product of self with aVector. | |
| VECTOR2< T > & | operator= (const VECTOR2< T > &aVector) |
| Assignment operator. | |
| VECTOR2< T > | operator+ (const VECTOR2< T > &aVector) const |
| Vector addition operator. | |
| VECTOR2< T > | operator+ (const T &aScalar) const |
| Scalar addition operator. | |
| VECTOR2< T > & | operator+= (const VECTOR2< T > &aVector) |
| Compound assignment operator. | |
| VECTOR2< T > & | operator+= (const T &aScalar) |
| Compound assignment operator. | |
| VECTOR2< T > | operator- (const VECTOR2< T > &aVector) const |
| Vector subtraction operator. | |
| VECTOR2< T > | operator- (const T &aScalar) const |
| Scalar subtraction operator. | |
| VECTOR2< T > & | operator-= (const VECTOR2< T > &aVector) |
| Compound assignment operator. | |
| VECTOR2< T > & | operator-= (const T &aScalar) |
| Compound assignment operator. | |
| VECTOR2< T > | operator- () |
| Negate Vector operator. | |
| extended_type | operator* (const VECTOR2< T > &aVector) const |
| Scalar product operator. | |
| VECTOR2< T > | operator* (const T &aFactor) const |
| Multiplication with a factor. | |
| VECTOR2< T > | operator/ (const T &aFactor) const |
| Division with a factor. | |
| bool | operator== (const VECTOR2< T > &aVector) const |
| Equality operator. | |
| bool | operator!= (const VECTOR2< T > &aVector) const |
| Not equality operator. | |
| bool | operator< (const VECTOR2< T > &aVector) const |
| Smaller than operator. | |
| bool | operator<= (const VECTOR2< T > &aVector) const |
| bool | operator> (const VECTOR2< T > &aVector) const |
| Greater than operator. | |
| bool | operator>= (const VECTOR2< T > &aVector) const |
Public Attributes | |
| T | x |
| T | y |
Static Public Attributes | |
| static constexpr extended_type | ECOORD_MAX = std::numeric_limits<extended_type>::max() |
| static constexpr extended_type | ECOORD_MIN = std::numeric_limits<extended_type>::min() |
Define a general 2D-vector/point.
This class uses templates to be universal. Several operators are provided to help easy implementing of linear algebra equations.
| double VECTOR2< T >::Angle |
Compute the angle of the vector.
| T VECTOR2< T >::EuclideanNorm |
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
It is used to calculate the length of the vector.
| const std::string VECTOR2< T >::Format |
Return the vector formatted as a string.
Compute the perpendicular vector.
Return a vector of the same direction, but length specified in aNewLength.
| aNewLength | is the length of the rescaled vector. |
Rotate the vector by a given angle.
Rotate a VECTOR2 by aAngle.
| aAngle | rotation angle in radians |
| aAngle | = rotation angle in radians |
Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
It is used to calculate the length of the vector.