proj home

Files   Classes   Functions   Hierarchy  

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

List of all members.

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.

00443     {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.

00445     : 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.

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


Member Function Documentation

template<typename T>
T const point4< T >::dot ( point4< T > const &  q  )  const [inline]

Definition at line 521 of file point.h.

00522     { return x*q.x + y*q.y + z*q.z + w*q.w; }

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

Definition at line 519 of file point.h.

00520     { return x*x + y*y + z*z + w*w; }

template<typename T>
point4< T >::operator point3< T > const (  )  const [inline]

Definition at line 534 of file point.h.

References point4< T >::x, point4< T >::y, and point4< T >::z.

00535     { 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.

00450   { 
00451     string s;
00452     { stringstream ss; ss << x; s+=ss.str(); }
00453     s += " ";
00454     { stringstream ss; ss << y; s+=ss.str(); }
00455     s += " ";
00456     { stringstream ss; ss << z; s+=ss.str(); }
00457     s += " ";
00458     { stringstream ss; ss << w; s+=ss.str(); }
00459     return s;
00460   }

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.

00516     { if (x!=q.x) return true; if (y!=q.y) return true; 
00517       if (z!=q.z) return true; if (w!=q.w) return true; return false; }

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.

00506     { point4<T> t(*this); t.x*=q; t.y*=q; t.z*=q; t.w*=q; return t; }

template<typename T>
point4<T> const point4< T >::operator* ( point4< T > const &  p  )  const [inline]

Definition at line 479 of file point.h.

00480     { point4<T> t(*this); t*=p; return t; }

template<typename T>
template<typename W >
point4<T>& point4< T >::operator*= ( W const &  q  )  [inline]

Definition at line 502 of file point.h.

00503     { 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 477 of file point.h.

00478     { x*=p.x; y*=p.y; z*=p.z; w*=p.w; return *this; }

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.

00494     { 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  )  const [inline]

Definition at line 471 of file point.h.

00472     { point4<T> z(*this); z+=p; return z; } 

template<typename T>
template<typename W >
point4<T>& point4< T >::operator+= ( W const &  q  )  [inline]

Definition at line 490 of file point.h.

00491     { 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 469 of file point.h.

00470     { 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.

00476     { point4<T> z(*this); z-=p; return z; }

template<typename T>
point4<T>& point4< T >::operator-= ( point4< T > const &  p  )  [inline]

Definition at line 473 of file point.h.

00474     { x-=p.x; y-=p.y; z-=p.z; w-=p.w; return *this; }

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.

00512     { point4<T> t(*this); t.x/=q; t.y/=q; t.z/=q; t.w/=q; return t; }

template<typename T>
point4<T> const point4< T >::operator/ ( point4< T > const &  p  )  const [inline]

Definition at line 483 of file point.h.

00484     { point4<T> t(*this); t/=p; return t; }

template<typename T>
template<typename W >
point4<T>& point4< T >::operator/= ( W const &  q  )  [inline]

Definition at line 508 of file point.h.

00509     { 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 481 of file point.h.

00482     { x/=p.x; y/=p.y; z/=p.z; w/=p.w; return *this; }

template<typename T>
bool const point4< T >::operator== ( point4< T > const &  p  )  const [inline]

Definition at line 486 of file point.h.

00487     { return (x==p.x)&&(y==p.y)&&(z==p.z)&&(w==p.w); }

template<typename T>
T& point4< T >::operator[] ( uintc  i  )  [inline]

Definition at line 529 of file point.h.

00530     { uint k(i); k %= 4; if(k==0) return x; 
00531       if(k==1) return y; if(k==2) return z; return w; }

template<typename T>
T const& point4< T >::operator[] ( uintc  i  )  const [inline]

Definition at line 526 of file point.h.

00527     { uint k(i); k %= 4; if(k==0) return x; 
00528       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.

00464     { return os << x << " " << y << " " << z << " " << w; }

template<typename T>
istream& point4< T >::serializeInverse ( istream &  istr  )  [inline]

Definition at line 465 of file point.h.

00466     { return istr >> 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>>().

00462     {  stringstream ss(s); ss >> 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:

Generated on 27 Nov 2012 for Chelton Evans Source by  doxygen 1.6.1