proj home

Files   Classes   Functions   Hierarchy  

Public Member Functions | Public Attributes | List of all members
point4< T > Class Template Reference

4D point. More...

#include <point.h>

Inheritance diagram for point4< T >:
Inheritance graph
Collaboration diagram for point4< T >:
Collaboration graph

Public Member Functions

 point4 ()
 point4 (T x0, T y0, T z0, T w0)
 point4 (point4< T > const &p)
 operator stringc () const
 Write this point out to the string.
void serializeInverse (stringc &s)
ostreamprint (ostream &os) const
istream & serializeInverse (istream &istr)
point4< T > & operator+= (point4< T > const &p)
point4< Toperator+ (point4< T > const &p) const
point4< T > & operator-= (point4< T > const &p)
point4< T > const operator-= (point4< T > const &p) const
point4< T > & operator*= (point4< T > const &p)
point4< T > const operator* (point4< T > const &p) const
point4< T > & operator/= (point4< T > const &p)
point4< T > const operator/ (point4< T > const &p) const
bool const operator== (point4< T > const &p) const
template<typename W >
point4< T > & operator+= (W const &q)
template<typename W >
point4< T > const operator+ (W const &q) const
template<typename W >
point4< T > & operator*= (W const &q)
template<typename W >
point4< T > const operator* (W const &q) const
template<typename W >
point4< T > & operator/= (W const &q)
template<typename W >
point4< T > const operator/ (W const &q) const
template<typename W >
boolc operator!= (W const &q) const
 Not test applied to each element.
T const dot () const
T const dot (point4< T > const &q) const
T const & operator[] (uintc i) const
Toperator[] (uintc i)
 operator point3< T > const () const

Public Attributes

T x
T y
T z
T w

Detailed Description

template<typename T>
class point4< T >

4D point.

Definition at line 433 of file point.h.

Constructor & Destructor Documentation

template<typename T>
point4< T >::point4 ( )
inline

Definition at line 442 of file point.h.

{x = y = z = w = 0; }
template<typename T>
point4< T >::point4 ( T  x0,
T  y0,
T  z0,
T  w0 
)
inline

Definition at line 444 of file point.h.

: x(x0), y(y0), z(z0), w(w0) {}
template<typename T>
point4< T >::point4 ( point4< T > const &  p)
inline

Definition at line 446 of file point.h.

: x(p.x), y(p.y), z(p.z), w(p.w) {}

Member Function Documentation

template<typename T>
T const point4< T >::dot ( ) const
inline

Definition at line 519 of file point.h.

{ return x*x + y*y + z*z + w*w; }
template<typename T>
T const point4< T >::dot ( point4< T > const &  q) const
inline

Definition at line 521 of file point.h.

{ return x*q.x + y*q.y + z*q.z + w*q.w; }
template<typename T>
point4< T >::operator point3< T > const ( ) const
inline

Definition at line 534 of file point.h.

{ return point3<T>(x,y,z); }
template<typename T>
point4< T >::operator stringc ( ) const
inline

Write this point out to the string.

Definition at line 449 of file point.h.

{
string s;
{ stringstream ss; ss << x; s+=ss.str(); }
s += " ";
{ stringstream ss; ss << y; s+=ss.str(); }
s += " ";
{ stringstream ss; ss << z; s+=ss.str(); }
s += " ";
{ stringstream ss; ss << w; s+=ss.str(); }
return s;
}
template<typename T>
template<typename W >
boolc point4< T >::operator!= ( W const &  q) const
inline

Not test applied to each element.

Definition at line 515 of file point.h.

{ if (x!=q.x) return true; if (y!=q.y) return true;
if (z!=q.z) return true; if (w!=q.w) return true; return false; }
template<typename T>
point4<T> const point4< T >::operator* ( point4< T > const &  p) const
inline

Definition at line 479 of file point.h.

{ point4<T> t(*this); t*=p; return t; }
template<typename T>
template<typename W >
point4<T> const point4< T >::operator* ( W const &  q) const
inline

Definition at line 505 of file point.h.

