# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::Vector2< scalar_type > 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>`

List of all members.

## Public Member Functions
| Vector2 (const Vector2 &other)
| Vector2 ()
template<class T >
| Vector2 (const T &other)
| Vector2 (scalar_type x, scalar_type y)
scalar_type * | ptr ()
const scalar_type * | ptr () const
const scalar_type & | x () const
const scalar_type & | y () const
scalar_type & | x ()
scalar_type & | y ()
const scalar_type & | r () const
const scalar_type & | g () const
scalar_type & | r ()
scalar_type & | g ()
const scalar_type & | s () const
const scalar_type & | t () const
scalar_type & | s ()
scalar_type & | 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+ (scalar_type val) const
Vector2 | operator- (scalar_type val) const
Vector2 | operator* (scalar_type val) const
Vector2 | operator/ (scalar_type val) const
Vector2 | operator- () const
Vector2 & | operator+= (const Vector2 &other)
Vector2 & | operator-= (const Vector2 &other)
Vector2 & | operator*= (const Vector2 &other)
Vector2 & | operator/= (const Vector2 &other)
Vector2 & | operator+= (scalar_type val)
Vector2 & | operator-= (scalar_type val)
Vector2 & | operator*= (scalar_type val)
Vector2 & | operator/= (scalar_type val)
Vector2 & | operator= (const Vector2 &other)
Vector2 & | operator= (scalar_type val)
bool | operator== (const Vector2 &other) const
bool | operator!= (const Vector2 &other) const
bool | operator< (const Vector2 &other) const
scalar_type & | operator[] (unsigned i)
const scalar_type & | operator[] (unsigned i) const
scalar_type | length () const
scalar_type | lengthSquared () const
bool | isNull () const
const Vector2 & | normalize ()
## Static Public Attributes
static const int | scalar_count = 2
## Protected Attributes
scalar_type | mScalar [scalar_count]

## Detailed Description

### template<typename scalar_type>
class vl::Vector2< scalar_type >

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

## Constructor & Destructor Documentation

template<typename scalar_type>

vl::Vector2< scalar_type >::Vector2 | ( | const Vector2< scalar_type > & | other | ) | `[inline]`

template<typename scalar_type>

vl::Vector2< scalar_type >::Vector2 | ( |  | ) | `[inline]`

template<typename scalar_type>
template<class T >

vl::Vector2< scalar_type >::Vector2 | ( | const T & | other | ) | `[inline, explicit]`

template<typename scalar_type>

vl::Vector2< scalar_type >::Vector2 | ( | scalar_type | x,
|  | scalar_type | y |
| ) |  |  | `[inline, explicit]`

## Member Function Documentation

template<typename scalar_type>

scalar_type* vl::Vector2< scalar_type >::ptr | ( |  | ) | `[inline]`

template<typename scalar_type>

const scalar_type* vl::Vector2< scalar_type >::ptr | ( |  | ) | const`[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::x | ( |  | ) | const`[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::y | ( |  | ) | const`[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::x | ( |  | ) | `[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::y | ( |  | ) | `[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::r | ( |  | ) | const`[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::g | ( |  | ) | const`[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::r | ( |  | ) | `[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::g | ( |  | ) | `[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::s | ( |  | ) | const`[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::t | ( |  | ) | const`[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::s | ( |  | ) | `[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::t | ( |  | ) | `[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator+ | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator- | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator* | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator/ | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator+ | ( | scalar_type | val | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator- | ( | scalar_type | val | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator* | ( | scalar_type | val | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator/ | ( | scalar_type | val | ) | const`[inline]`

template<typename scalar_type>

Vector2 vl::Vector2< scalar_type >::operator- | ( |  | ) | const`[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator+= | ( | const Vector2< scalar_type > & | other | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator-= | ( | const Vector2< scalar_type > & | other | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator*= | ( | const Vector2< scalar_type > & | other | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator/= | ( | const Vector2< scalar_type > & | other | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator+= | ( | scalar_type | val | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator-= | ( | scalar_type | val | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator*= | ( | scalar_type | val | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator/= | ( | scalar_type | val | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator= | ( | const Vector2< scalar_type > & | other | ) | `[inline]`

template<typename scalar_type>

Vector2& vl::Vector2< scalar_type >::operator= | ( | scalar_type | val | ) | `[inline]`

template<typename scalar_type>

bool vl::Vector2< scalar_type >::operator== | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

bool vl::Vector2< scalar_type >::operator!= | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

bool vl::Vector2< scalar_type >::operator< | ( | const Vector2< scalar_type > & | other | ) | const`[inline]`

template<typename scalar_type>

scalar_type& vl::Vector2< scalar_type >::operator[] | ( | unsigned | i | ) | `[inline]`

template<typename scalar_type>

const scalar_type& vl::Vector2< scalar_type >::operator[] | ( | unsigned | i | ) | const`[inline]`

template<typename scalar_type>

scalar_type vl::Vector2< scalar_type >::length | ( |  | ) | const`[inline]`

template<typename scalar_type>

scalar_type vl::Vector2< scalar_type >::lengthSquared | ( |  | ) | const`[inline]`

template<typename scalar_type>

bool vl::Vector2< scalar_type >::isNull | ( |  | ) | const`[inline]`

template<typename scalar_type>

const Vector2& vl::Vector2< scalar_type >::normalize | ( |  | ) | `[inline]`

## Member Data Documentation

template<typename scalar_type>

const int vl::Vector2< scalar_type >::scalar_count = 2`[static]`

template<typename scalar_type>

scalar_type vl::Vector2< scalar_type >::mScalar[scalar_count]`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/Vector2.hpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 29 11:11:55 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.