Templates -- Meow  1.1.4
A C++ template which is unable and also not allowed to compile to obj-file first.
meow::Vector2D< Scalar > Class Template Reference

2D's vector More...

#include "Vectors.h"

Public Member Functions

 Vector2D ()
 consturctor (0, 0) More...
 
 Vector2D (Vector2D const &v)
 consturctor (from another Vector2D) More...
 
 Vector2D (Scalar const &s)
 constructor (s, s) More...
 
 Vector2D (Scalar const &sx, Scalar const &sy)
 constructor (sx, sy) More...
 
 Vector2D (Vector< Scalar > const &v)
 constructor (from another Vector) More...
 
 Vector2D (Vector< Scalar > const &v, size_t i)
 constructor (from another Vector, i-th) More...
 
 ~Vector2D ()
 destructor More...
 
Vector2DcopyFrom (Vector2D const &v)
 copy More...
 
Scalar const & x () const
 access x More...
 
Scalar & xGet ()
 access x with non constant reference More...
 
Scalar & yGet ()
 access y with non constant reference More...
 
Scalar const & y () const
 access y More...
 
Scalar const & x (Scalar const &s)
 modify x More...
 
Scalar const & y (Scalar const &s)
 modify y More...
 
Vector2Dxy (Scalar const &sx, Scalar const &sy)
 modify x and y More...
 
Vector2D positive () const
 return +(*this) More...
 
Vector2D negative () const
 return -(*this) More...
 
Vector2D right () const
 return count-clockwise rotate 90 degree of itself More...
 
Vector2D add (Vector2D const &v) const
 return (*this)+v More...
 
Vector2Dadded (Vector2D const &v)
 Let itself add v. More...
 
Vector2D sub (Vector2D const &v) const
 return (*this)-v More...
 
Vector2Dsubed (Vector2D const &v)
 Let itself substract v. More...
 
Vector2D mul (Scalar const &s) const
 return (*this)*s , where s is a scalar More...
 
Vector2Dmuled (Scalar const &s)
 Let itself mulitple s. More...
 
Vector2D div (Scalar const &s) const
 return (*this)/s , where s is a scalar More...
 
Vector2Ddived (Scalar const &s)
 Let itself divide s. More...
 
Scalar mul (Vector2D const &v) const
 same as dot(v) More...
 
Scalar dot (Vector2D const &v) const
 dot More...
 
Scalar cross (Vector2D const &v) const
 cross More...
 
Scalar length () const
 sqrt of length2 More...
 
Scalar length2 () const
 same as dot(*this) More...
 
Vector2D normalize () const
 return normalize form of itself More...
 
Vector2Dnormalized ()
 normalize itself More...
 
Vector2D rotate (Scalar const &theta) const
 return rotate theta degree of itself More...
 
Vector2Drotated (Scalar const &theta)
 Let itself rotate theta degree. More...
 
Vector2D reflect (Vector2D const &v) const
 return reflect from given vector v More...
 
Vector2Dreflected (Vector2D const &v)
 reflect itself given vector v More...
 
Matrix< Scalar > matrix () const
 return a 2x1 matrix form of itself More...
 
Matrix< Scalar > matrix (Scalar const &homo) const
 return a 3x1 matrix form of itself More...
 
Scalar const & operator() (size_t n) const
 
Vector2Doperator() (Scalar const &sx, Scalar const &sy)
 
Vector2D operator+ () const
 
Vector2D operator- () const
 
Vector2D operator~ () const
 
Vector2D operator+ (Vector2D const &v) const
 
Vector2D operator- (Vector2D const &v) const
 
Vector2D operator* (Scalar const &s) const
 
Vector2D operator/ (Scalar const &s) const
 
Scalar operator* (Vector2D const &v) const
 
Vector2Doperator= (Vector2D const &v)
 
Vector2Doperator+= (Vector2D const &v)
 
Vector2Doperator-= (Vector2D const &v)
 
Vector2Doperator*= (Scalar const &s)
 
Vector2Doperator/= (Scalar const &s)
 

Detailed Description

template<class Scalar>
class meow::Vector2D< Scalar >

2D's vector

Author
cat_leopard

Definition at line 18 of file Vectors.h.

Constructor & Destructor Documentation

template<class Scalar>
meow::Vector2D< Scalar >::Vector2D ( )
inline

consturctor (0, 0)

Definition at line 23 of file Vectors.h.

template<class Scalar>
meow::Vector2D< Scalar >::Vector2D ( Vector2D< Scalar > const &  v)
inline

consturctor (from another Vector2D)

Definition at line 27 of file Vectors.h.

template<class Scalar>
meow::Vector2D< Scalar >::Vector2D ( Scalar const &  s)
inline

constructor (s, s)

Definition at line 31 of file Vectors.h.

template<class Scalar>
meow::Vector2D< Scalar >::Vector2D ( Scalar const &  sx,
Scalar const &  sy 
)
inline

constructor (sx, sy)

Definition at line 35 of file Vectors.h.

template<class Scalar>
meow::Vector2D< Scalar >::Vector2D ( Vector< Scalar > const &  v)
inline

constructor (from another Vector)

Definition at line 39 of file Vectors.h.

template<class Scalar>
meow::Vector2D< Scalar >::Vector2D ( Vector< Scalar > const &  v,
size_t  i 
)
inline

constructor (from another Vector, i-th)

Definition at line 43 of file Vectors.h.

template<class Scalar>
meow::Vector2D< Scalar >::~Vector2D ( )
inline

destructor

Definition at line 47 of file Vectors.h.

Member Function Documentation

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::add ( Vector2D< Scalar > const &  v) const
inline