{ point4<T> t(*this); t.x*=q; t.y*=q; t.z*=q; t.w*=q; return t; }
template<typename T>
point4<T>& point4< T >::operator*= ( point4< T > const &  p)
inline

Definition at line 477 of file point.h.

{ x*=p.x; y*=p.y; z*=p.z; w*=p.w; return *this; }
template<typename T>
template<typename W >
point4<T>& point4< T >::operator*= ( W const &  q)
inline

Definition at line 502 of file point.h.

{ x*=q; y*=q; z*=q; w*=q; return *this; }
template<typename T>
point4<T> point4< T >::operator+ ( point4< T > const &  p) const
inline

Definition at line 471 of file point.h.

{ point4<T> z(*this); z+=p; return z; }
template<typename T>
template<typename W >
point4<T> const point4< T >::operator+ ( W const &  q) const
inline

Definition at line 493 of file point.h.

{ point4<T> t(*this); t.x+=q; t.y+=q; t.z+=q; t.w+=q; return t; }
template<typename T>
point4<T>& point4< T >::operator+= ( point4< T > const &  p)
inline

Definition at line 469 of file point.h.

{ x+=p.x; y+=p.y; z+=p.z; w+=p.w; return *this; }
template<typename T>
template<typename W >
point4<T>& point4< T >::operator+= ( W const &  q)
inline

Definition at line 490 of file point.h.

{ x+=q; y+=q; z+=q; w+=q; return *this; }
template<typename T>
point4<T>& point4< T >::operator-= ( point4< T > const &  p)
inline

Definition at line 473 of file point.h.

{ x-=p.x; y-=p.y; z-=p.z; w-=p.w; return *this; }
template<typename T>
point4<T> const point4< T >::operator-= ( point4< T > const &  p) const
inline

Definition at line 475 of file point.h.

{ point4<T> z(*this); z-=p; return z; }
template<typename T>
point4<T> const point4< T >::operator/ ( point4< T > const &  p) const
inline

Definition at line 483 of file point.h.

{ point4<T> t(*this); t/=p; return t; }
template<typename T>
template<typename W >
point4<T> const point4< T >::operator/ ( W const &  q) const
inline

Definition at line 511 of file point.h.

{ point4<T> t(*this); t.x/=q; t.y/=q; t.z/=q; t.w/=q; return t; }
template<typename T>
point4<T>& point4< T >::operator/= ( point4< T > const &  p)
inline

Definition at line 481 of file point.h.

{ x/=p.x; y/=p.y; z/=p.z; w/=p.w; return *this; }
template<typename T>
template<typename W >
point4<T>& point4< T >::operator/= ( W const &  q)
inline

Definition at line 508 of file point.h.

{ x/=q; y/=q; z/=q; w/=q; return *this; }
template<typename T>
bool const point4< T >::operator== ( point4< T > const &  p) const
inline

Definition at line 486 of file point.h.

{ return (x==p.x)&&(y==p.y)&&(z==p.z)&&(w==p.w); }
template<typename T>
T const& point4< T >::operator[] ( uintc  i) const
inline

Definition at line 526 of file point.h.

{ uint k(i); k %= 4; if(k==0) return x;
if(k==1) return y; if(k==2) return z; return w; }
template<typename T>
T& point4< T >::operator[] ( uintc  i)
inline

Definition at line 529 of file point.h.

{ uint k(i); k %= 4; if(k==0) return x;
if(k==1) return y; if(k==2) return z; return w; }
template<typename T>
ostream& point4< T >::print ( ostream os) const
inline

Definition at line 463 of file point.h.

{ return os << x << " " << y << " " << z << " " << w; }
template<typename T>
void point4< T >::serializeInverse ( stringc s)
inline

Definition at line 461 of file point.h.

Referenced by operator>>().

{ stringstream ss(s); ss >> x >> y >> z >> w; }
template<typename T>
istream& point4< T >::serializeInverse ( istream &  istr)
inline

Definition at line 465 of file point.h.

{ return istr >> x >> y >> z >> w; }

Member Data Documentation

template<typename T>
T point4< T >::w
template<typename T>
T point4< T >::x
template<typename T>
T point4< T >::y
template<typename T>
T point4< T >::z

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