Stellarium
HEAD
|
A templatized 2d vector compatible with OpenGL. More...
#include <VecMath.hpp>
Public Member Functions | |
Vector2 (T x=0) | |
The vector is not initialized! More... | |
Vector2 (const T *) | |
Explicit conversion constructor from an array (copies values) More... | |
template<class T2 > | |
Vector2 (const Vector2< T2 > &) | |
Explicit conversion constructor from another Vec2 of any type. More... | |
Vector2 (T, T) | |
Vector2 (QString s) | |
Constructor from a comma-separated QString like "2,4" or "2.1,4.2". | |
Vector2 (QStringList s) | |
Constructor from a QStringList like { "2", "4" } or { "2.1", "4.2", "6.3" }. | |
void | set (T, T) |
bool | operator== (const Vector2< T > &) const |
bool | operator!= (const Vector2< T > &) const |
const T & | operator[] (int x) const |
T & | operator[] (int) |
operator const T * () const | |
operator T* () | |
Vector2< T > & | operator+= (const Vector2< T > &) |
Vector2< T > & | operator-= (const Vector2< T > &) |
Vector2< T > & | operator*= (T) |
Scalar multiplication. | |
Vector2< T > & | operator*= (const Vector2< T > &) |
Component-wise multiplication. | |
Vector2< T > & | operator/= (T) |
Scalar division. | |
Vector2< T > & | operator/= (const Vector2< T > &) |
Component-wise division. | |
Vector2< T > | operator- (const Vector2< T > &) const |
Vector2< T > | operator+ (const Vector2< T > &) const |
Vector2< T > | operator- () const |
Vector2< T > | operator+ () const |
Vector2< T > | operator* (T) const |
Scalar multiplication. | |
Vector2< T > | operator* (const Vector2< T > &) const |
Component-wise multiplication. | |
Vector2< T > | operator/ (T) const |
Scalar division. | |
Vector2< T > | operator/ (const Vector2< T > &) const |
Component-wise division. | |
Vector2< T > | min (const Vector2< T > &) const |
Component-wise minimum determination. | |
Vector2< T > | max (const Vector2< T > &) const |
Component-wise maximum determination. | |
Vector2< T > | clamp (const Vector2< T > &low, const Vector2< T > &high) const |
Component-wise clamping to the specified upper and lower bounds. | |
T | dot (const Vector2< T > &) const |
T | length () const =delete |
T | lengthSquared () const =delete |
T | norm () const |
Norm of the vector, also known as length. | |
T | normSquared () const |
Square of the norm of the vector, same as dot product with itself. | |
void | normalize () |
QString | toString () const |
Formatted string with brackets. | |
QString | toStr () const |
Compact comma-separated string without brackets and spaces. More... | |
QVector2D | toQVector () const |
Convert to a QVector2D. | |
Static Public Member Functions | |
static Vector2< T > | fromBracketedString (QString s) |
converters to be registered in StelCore | |
Data Fields | |
T | v [2] |
A templatized 2d vector compatible with OpenGL.
Use Vec2i for integer and Vec2d or Vec2f typedef for vectors of double and float respectively.
The vector is not initialized!
Sets all components of the vector to the same value
Explicit conversion constructor from an array (copies values)
|
inlineexplicit |
Explicit conversion constructor from another Vec2 of any type.
Uses default primitive type conversion
QString Vector2< T >::toStr | ( | ) | const |
Compact comma-separated string without brackets and spaces.
The result can be restored into a Vector2 by the Vector2(QString s) constructors.