00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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 }
00044
00045
00046 #endif