point.h

Go to the documentation of this file.
00001 /**
00002  *\file         point.h
00003  *
00004  *\brief
00005  *              
00006  *
00007  *\author       Xianming Chen\n
00008  *              Computer Science Department\n
00009  *              University of Utah
00010  *
00011  *\date         14 Aug 2006\n
00012  *              Copyright (c) 2006, University of Utah
00013  */
00014 
00015 
00016 #ifndef _POINT_H
00017 #define _POINT_H
00018 
00019 
00020 #include <cassert>
00021 #include <iosfwd>
00022 
00023 namespace euler
00024 {
00025   const float pi = 3.14159265;
00026   
00027   class point_t
00028   {
00029       float p[4];
00030   public:
00031       float& operator[](int i)                                          { return p[i]; }
00032       float const& operator[](int i) const                              { return p[i]; }
00033       point_t(float x=.0f, float y=.0f, float z=.0f, float w=1.0f)      { p[0] = x, p[1] = y, p[2] = z, p[3] = w; }
00034 
00035       point_t operator+(point_t const& r) const                         { assert(p[3] == r[3]); point_t ret(*this);  return ret += r; }
00036       point_t& operator+=(point_t const& r)                             { assert(p[3] == r[3]); for(int i=0; i<3; i++) p[i] += r[i]; return *this; }
00037   };
00038 
00039   std::ostream& operator<<(std::ostream& os, point_t const& p);
00040   
00041   typedef point_t vector_t;
00042 
00043 }//end namespace euler
00044 
00045 
00046 #endif

Generated on Wed Aug 30 16:27:58 2006 for euler by  doxygen 1.4.6