return (*this)+v

Definition at line 110 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::added ( Vector2D< Scalar > const &  v)
inline

Let itself add v.

Definition at line 115 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::copyFrom ( Vector2D< Scalar > const &  v)
inline

copy

Definition at line 51 of file Vectors.h.

template<class Scalar>
Scalar meow::Vector2D< Scalar >::cross ( Vector2D< Scalar > const &  v) const
inline

cross

Definition at line 160 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::div ( Scalar const &  s) const
inline

return (*this)/s , where s is a scalar

Definition at line 140 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::dived ( Scalar const &  s)
inline

Let itself divide s.

Definition at line 145 of file Vectors.h.

template<class Scalar>
Scalar meow::Vector2D< Scalar >::dot ( Vector2D< Scalar > const &  v) const
inline

dot

Definition at line 155 of file Vectors.h.

template<class Scalar>
Scalar meow::Vector2D< Scalar >::length ( ) const
inline

sqrt of length2

Definition at line 165 of file Vectors.h.

template<class Scalar>
Scalar meow::Vector2D< Scalar >::length2 ( ) const
inline

same as dot(*this)

Definition at line 170 of file Vectors.h.

template<class Scalar>
Matrix<Scalar> meow::Vector2D< Scalar >::matrix ( ) const
inline

return a 2x1 matrix form of itself

Definition at line 208 of file Vectors.h.

template<class Scalar>
Matrix<Scalar> meow::Vector2D< Scalar >::matrix ( Scalar const &  homo) const
inline

return a 3x1 matrix form of itself

Definition at line 216 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::mul ( Scalar const &  s) const
inline

return (*this)*s , where s is a scalar

Definition at line 130 of file Vectors.h.

template<class Scalar>
Scalar meow::Vector2D< Scalar >::mul ( Vector2D< Scalar > const &  v) const
inline

same as dot(v)

Definition at line 150 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::muled ( Scalar const &  s)
inline

Let itself mulitple s.

Definition at line 135 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::negative ( ) const
inline

return -(*this)

Definition at line 100 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::normalize ( ) const
inline

return normalize form of itself

Definition at line 175 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::normalized ( )
inline

normalize itself

Definition at line 180 of file Vectors.h.

template<class Scalar>
Scalar const& meow::Vector2D< Scalar >::operator() ( size_t  n) const
inline

Definition at line 224 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::operator() ( Scalar const &  sx,
Scalar const &  sy 
)
inline

Definition at line 228 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator* ( Scalar const &  s) const
inline

Definition at line 238 of file Vectors.h.

template<class Scalar>
Scalar meow::Vector2D< Scalar >::operator* ( Vector2D< Scalar > const &  v) const
inline

Definition at line 240 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::operator*= ( Scalar const &  s)
inline

Definition at line 245 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator+ ( ) const
inline

Definition at line 232 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator+ ( Vector2D< Scalar > const &  v) const
inline

Definition at line 236 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::operator+= ( Vector2D< Scalar > const &  v)
inline

Definition at line 243 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator- ( ) const
inline

Definition at line 233 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator- ( Vector2D< Scalar > const &  v) const
inline

Definition at line 237 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::operator-= ( Vector2D< Scalar > const &  v)
inline

Definition at line 244 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator/ ( Scalar const &  s) const
inline

Definition at line 239 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::operator/= ( Scalar const &  s)
inline

Definition at line 246 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::operator= ( Vector2D< Scalar > const &  v)
inline

Definition at line 242 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::operator~ ( ) const
inline

Definition at line 234 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::positive ( ) const
inline

return +(*this)

Definition at line 95 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::reflect ( Vector2D< Scalar > const &  v) const
inline

return reflect from given vector v

Definition at line 198 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::reflected ( Vector2D< Scalar > const &  v)
inline

reflect itself given vector v

Definition at line 203 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::right ( ) const
inline

return count-clockwise rotate 90 degree of itself

Definition at line 105 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::rotate ( Scalar const &  theta) const
inline

return rotate theta degree of itself

Definition at line 185 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::rotated ( Scalar const &  theta)
inline

Let itself rotate theta degree.

Definition at line 193 of file Vectors.h.

template<class Scalar>
Vector2D meow::Vector2D< Scalar >::sub ( Vector2D< Scalar > const &  v) const
inline

return (*this)-v

Definition at line 120 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::subed ( Vector2D< Scalar > const &  v)
inline

Let itself substract v.

Definition at line 125 of file Vectors.h.

template<class Scalar>
Scalar const& meow::Vector2D< Scalar >::x ( ) const
inline

access x

Definition at line 56 of file Vectors.h.

template<class Scalar>
Scalar const& meow::Vector2D< Scalar >::x ( Scalar const &  s)
inline

modify x

Definition at line 76 of file Vectors.h.

template<class Scalar>
Scalar& meow::Vector2D< Scalar >::xGet ( )
inline

access x with non constant reference

Definition at line 61 of file Vectors.h.

template<class Scalar>
Vector2D& meow::Vector2D< Scalar >::xy ( Scalar const &  sx,
Scalar const &  sy 
)
inline

modify x and y

Definition at line 88 of file Vectors.h.

template<class Scalar>
Scalar const& meow::Vector2D< Scalar >::y ( ) const
inline

access y

Definition at line 71 of file Vectors.h.

template<class Scalar>
Scalar const& meow::Vector2D< Scalar >::y ( Scalar const &  s)
inline

modify y

Definition at line 82 of file Vectors.h.

template<class Scalar>
Scalar& meow::Vector2D< Scalar >::yGet ( )
inline

access y with non constant reference

Definition at line 66 of file Vectors.h.


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