53#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_VECTOR_2D_H
54#define LASS_GUARDIAN_OF_INCLUSION_PRIM_VECTOR_2D_H
73 typedef Vector2D<T> TSelf;
75 typedef typename util::CallTraits<T>::TValue TValue;
76 typedef typename util::CallTraits<T>::TParam TParam;
77 typedef typename util::CallTraits<T>::TReference TReference;
78 typedef typename util::CallTraits<T>::TConstReference TConstReference;
79 typedef typename num::NumTraits<T> TNumTraits;
81 enum { dimension = 2 };
83 template <
typename U>
struct Rebind
85 typedef Vector2D<U> Type;
98 Vector2D(TParam x, TParam y);
99 template <
typename U>
explicit Vector2D(
const Vector2D<U>& other);
100 template <
typename U> Vector2D(
const U& x,
const U& y);
102 typename Vector2D::TConstReference operator[](
size_t index)
const;
103 typename Vector2D::TReference operator[](
size_t index);
104 typename Vector2D::TConstReference
at(
signed index)
const;
105 typename Vector2D::TReference
at(
signed index);
108 const Vector2D<T> operator-()
const;
124 const Vector2D<T>
perp()
const;
125 const Vector2D<T>
project(
const Vector2D<T>& other)
const;
126 const Vector2D<T>
reject(
const Vector2D<T>& other)
const;
127 const Vector2D<T> reflect(
const Vector2D<T>& other)
const;
132 template <
class RandomGenerator>
static Vector2D<T>
random(RandomGenerator& generator);
160template <
typename T>
Vector2D<T> lerp(
typename Vector2D<T>::TParam a,
const Vector2D<T>& b,
typename Vector2D<T>::TParam t);
162template<
typename T,
typename Char,
typename Traits>
163std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& stream,
const Vector2D<T>& b);
164template<
typename T,
typename Char,
typename Traits>
165std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& ioIStream,
Vector2D<T>& b);
177#define LASS_PRIM_HAVE_PY_EXPORT_TRAITS_VECTOR_2D
178#ifdef LASS_GUARDIAN_OF_INCLUSION_UTIL_PYOBJECT_PLUS_H
Output stream for writing a selection of geometric primitives to XML files.
#define LASS_SIMD_ALIGN
if LASS_SIMD_ALIGNMENT is set, use LASS_SIMD_ALIGN to align some structures on SIMD alignment boundar...
set of geometrical primitives
Library for Assembled Shared Sources.
const Vector2D< T > perp() const
return the vector perpendicular to this one, 90° CCW (to the left).
const Vector2D< T > & operator+() const
A weird way to get back the same object.
Vector2D< T > & operator-=(TParam other)
subtract other of each component of this.
void normalize()
Normalize vector.
bool isNaN() const
Return true if at least one of the components is NaN.
Vector2D< T > & operator/=(const Vector2D< T > &other)
Componentwise division.
Vector2D< T > & operator+=(TParam other)
add other to each component of this.
Vector2D< T > & operator*=(TParam other)
multiply each component of this with other.
const Vector2D< T > reject(const Vector2D< T > &other) const
Project vector on this one.
Vector2D::TConstReference at(signed index) const
Wrap index around range.
const TValue norm() const
Return norm of vector.
const Vector2D< T > normal() const
return a unit vector with same direction/sense as this vector.
bool isZero() const
Return true if all the components are (exactly!) zero.
const Vector2D< T > transform(T(*iOperator)(T)) const
apply a function to every component
static Vector2D< T > random(RandomGenerator &generator)
Random unit vector.
const Vector2D< T > reciprocal() const
return the reciprocal version of this vector
Vector2D< T > & operator/=(TParam other)
divide each component of this by other.
const TValue squaredNorm() const
Return squared norm of vector.
Vector2D< T > & operator-=(const Vector2D< T > &other)
componentwise subtraction
const Vector2D< T > project(const Vector2D< T > &other) const
Project vector on this one.
Vector2D< T > & operator+=(const Vector2D< T > &other)
componentwise addition
Vector2D< T > & operator*=(const Vector2D< T > &other)
Componentwise multiplication.
Vector2D::TReference at(signed index)
Wrap index around range.