Stellarium  0.16.1
List of all members | Public Member Functions | Public Attributes
Vector2< T > Class Template Reference

A templatized 2d vector compatible with openGL. More...

#include <VecMath.hpp>

+ Collaboration diagram for Vector2< T >:

Public Member Functions

 Vector2 ()
 The vector is not initialized! More...
 
 Vector2 (T)
 Sets all components of the vector to the same value. 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< T > & operator= (const T *)
 Assignment from array. More...
 
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. More...
 
Vector2< T > & operator*= (const Vector2< T > &)
 Component-wise multiplication. More...
 
Vector2< T > & operator/= (T)
 Scalar division. More...
 
Vector2< T > & operator/= (const Vector2< T > &)
 Component-wise division. More...
 
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. More...
 
Vector2< T > operator* (const Vector2< T > &) const
 Component-wise multiplication. More...
 
Vector2< T > operator/ (T) const
 Scalar division. More...
 
Vector2< T > operator/ (const Vector2< T > &) const
 Component-wise division. More...
 
Vector2< T > min (const Vector2< T > &) const
 Component-wise minimum determination. More...
 
Vector2< T > max (const Vector2< T > &) const
 Component-wise maximum determination. More...
 
Vector2< T > clamp (const Vector2< T > &low, const Vector2< T > &high) const
 Component-wise clamping to the specified upper and lower bounds. More...
 
dot (const Vector2< T > &) const
 
length () const
 
lengthSquared () const
 
void normalize ()
 
QString toString () const
 

Public Attributes

v [2]
 

Detailed Description

template<class T>
class Vector2< T >

A templatized 2d vector compatible with openGL.

Use Vec2d or Vec2f typdef for vectors of double and float respectively.

Definition at line 32 of file VecMath.hpp.

Constructor & Destructor Documentation

template<class T >
Vector2< T >::Vector2 ( )
inline

The vector is not initialized!

Definition at line 441 of file VecMath.hpp.

template<class T>
Vector2< T >::Vector2 ( x)
inline

Sets all components of the vector to the same value.

Definition at line 443 of file VecMath.hpp.

template<class T>
Vector2< T >::Vector2 ( const T *  x)
inlineexplicit

Explicit conversion constructor from an array (copies values)

Warning
Does not check array size, make sure it has at least 2 elements

Definition at line 448 of file VecMath.hpp.

template<class T >
template<class T2 >
Vector2< T >::Vector2 ( const Vector2< T2 > &  other)
inlineexplicit

Explicit conversion constructor from another Vec2 of any type.

Uses default primitive type conversion

Definition at line 453 of file VecMath.hpp.

Member Function Documentation

template<class T>
Vector2< T > Vector2< T >::clamp ( const Vector2< T > &  low,
const Vector2< T > &  high 
) const
inline

Component-wise clamping to the specified upper and lower bounds.

Definition at line 593 of file VecMath.hpp.

template<class T>
Vector2< T > Vector2< T >::max ( const Vector2< T > &  b) const
inline

Component-wise maximum determination.

Definition at line 588 of file VecMath.hpp.

template<class T>
Vector2< T > Vector2< T >::min ( const Vector2< T > &  b) const
inline

Component-wise minimum determination.

Definition at line 583 of file VecMath.hpp.

template<class T>
Vector2< T > Vector2< T >::operator* ( s) const
inline

Scalar multiplication.

Definition at line 563 of file VecMath.hpp.

template<class T>
Vector2< T > Vector2< T >::operator* ( const Vector2< T > &  b) const
inline

Component-wise multiplication.

Definition at line 568 of file VecMath.hpp.

template<class T>
Vector2< T > & Vector2< T >::operator*= ( s)
inline

Scalar multiplication.

Definition at line 519 of file VecMath.hpp.

template<class T>
Vector2< T > & Vector2< T >::operator*= ( const Vector2< T > &  b)
inline

Component-wise multiplication.

Definition at line 525 of file VecMath.hpp.

template<class T>
Vector2< T > Vector2< T >::operator/ ( s) const
inline

Scalar division.

Definition at line 573 of file VecMath.hpp.

template<class T>
Vector2< T > Vector2< T >::operator/ ( const Vector2< T > &  b) const
inline

Component-wise division.

Definition at line 578 of file VecMath.hpp.

template<class T>
Vector2< T > & Vector2< T >::operator/= ( s)
inline

Scalar division.

Definition at line 531 of file VecMath.hpp.

template<class T>
Vector2< T > & Vector2< T >::operator/= ( const Vector2< T > &  b)
inline

Component-wise division.

Definition at line 537 of file VecMath.hpp.

template<class T>
Vector2< T > & Vector2< T >::operator= ( const T *  a)
inline

Assignment from array.

Warning
Does not check array size, make sure it has at least 2 elements

Definition at line 464 of file VecMath.hpp.


The documentation for this class was generated from the following file: