Visualization Library 2.0.0-b3

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
 

Public Member Functions

 Vector2 (const Vector2 &other)
 
 Vector2 ()
 
template<class T >
 Vector2 (const T &other)
 
 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_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/5]

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

Definition at line 102 of file Vector2.hpp.

◆ Vector2() [2/5]

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

◆ Vector2() [3/5]

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

Definition at line 106 of file Vector2.hpp.

◆ Vector2() [4/5]

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

Definition at line 112 of file Vector2.hpp.

◆ Vector2() [5/5]

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

Definition at line 123 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 139 of file Vector2.hpp.

◆ g() [2/2]

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

Definition at line 142 of file Vector2.hpp.

◆ isNull()

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

Definition at line 256 of file Vector2.hpp.

◆ length() [1/2]

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

Definition at line 254 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 255 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 257 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 241 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 158 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 174 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 196 of file Vector2.hpp.

◆ operator*=() [2/2]

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

Definition at line 216 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 150 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 166 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 186 of file Vector2.hpp.

◆ operator+=() [2/2]

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

Definition at line 206 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 154 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 170 of file Vector2.hpp.

◆ operator-() [3/3]

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

Definition at line 182 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 191 of file Vector2.hpp.

◆ operator-=() [2/2]

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

Definition at line 211 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 162 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 178 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 201 of file Vector2.hpp.

◆ operator/=() [2/2]

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

Definition at line 221 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 245 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 226 of file Vector2.hpp.

◆ operator=() [2/2]

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

Definition at line 232 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 237 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 252 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 253 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 130 of file Vector2.hpp.

◆ r() [1/2]

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

Definition at line 138 of file Vector2.hpp.

◆ r() [2/2]

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

Definition at line 141 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 147 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 148 of file Vector2.hpp.

◆ x() [1/2]

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

Definition at line 132 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 vl::vlx_toValue().

◆ x() [2/2]

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

Definition at line 135 of file Vector2.hpp.

◆ y() [1/2]

template<typename T_Scalar>
const T_Scalar& vl::Vector2< T_Scalar >::y ( ) 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::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 vl::vlx_toValue().

◆ y() [2/2]

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

Definition at line 136 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 101 of file Vector2.hpp.


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