69 #ifndef __gVirtualXRayConfig_h 83 template<
typename T>
class Vec2;
89 template <
typename T> std::ostream&
operator<<(std::ostream& anOutputStream,
99 template<
typename T>
class Vec2 111 Vec2(
const T& aX = 0.0f,
const T& aY = 0.0f);
120 void setX(
const T& aValue);
129 void setY(
const T& aValue);
Template class to handle 2D vectors.
void setX(const T &aValue)
Set the position along the x-axis.
Vec2 is a template class to handle a 2D vector.
void setY(const T &aValue)
Set the position along the y-axis.
const Vec2 operator-() const
Operator - to get the opposite vector.
Vec2 & operator-=(const Vec2 &aVector)
Operator -=.
T m_x
the position along the x-axis
void normalize()
Normalize the current vector so that its length is 1.
const Vec2 operator+(const Vec2 &aVector) const
Operator +.
const Vec2 operator*(const double &aValue) const
Operator * to multiply each component of the vector by a given value.
const Vec2 operator/(const double &aValue) const
Operator / to divide each component of the vector by a given value.
Vec2 & operator*=(const double &aValue)
T getX() const
Accessor on the position along the x-axis.
void normalise()
Normalise the current vector so that its length is 1.
T & operator()(unsigned int i)
double length() const
Get the length of the vector.
T m_y
the position along the y-axi
double dotProduct(const Vec2 &aVector) const
Get the dot product between the current vector and a given vector.
Vec2 & operator+=(const Vec2 &aVector)
Operator +=.
std::ostream & operator<<(std::ostream &anOutputSream, const gVirtualXRay::AtomicElement &anElement)
operator <<
double distance(const Vec2 &aVector) const
Vec2(const T &aX=0.0f, const T &aY=0.0f)
Default Constructor.
T & operator[](unsigned int i)
Vec2 normal() const
Get the unit vector corresponding to the normed current vector.
T getY() const
Accessor on the position along the y-axis.
Vec2 & operator/=(const double &aValue)