30    static const double nullValue_ = 0.0;
 
 
   59    const T &
x()
 const { 
return AVector2Util::nullValue_; }
 
   61    const T &
y()
 const { 
return AVector2Util::nullValue_; }
 
   63    const T &
z()
 const { 
return z_; }
 
   65    const T &
dof(uint32 u)
 const {
 
   67        if (u>2) 
throw std::runtime_error(
"Vector index out of range.");
 
   70        return AVector2Util::nullValue_;
 
 
   74    T &
rz() { 
return z_; }
 
   76    T &
rdof([[maybe_unused]] uint32 u) {
 
   78        if (u!=2) 
throw std::runtime_error(
"Vector index out of range.");
 
 
   86    T 
fsum()
 const { 
return std::abs(z_); }   
 
   87    T 
mag2()
 const { 
return z_*z_; }          
 
   88    constexpr T 
mag()
 const { 
return std::abs(z_); }    
 
   89    T 
area()
 const { 
return 0; }              
 
   91    constexpr AVector2<T> unit()
 const { 
AVector2<T> v(*
this); 
if (z_) { v.z_ = z_ < static_cast<T>(0) ? 
static_cast<T
>(-1) : 
static_cast<T
>(1); } 
return v; } 
 
   93    void fill(
const T &d) { z_=d; } 
 
   94    constexpr T 
maxComp()
 const { 
return std::max(0.0,z_); }   
 
   95    constexpr T 
minComp()
 const { 
return std::min(0.0,z_); }   
 
  213    DAVect3 dv3(to<double>(v.
x()),to<double>(v.
y()),to<double>(v.
z()));
 
 
  220    FAVect3 fv3(to<float>(v.
x()),to<float>(v.
y()),to<float>(v.
z()));
 
 
  227    IAVect3 iv3(to<int32>(v.
x()),to<int32>(v.
y()),to<int32>(v.
z()));
 
 
  234    UAVect3 uv3(to<uint32>(v.
x()),to<uint32>(v.
y()),to<uint32>(v.
z()));
 
 
  269    AVector3<T> out(std::max<T>(v1.
x(),v2.
x()),std::max<T>(v1.
y(),v2.
y()),std::max<T>(v1.
z(),v2.
z()));
 
 
  276    AVector3<T> out(std::min<T>(v1.
x(),v2.
x()),std::min<T>(v1.
y(),v2.
y()),std::min<T>(v1.
z(),v2.
z()));
 
 
  283    AVector3<T> out(v2.
x() < 0 ? -qAbs(v1.
x()) : qAbs(v1.
x()), v2.
y() < 0 ? -qAbs(v1.
y()) : qAbs(v1.
y()), v2.
z() < 0 ? -qAbs(v1.
z()) : qAbs(v1.
z()));
 
 
  323constexpr T safeMag2(
const AVector2<T> &v) { return ::safeSquare(v.
z()); }
 
  327    return std::sqrt(safeMag2(v)); 
 
  337    T ret(::safeDiv(a.
z(),b.
z(),safe.z()));  
 
  343    T ret(::safeDiv(a.
z(),v,safe.z()));  
 
  349    return std::isfinite(a.
z());
 
  354    inline string ts(
const AVector2<T> &t, 
int width=0, 
char notation = 
'\0', 
int precision = -1, 
char fill = 
' ') {
 
  355        return ts(t.
z(), width, notation, precision, fill);
 
  359    inline string ts(
const AVector3<T> &t, 
int width=0, 
char notation = 
'\0', 
int precision = -1, 
char fill = 
' ') {
 
  360        return ts(
toVect3(t), width, notation, precision, fill);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2D Angular vector class.
Definition avect.h:43
Vector2< T > operator&(const Vector2< T > &v) const
Cross product with a Vector2 produces a Vector2.
Definition avect.h:117
T operator|(const Vector3< T > &v) const
Dot product with a Vector3.
Definition avect.h:122
constexpr T maxComp() const
Returns the maximum component (assuming x and y are 0.0)
Definition avect.h:94
T operator|(const Vector2< T > &) const
Dot product with a Vector2 returns 0.0.
Definition avect.h:121
T & operator[](uint32 u)
Returns a reference to the z component if u=2, any other value of u is an error.
Definition avect.h:84
T fsum() const
The Manhatten norm.
Definition avect.h:86
AVector2< T > operator-(const AVector2< T > &av) const
Binary math operator - require temp (till C++0x)
Definition avect.h:110
bool operator>(const AVector2< T > &av) const
comparison operator
Definition avect.h:100
constexpr AVector2< T > unit() const
returns a unit vector.
Definition avect.h:91
AVector2(const T &t)
Explicit conversion constructor, the z component is initialized to t.
Definition avect.h:52
const T & y() const
Member access - the x and y values are always uniquely 0 for a 2D angular vector.
Definition avect.h:61
constexpr T minComp() const
Returns the minimum component (assuming x and y are 0.0)
Definition avect.h:95
constexpr AVector2()=default
Default constructor, no data initialization.
const AVector2< T > & operator*=(const T &t)
in-place math operator
Definition avect.h:105
bool operator==(const AVector2< T > &av) const
comparison operator
Definition avect.h:97
const T & x() const
Member access - the x and y values are always uniquely 0 for a 2D angular vector.
Definition avect.h:59
bool operator<(const AVector2< T > &av) const
comparison operator
Definition avect.h:99
AVector2(const Vector2< T > &)
Explicit conversion constructor, the z component is set to 0, the x and y values of v are lost.
Definition avect.h:54
T operator|(const AVector2< T > &v) const
Dot product.
Definition avect.h:120
const AVector2< T > & operator-=(const AVector2< T > &v)
in-place math operator
Definition avect.h:103
T & rdof(uint32 u)
Returns a reference to the z component if u=2, any other value of u is an error.
Definition avect.h:76
const AVector2< T > & operator/=(const AVector2< T > &v)
in-place math operator
Definition avect.h:106
AVector2(const Vector3< T > &v)
Explicit convertion contructor, the z component or v is copied but he x and y values are lost.
Definition avect.h:56
bool operator!=(const AVector2< T > &av) const
comparison operator
Definition avect.h:98
const AVector2< T > & operator*=(const AVector2< T > &v)
in-place math operator
Definition avect.h:104
const AVector2< T > & operator/=(const T &t)
in-place math operator
Definition avect.h:107
T mag2() const
The square of the magnitude, or the vector dotted with itself.
Definition avect.h:87
const AVector2< T > & operator+=(const AVector2< T > &v)
in-place math operator
Definition avect.h:102
void fill(const T &d)
Fill all components with d.
Definition avect.h:93
T & rz()
Returns a reference to the z component, cannot reference access x or y.
Definition avect.h:74
AVector2< T > operator+(const AVector2< T > &av) const
Binary math operator - require temp (till C++0x)
Definition avect.h:109
AVector2< T > operator*(const T &t) const
Binary math operator - require temp (till C++0x)
Definition avect.h:112
const T & z() const
Member access - returns the z component of the 2D angular vector.
Definition avect.h:63
T operator&(const AVector2< T > &) const
Cross product with another AVector2 will always return 0.0.
Definition avect.h:116
T volume() const
Volume represented by x*y*z, always returns 0.0.
Definition avect.h:90
AVector2< T > operator/(const T &t) const
Binary math operator - require temp (till C++0x)
Definition avect.h:114
const T & operator[](uint32 u) const
General degree-of-freedom access. If u is 2 returns the z component, otherwise returns 0....
Definition avect.h:83
AVector2< T > abs() const
Returns a vector of absolute values of components.
Definition avect.h:92
Vector3< T > operator&(const Vector3< T > &v) const
Cross product with a Vector3 produces a Vector3 (z=0)
Definition avect.h:118
constexpr T mag() const
The magnitude of the vector.
Definition avect.h:88
AVector2< T > operator/(const AVector2< T > &av) const
Binary math operator - require temp (till C++0x)
Definition avect.h:113
T area() const
Area represented by x*y, always returns 0.0.
Definition avect.h:89
const T & dof(uint32 u) const
General degree-of-freedom access. If u is 2 returns the z component, otherwise returns 0....
Definition avect.h:65
AVector2< T > operator*(const AVector2< T > &av) const
Binary math operator - require temp (till C++0x)
Definition avect.h:111
Vector2< T > toVector2() const
Converts to a Vector2(0,0)
Definition avect.h:124
Vector3< T > toVector3() const
Converts to a Vector3(0,0,z)
Definition avect.h:125
3D Angular vector class.
Definition avect.h:169
const Vector3< T > & toVector3() const
Converts to a Vector3 directly.
Definition avect.h:183
Vector2< T > toVector2() const
Converts to a Vector2, the z component is lost.
Definition avect.h:181
AVector3(const AVector2< T > &v)
Explicit conversion contructor from an AVector2, x=0, y=0, z=v.z.
Definition avect.h:178
2D vector utility class.
Definition vect.h:32
constexpr const T & x() const
X component access.
Definition vect.h:53
constexpr const T & y() const
Y component access.
Definition vect.h:55
3D vector utility class.
Definition vect.h:150
constexpr const T & y() const
The y-component of the vector.
Definition vect.h:169
constexpr const T & x() const
The x-component of the vector.
Definition vect.h:167
constexpr const T & z() const
The z-component of the vector.
Definition vect.h:171
Vector2< T > toVect2(const AVector3< T > &v)
Definition avect.h:246
AVector2< T > vceil(const AVector2< T > &v)
Definition avect.h:317
constexpr Vector3< T > toVect3(const Vector2< T > &v, const T &t=0)
Conversion between vectors of different dimension.
Definition vect.h:312
IAVect2 toIAVect2(const AVector2< T > &v)
Definition avect.h:205
DAVect3 toDAVect3(const Vector3< T > &v)
Definition avect.h:212
AVector3< T > vsign(const AVector3< T > &v1, const AVector3< T > &v2)
Definition avect.h:282
const AVector2< T > & toAVect2(const AVector2< T > &v)
Definition avect.h:253
UAVect2 toUAVect2(const AVector2< T > &v)
Definition avect.h:208
AVector2< T > vsign(const AVector2< T > &v1, const AVector2< T > &v2)
Definition avect.h:310
UAVect3 toAUVect3(const Vector3< T > &v)
Definition avect.h:233
FAVect2 toFAVect2(const AVector2< T > &v)
Definition avect.h:202
Vector3< T > operator&(const Vector3< T > &v, const AVector2< T > &av)
Definition avect.h:140
AVector3< T > vceil(const AVector3< T > &v)
Definition avect.h:289
AVector3< T > toAVect3(const AVector2< T > &v, const T &x=0, const T &y=0)
Definition avect.h:261
Vector2< T > operator&(const Vector2< T > &v, const AVector2< T > &av)
Definition avect.h:133
AVector2< T > vmin(const AVector2< T > &v1, const AVector2< T > &v2)
Definition avect.h:303
DAVect2 toDAVect2(const AVector2< T > &v)
Definition avect.h:199
FAVect3 toFAVect3(const Vector3< T > &v)
Definition avect.h:219
AVector2< T > toAVect2(const AVector3< T > &v)
Definition avect.h:257
Vector2< T > toVect2(const AVector2< T > &)
Definition avect.h:240
AVector2< T > vmax(const AVector2< T > &v1, const AVector2< T > &v2)
Definition avect.h:296
AVector3< T > vmax(const AVector3< T > &v1, const AVector3< T > &v2)
Definition avect.h:268
Vector3< T > toVect3(const AVector2< T > &v)
Definition avect.h:243
const Vector3< T > & toVect3(const AVector3< T > &v)
Definition avect.h:249
IAVect3 toAIVect3(const Vector3< T > &v)
Definition avect.h:226
AVector3< T > vmin(const AVector3< T > &v1, const AVector3< T > &v2)
Definition avect.h:275
const AVector3< T > & toAVect3(const AVector3< T > &v)
Definition avect.h:264
T operator|(const Vector2< T > &, const AVector2< T > &)
Definition avect.h:154
AVector2< T > operator&(const Vector2< T > &v1, const Vector2< T > &v2)
Definition avect.h:147
2D Angular vector class.
Definition avect.h:29
2D and 3D vector utility classes.