Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
vl::Vector2< T_Scalar > Class Template Reference

The Vector2 class is a template class that implements a generic 2 components vector, see also vl::fvec2, vl::dvec2, vl::uvec2, vl::ivec2, vl::svec2, vl::usvec2, vl::bvec2, vl::ubvec2. More...

#include <Vector2.hpp>

Public Types

typedef T_Scalar scalar_type
 
typedef T_Scalar * scalar_ptr_type
 

Public Member Functions

 Vector2 (const Vector2 &other)
 
 Vector2 ()
 
template<class T >
 Vector2 (const T &other)
 
 Vector2 (const scalar_ptr_type &pval)
 
 Vector2 (T_Scalar val)
 
 Vector2 (T_Scalar x, T_Scalar y)
 
T_Scalar * ptr ()
 
const T_Scalar * ptr () const
 
const T_Scalar & x () const
 
const T_Scalar & y () const
 
T_Scalar & x ()
 
T_Scalar & y ()
 
const T_Scalar & r () const
 
const T_Scalar & g () const
 
T_Scalar & r ()
 
T_Scalar & g ()
 
const T_Scalar & s () const
 
const T_Scalar & t () const
 
T_Scalar & s ()
 
T_Scalar & t ()
 
Vector2 operator+ (const Vector2 &other) const
 
Vector2 operator- (const Vector2 &other) const
 
Vector2 operator* (const Vector2 &other) const
 
Vector2 operator/ (const Vector2 &other) const
 
Vector2 operator+ (T_Scalar val) const
 
Vector2 operator- (T_Scalar val) const
 
Vector2 operator* (T_Scalar val) const
 
Vector2 operator/ (T_Scalar val) const
 
Vector2 operator- () const
 
Vector2operator+= (const Vector2 &other)
 
Vector2operator-= (const Vector2 &other)
 
Vector2operator*= (const Vector2 &other)
 
Vector2operator/= (const Vector2 &other)
 
Vector2operator+= (T_Scalar val)
 
Vector2operator-= (T_Scalar val)
 
Vector2operator*= (T_Scalar val)
 
Vector2operator/= (T_Scalar val)
 
Vector2operator= (const Vector2 &other)
 
Vector2operator= (T_Scalar val)
 
bool operator== (const Vector2 &other) const
 
bool operator!= (const Vector2 &other) const
 
bool operator< (const Vector2 &other) const
 
T_Scalar & operator[] (unsigned i)
 
const T_Scalar & operator[] (unsigned i) const
 
T_Scalar length () const
 
T_Scalar lengthSquared () const
 
bool isNull () const
 
const Vector2normalize (T_Scalar *len=NULL)
 
template<>
half length () const
 
template<>
half lengthSquared () const
 

Static Public Attributes

static const int scalar_count = 2
 

Protected Attributes

T_Scalar mScalar [scalar_count]
 

Detailed Description

template<typename T_Scalar>
class vl::Vector2< T_Scalar >

The Vector2 class is a template class that implements a generic 2 components vector, see also vl::fvec2, vl::dvec2, vl::uvec2, vl::ivec2, vl::svec2, vl::usvec2, vl::bvec2, vl::ubvec2.

See also
Vector4, Vector3, Matrix4, Matrix3, Matrix2

Definition at line 97 of file Vector2.hpp.

Member Typedef Documentation

◆ scalar_ptr_type

template<typename T_Scalar>
typedef T_Scalar* vl::Vector2< T_Scalar >::scalar_ptr_type

Definition at line 101 of file Vector2.hpp.

◆ scalar_type

template<typename T_Scalar>
typedef T_Scalar vl::Vector2< T_Scalar >::scalar_type

Definition at line 100 of file Vector2.hpp.

Constructor & Destructor Documentation

◆ Vector2() [1/6]

template<typename T_Scalar>
vl::Vector2< T_Scalar >::Vector2 ( const Vector2< T_Scalar > &  other)
inline

Definition at line 103 of file Vector2.hpp.

◆ Vector2() [2/6]

template<typename T_Scalar>
vl::Vector2< T_Scalar >::Vector2 ( )
inline

◆ Vector2() [3/6]

template<typename T_Scalar>
template<class T >
vl::Vector2< T_Scalar >::Vector2 ( const T &  other)
inlineexplicit

Definition at line 107 of file Vector2.hpp.

◆ Vector2() [4/6]

template<typename T_Scalar>
vl::Vector2< T_Scalar >::Vector2 ( const scalar_ptr_type pval)
inlineexplicit

Definition at line 113 of file Vector2.hpp.

◆ Vector2() [5/6]

template<typename T_Scalar>
vl::Vector2< T_Scalar >::Vector2 ( T_Scalar  val)
inlineexplicit

Definition at line 119 of file Vector2.hpp.

◆ Vector2() [6/6]

template<typename T_Scalar>
vl::Vector2< T_Scalar >::Vector2 ( T_Scalar  x,
T_Scalar  y 
)
inlineexplicit

Definition at line 124 of file Vector2.hpp.

Member Function Documentation

◆ g() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::g ( ) const
inline

Definition at line 140 of file Vector2.hpp.

◆ g() [2/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::g ( )
inline

Definition at line 143 of file Vector2.hpp.

◆ isNull()

template<typename T_Scalar>
bool vl::Vector2< T_Scalar >::isNull ( ) const
inline

Definition at line 257 of file Vector2.hpp.

◆ length() [1/2]

template<typename T_Scalar>
T_Scalar vl::Vector2< T_Scalar >::length ( ) const
inline

Definition at line 255 of file Vector2.hpp.

Referenced by vl::length(), and vl::Vector2< int >::normalize().

◆ length() [2/2]

template<>
half vl::Vector2< half >::length ( ) const
inline

Definition at line 608 of file half.hpp.

◆ lengthSquared() [1/2]

template<typename T_Scalar>
T_Scalar vl::Vector2< T_Scalar >::lengthSquared ( ) const
inline

Definition at line 256 of file Vector2.hpp.

◆ lengthSquared() [2/2]

template<>
half vl::Vector2< half >::lengthSquared ( ) const
inline

Definition at line 609 of file half.hpp.

◆ normalize()

template<typename T_Scalar>
const Vector2& vl::Vector2< T_Scalar >::normalize ( T_Scalar *  len = NULL)
inline

Definition at line 258 of file Vector2.hpp.

Referenced by vl::normalize().

◆ operator!=()

template<typename T_Scalar>
bool vl::Vector2< T_Scalar >::operator!= ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 242 of file Vector2.hpp.

◆ operator*() [1/2]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator* ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 159 of file Vector2.hpp.

◆ operator*() [2/2]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator* ( T_Scalar  val) const
inline

Definition at line 175 of file Vector2.hpp.

◆ operator*=() [1/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator*= ( const Vector2< T_Scalar > &  other)
inline

Definition at line 197 of file Vector2.hpp.

◆ operator*=() [2/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator*= ( T_Scalar  val)
inline

Definition at line 217 of file Vector2.hpp.

◆ operator+() [1/2]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator+ ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 151 of file Vector2.hpp.

◆ operator+() [2/2]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator+ ( T_Scalar  val) const
inline

Definition at line 167 of file Vector2.hpp.

◆ operator+=() [1/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator+= ( const Vector2< T_Scalar > &  other)
inline

Definition at line 187 of file Vector2.hpp.

◆ operator+=() [2/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator+= ( T_Scalar  val)
inline

Definition at line 207 of file Vector2.hpp.

◆ operator-() [1/3]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator- ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 155 of file Vector2.hpp.

◆ operator-() [2/3]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator- ( T_Scalar  val) const
inline

Definition at line 171 of file Vector2.hpp.

◆ operator-() [3/3]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator- ( ) const
inline

Definition at line 183 of file Vector2.hpp.

◆ operator-=() [1/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator-= ( const Vector2< T_Scalar > &  other)
inline

Definition at line 192 of file Vector2.hpp.

◆ operator-=() [2/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator-= ( T_Scalar  val)
inline

Definition at line 212 of file Vector2.hpp.

◆ operator/() [1/2]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator/ ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 163 of file Vector2.hpp.

◆ operator/() [2/2]

template<typename T_Scalar>
Vector2 vl::Vector2< T_Scalar >::operator/ ( T_Scalar  val) const
inline

Definition at line 179 of file Vector2.hpp.

◆ operator/=() [1/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator/= ( const Vector2< T_Scalar > &  other)
inline

Definition at line 202 of file Vector2.hpp.

◆ operator/=() [2/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator/= ( T_Scalar  val)
inline

Definition at line 222 of file Vector2.hpp.

◆ operator<()

template<typename T_Scalar>
bool vl::Vector2< T_Scalar >::operator< ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 246 of file Vector2.hpp.

◆ operator=() [1/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator= ( const Vector2< T_Scalar > &  other)
inline

Definition at line 227 of file Vector2.hpp.

◆ operator=() [2/2]

template<typename T_Scalar>
Vector2& vl::Vector2< T_Scalar >::operator= ( T_Scalar  val)
inline

Definition at line 233 of file Vector2.hpp.

◆ operator==()

template<typename T_Scalar>
bool vl::Vector2< T_Scalar >::operator== ( const Vector2< T_Scalar > &  other) const
inline

Definition at line 238 of file Vector2.hpp.

Referenced by vl::Vector2< int >::operator!=().

◆ operator[]() [1/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::operator[] ( unsigned  i)
inline

Definition at line 253 of file Vector2.hpp.

◆ operator[]() [2/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::operator[] ( unsigned  i) const
inline

Definition at line 254 of file Vector2.hpp.

◆ ptr() [1/2]

template<typename T_Scalar>
T_Scalar* vl::Vector2< T_Scalar >::ptr ( )
inline

◆ ptr() [2/2]

template<typename T_Scalar>
const T_Scalar* vl::Vector2< T_Scalar >::ptr ( ) const
inline

Definition at line 131 of file Vector2.hpp.

◆ r() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::r ( ) const
inline

Definition at line 139 of file Vector2.hpp.

◆ r() [2/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::r ( )
inline

Definition at line 142 of file Vector2.hpp.

◆ s() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::s ( ) const
inline

◆ s() [2/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::s ( )
inline

Definition at line 148 of file Vector2.hpp.

◆ t() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::t ( ) const
inline

◆ t() [2/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::t ( )
inline

Definition at line 149 of file Vector2.hpp.

◆ x() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::x ( ) const
inline

Definition at line 133 of file Vector2.hpp.

Referenced by vl::abs(), vl::acos(), vl::acosh(), vl::RectF::addPoint(), vl::all(), vl::any(), vl::asin(), vl::asinh(), vl::atan(), vl::atanh(), vl::ceil(), vl::Geometry::computeTangentSpace(), vl::Image::copySubImage(), vl::cos(), vl::cosh(), vl::degrees(), vl::dot(), vl::GhostCameraManipulator::enableEvent(), vl::equal(), vl::exp(), vl::exp2(), vl::floor(), vl::Matrix3< T_Scalar >::getScaling(), vl::Matrix3< T_Scalar >::getT(), vl::Matrix3< T_Scalar >::getTranslation(), vl::Matrix3< T_Scalar >::getX(), vl::Matrix3< T_Scalar >::getY(), vl::greaterThan(), vl::greaterThanEqual(), vl::inversesqrt(), vl::isinf(), vl::isnan(), vl::Vector2< int >::isNull(), vl::Vector2< int >::length(), vl::Vector2< int >::lengthSquared(), vl::lessThan(), vl::lessThanEqual(), vl::log(), vl::log10(), vl::log2(), vl::max(), vl::min(), vl::mix(), vl::modf(), vl::FlatManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseDownEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), vl::FlatManipulator::mouseMoveEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::notEqual(), vl::Vector2< int >::operator*(), vl::operator*(), vl::Vector2< int >::operator+(), vl::Vector2< int >::operator-(), vl::Vector2< int >::operator/(), vl::Vector2< int >::operator<(), vl::Vector2< int >::operator=(), vl::Vector2< int >::operator==(), vl::pow(), vl::radians(), vl::Text::rawboundingRect(), vl::CoreText::rawboundingRect(), vl::DrawPixels::render_Implementation(), vl::Text::renderText(), vl::CoreText::renderText(), vl::round(), vl::roundEven(), vl::Matrix3< T_Scalar >::scale(), vl::Matrix3< T_Scalar >::setT(), vl::Matrix3< T_Scalar >::setX(), vl::Matrix3< T_Scalar >::setY(), vl::sign(), vl::sin(), vl::sinh(), vl::smoothstep(), vl::sqrt(), vl::step(), vl::tan(), vl::tanh(), vl::TrackballManipulator::trackballRotation(), vl::trunc(), vl::BezierSurface::updateBezierSurface(), vl::Vector2< int >::Vector2(), vl::Vector3< int >::Vector3(), vl::Vector4< unsigned int >::Vector4(), and vlX::vlx_toValue().

◆ x() [2/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::x ( )
inline

Definition at line 136 of file Vector2.hpp.

◆ y() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::y ( ) const
inline

Definition at line 134 of file Vector2.hpp.

Referenced by vl::abs(), vl::acos(), vl::acosh(), vl::RectF::addPoint(), vl::all(), vl::any(), vl::asin(), vl::asinh(), vl::atan(), vl::atanh(), vl::ceil(), vl::Geometry::computeTangentSpace(), vl::Image::copySubImage(), vl::cos(), vl::cosh(), vl::degrees(), vl::dot(), vl::equal(), vl::exp(), vl::exp2(), vl::floor(), vl::Matrix3< T_Scalar >::getScaling(), vl::Matrix3< T_Scalar >::getT(), vl::Matrix3< T_Scalar >::getTranslation(), vl::Matrix3< T_Scalar >::getX(), vl::Matrix3< T_Scalar >::getY(), vl::greaterThan(), vl::greaterThanEqual(), vl::inversesqrt(), vl::isinf(), vl::isnan(), vl::Vector2< int >::isNull(), vl::Vector2< int >::length(), vl::Vector2< int >::lengthSquared(), vl::lessThan(), vl::lessThanEqual(), vl::log(), vl::log10(), vl::log2(), vl::max(), vl::min(), vl::mix(), vl::modf(), vl::FlatManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseDownEvent(), vl::FlatManipulator::mouseMoveEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::notEqual(), vl::Vector2< int >::operator*(), vl::operator*(), vl::Vector2< int >::operator+(), vl::Vector2< int >::operator-(), vl::Vector2< int >::operator/(), vl::Vector2< int >::operator<(), vl::Vector2< int >::operator=(), vl::Vector2< int >::operator==(), vl::pow(), vl::radians(), vl::Text::rawboundingRect(), vl::CoreText::rawboundingRect(), vl::DrawPixels::render_Implementation(), vl::Text::renderText(), vl::CoreText::renderText(), vl::round(), vl::roundEven(), vl::Matrix3< T_Scalar >::scale(), vl::Matrix3< T_Scalar >::setT(), vl::Matrix3< T_Scalar >::setX(), vl::Matrix3< T_Scalar >::setY(), vl::sign(), vl::sin(), vl::sinh(), vl::smoothstep(), vl::sqrt(), vl::step(), vl::tan(), vl::tanh(), vl::TrackballManipulator::trackballRotation(), vl::trunc(), vl::BezierSurface::updateBezierSurface(), vl::Vector2< int >::Vector2(), vl::Vector3< int >::Vector3(), vl::Vector4< unsigned int >::Vector4(), and vlX::vlx_toValue().

◆ y() [2/2]

template<typename T_Scalar>
T_Scalar& vl::Vector2< T_Scalar >::y ( )
inline

Definition at line 137 of file Vector2.hpp.

Member Data Documentation

◆ mScalar

template<typename T_Scalar>
T_Scalar vl::Vector2< T_Scalar >::mScalar[scalar_count]
protected

◆ scalar_count

template<typename T_Scalar>
const int vl::Vector2< T_Scalar >::scalar_count = 2
static

Definition at line 102 of file Vector2.hpp.


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