00001 #ifndef NURBS_DEFS_H_
00002 #define NURBS_DEFS_H_
00003
00004 #include <fmatvec/fmatvec.h>
00005
00006 namespace fmatvec {
00010 template <int N>
00011 class Point : public Vector<Fixed<N>, double> {
00012 public:
00013 Point<N>();
00014
00015 Point<N>(Vector<Fixed<N>, double> pnt);
00016
00017 virtual ~Point<N>();
00018
00019 protected:
00020 };
00021
00022 template <int N>
00023 Point<N>::Point() :
00024 Vector<Fixed<N>, double>() {
00025
00026 }
00027
00028 template <int N>
00029 Point<N>::Point(Vector<Fixed<N>, double> pnt) :
00030 Vector<Fixed<N>, double>(pnt) {
00031 }
00032
00033
00034 template <int N>
00035 Point<N>::~Point() {
00036 }
00037
00041 template <int N>
00042 class HPoint : public Vector<Fixed<N + 1>, double> {
00043 public:
00044 HPoint<N>();
00045
00046 HPoint<N>(Vector<Fixed<N + 1>, double> pnt);
00047
00048 virtual ~HPoint<N>();
00049
00050 Point<N> projectW();
00051
00052 double w();
00053
00054 double w() const;
00055
00056 protected:
00057 };
00058
00059 template <int N>
00060 HPoint<N>::HPoint() :
00061 Vector<Fixed<N + 1>, double>() {
00062 }
00063
00064 template <int N>
00065 HPoint<N>::HPoint(Vector<Fixed<N + 1>, double> pnt) :
00066 Vector<Fixed<N + 1>, double>(pnt) {
00067 }
00068
00069 template <int N>
00070 HPoint<N>::~HPoint() {
00071 }
00072
00073 template <int N>
00074 Point<N> HPoint<N>::projectW() {
00075 Point<N> pnt;
00076 for (int i = 0; i < N; i++)
00077 pnt(i) = (*this)(i);
00078 return pnt;
00079 }
00080
00081 template <int N>
00082 double HPoint<N>::w() {
00083 return (*this)(N);
00084 }
00085
00086 template <int N>
00087 double HPoint<N>::w() const {
00088 return (*this)(N);
00089 }
00090
00091
00092 template <int N>
00093 Point<N> project(const HPoint<N> & hPnt) {
00094 Point<N> pnt;
00095 for (int i = 0; i < N; i++)
00096 pnt(i) = hPnt(i) / hPnt.w();
00097 return pnt;
00098 }
00099
00100 }
00101
00102 #endif