Fresco/Berlin/include/Berlin/nurbs Vertex.hh,1.1,1.2 array.hh,1.1,1.2 domain.hh,1.1,1.2 nurbs.hh,1.1,1.2 point.hh,1.1,1.2

Stefan Seefeld <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Berlin/include/Berlin/nurbs
In directory purcel:/tmp/cvs-serv10923/include/Berlin/nurbs

Modified Files:
	Vertex.hh array.hh domain.hh nurbs.hh point.hh 
Log Message:
little fixes and integration into the build system

Index: Vertex.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/nurbs/Vertex.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Vertex.hh	25 Apr 2003 16:46:49 -0000	1.1
+++ Vertex.hh	25 Apr 2003 18:41:13 -0000	1.2
@@ -22,23 +22,31 @@
 #ifndef _Berlin_nurbs_Vertex_hh
 #define _Berlin_nurbs_Vertex_hh
 
+#include <Fresco/Types.hh>
+
 namespace Berlin
 {
 namespace nurbs
 {
 
-inline Vertex make_vertex(double x, double y, double z)
+inline Fresco::Vertex make_vertex(Fresco::Coord x,
+                                  Fresco::Coord y,
+                                  Fresco::Coord z)
 {
-  Vertex v;
+  Fresco::Vertex v;
   v.x = x;
   v.y = y;
   v.z = z;
   return v;
 }
 
-inline Vertex &assign(Vertex &v, double s) { v.x = v.y = v.z = s; return v;}
+inline Fresco::Vertex &assign(Fresco::Vertex &v, Fresco::Coord s)
+{
+  v.x = v.y = v.z = s;
+  return v;
+}
 
-inline Vertex &operator+=(Vertex &p, const Vertex &q)
+inline Fresco::Vertex &operator+=(Fresco::Vertex &p, const Fresco::Vertex &q)
 {
   p.x += q.x;
   p.y += q.y;
@@ -46,7 +54,7 @@
   return p;
 }
 
-inline Vertex &operator-=(Vertex &p, const Vertex &q)
+inline Fresco::Vertex &operator-=(Fresco::Vertex &p, const Fresco::Vertex &q)
 {
   p.x -= q.x;
   p.y -= q.y;
@@ -54,7 +62,7 @@
   return p;
 }
 
-inline Vertex &operator*=(Vertex &v, double s)
+inline Fresco::Vertex &operator*=(Fresco::Vertex &v, Fresco::Coord s)
 {
   v.x *= s;
   v.y *= s;
@@ -62,7 +70,7 @@
   return v;
 }
 
-inline Vertex &operator/=(Vertex &v, double s)
+inline Fresco::Vertex &operator/=(Fresco::Vertex &v, Fresco::Coord s)
 {
   v.x /= s;
   v.y /= s;
@@ -70,36 +78,41 @@
   return v;
 }
 
-inline Vertex operator+(const Vertex &p, const Vertex &q)
+inline Fresco::Vertex operator+(const Fresco::Vertex &p,
+                                const Fresco::Vertex &q)
 {
-  Vertex result(p);
+  Fresco::Vertex result(p);
   return result += q;
 }
 
-inline Vertex operator-(const Vertex &p, const Vertex &q)
+inline Fresco::Vertex operator-(const Fresco::Vertex &p,
+                                const Fresco::Vertex &q)
 {
-  Vertex result(p);
+  Fresco::Vertex result(p);
   return result -= q;
 }
 
-inline Vertex operator*(const Vertex &p, double scalar)
+inline Fresco::Vertex operator*(const Fresco::Vertex &p,
+                                Fresco::Coord scalar)
 {
-  Vertex result(p);
+  Fresco::Vertex result(p);
   return result *= scalar;
 }
 
-inline Vertex operator/(const Vertex &p, double scalar)
+inline Fresco::Vertex operator/(const Fresco::Vertex &p,
+                                Fresco::Coord scalar)
 {
-  Vertex result(p);
+  Fresco::Vertex result(p);
   return result /= scalar;
 }
 
-inline double scalar(const Vertex &p, const Vertex &q)
+inline Fresco::Coord scalar(const Fresco::Vertex &p,
+                            const Fresco::Vertex &q)
 {
   return p.x * q.x + p.y * q.y + p.z * q.z;
 }
 
-inline double norm(const Vertex &p)
+inline Fresco::Coord norm(const Fresco::Vertex &p)
 {
   return std::sqrt(scalar(p, p));
 }

Index: array.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/nurbs/array.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- array.hh	25 Apr 2003 16:46:49 -0000	1.1
+++ array.hh	25 Apr 2003 18:41:13 -0000	1.2
@@ -27,6 +27,7 @@
 namespace nurbs
 {
 
+//. an STL compliant container wrapper for arrays of constant size
 template<class T, std::size_t N>
 class array 
 {

Index: domain.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/nurbs/domain.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- domain.hh	25 Apr 2003 16:46:49 -0000	1.1
+++ domain.hh	25 Apr 2003 18:41:13 -0000	1.2
@@ -31,6 +31,7 @@
 namespace nurbs
 {
 
+//. a multidimensional index
 template <size_t D>
 struct index
 {
@@ -46,11 +47,14 @@
   size_t values[D+1];
 };
 
+//. a domain defines a D-dimensional container of Ts
 template <typename T, size_t D> 
 class domain
 {
 public:
   typedef size_t vector_index;
+  //. Helper object for indexing:
+  //. Example: domain(index[1][2])
   static const nurbs::index<0> index;
   static const size_t dimensions = D;
 

Index: nurbs.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/nurbs/nurbs.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- nurbs.hh	25 Apr 2003 16:46:49 -0000	1.1
+++ nurbs.hh	25 Apr 2003 18:41:13 -0000	1.2
@@ -33,6 +33,9 @@
 namespace nurbs
 {
 
+//. a 'weighted T' is a T with an
+//. associated weighting factor
+//. (used to implement the 'R' in NURBS)
 template <typename T>
 struct Weighted
 {
@@ -40,6 +43,9 @@
   double denominator;
 };
 
+//. basis function used in nurbs:
+//. i and d are indices, p is the actual parameter,
+//. K is the knot vector
 template <typename K>
 double basis_function(size_t i, size_t d, double p, const K &k)
 {
@@ -72,6 +78,9 @@
   return 0.;
 }
 
+//. computes derivative of a basis function:
+//. i and d are indices, p is the actual parameter,
+//. K is the knot vector
 template <typename K>
 double basis_function_derivative(size_t i, size_t d, double p, const K &k)
 {
@@ -434,6 +443,8 @@
   }
 }
 
+//. return a P-dimensional domain of points
+//. assume uniform knots
 template <typename T, size_t P>
 domain<T, P> *evaluate(const domain<T, P> &ctrls,
                        const domain<double, P> &weights,
@@ -451,6 +462,7 @@
   return eval(ctrls, weights, degrees, knots, steps);
 }
 
+//. return a P-dimensional domain of points
 template <typename T, size_t P>
 domain<T, P> *evaluate(const domain<T, P> &ctrls,
                        const domain<double, P> &weights,
@@ -461,6 +473,9 @@
   return eval(ctrls, weights, degrees, knots, steps);
 }
 
+//. return a P-dimensional domain of points arrays
+//. each array contains the actual point and the P derivatives
+//. assume uniform knots
 template <typename T, size_t P>
 domain<array<T, P + 1>, P> *
 evaluate_with_derivations(const domain<T, P> &ctrls,
@@ -479,6 +494,8 @@
   return eval_with_derivations(ctrls, weights, degrees, knots, steps);
 }
 
+//. return a P-dimensional domain of points arrays
+//. each array contains the actual point and the P derivatives
 template <typename T, size_t P>
 domain<array<T, P + 1>, P> *
 evaluate_with_derivations(const domain<T, P> &ctrls,

Index: point.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/nurbs/point.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- point.hh	25 Apr 2003 16:46:49 -0000	1.1
+++ point.hh	25 Apr 2003 18:41:13 -0000	1.2
@@ -27,6 +27,8 @@
 namespace nurbs
 {
 
+//. a simple D-dimensional point
+//. mostly used to test nurbs routines
 template <typename T, size_t D>
 class point
 {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.