about summary refs log tree commit diff
path: root/converter/other/pamtosvg/spline.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/pamtosvg/spline.c')
-rw-r--r--converter/other/pamtosvg/spline.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/converter/other/pamtosvg/spline.c b/converter/other/pamtosvg/spline.c
index 61167ec4..a62ce895 100644
--- a/converter/other/pamtosvg/spline.c
+++ b/converter/other/pamtosvg/spline.c
@@ -18,23 +18,24 @@ print_spline (FILE *f, spline_type s)
 
   if (SPLINE_DEGREE (s) == LINEARTYPE)
     fprintf (f, "(%.3f,%.3f)--(%.3f,%.3f).\n",
-                START_POINT (s).x, START_POINT (s).y,
+                BEG_POINT (s).x, BEG_POINT (s).y,
                 END_POINT (s).x, END_POINT (s).y);
 
   else if (SPLINE_DEGREE (s) == CUBICTYPE)
     fprintf (f, "(%.3f,%.3f)..ctrls(%.3f,%.3f)&(%.3f,%.3f)..(%.3f,%.3f).\n",
-                START_POINT (s).x, START_POINT (s).y,
-                CONTROL1 (s).x, CONTROL1 (s).y,
-                CONTROL2 (s).x, CONTROL2 (s).y,
-                END_POINT (s).x, END_POINT (s).y);
+             BEG_POINT (s).x, BEG_POINT (s).y,
+             CONTROL1  (s).x, CONTROL1  (s).y,
+             CONTROL2  (s).x, CONTROL2  (s).y,
+             END_POINT (s).x, END_POINT (s).y);
 }
 
 
+
 /* Evaluate the spline S at a given T value.  This is an implementation
    of de Casteljau's algorithm.  See Schneider's thesis, p.37.
    The variable names are taken from there.  */
 
-float_coord
+Point
 evaluate_spline (spline_type s, float t)
 {
   spline_type V[4];    /* We need degree+1 splines, but assert degree <= 3.  */
@@ -52,9 +53,9 @@ evaluate_spline (spline_type s, float t)
   for (j = 1; j <= degree; j++)
     for (i = 0; i <= degree - j; i++)
       {
-        float_coord t1 = Pmult_scalar (V[j - 1].v[i], one_minus_t);
-        float_coord t2 = Pmult_scalar (V[j - 1].v[i + 1], t);
-        float_coord temp = Padd (t1, t2);
+        Point t1 = point_scaled(V[j - 1].v[i], one_minus_t);
+        Point t2 = point_scaled(V[j - 1].v[i + 1], t);
+        Point temp = point_sum(t1, t2);
         V[j].v[i].x = temp.x;
         V[j].v[i].y = temp.y;
         V[j].v[i].z = temp.z;
@@ -64,6 +65,7 @@ evaluate_spline (spline_type s, float t)
 }
 
 
+
 /* Return a new, empty, spline list.  */
 
 spline_list_type *
@@ -76,7 +78,9 @@ new_spline_list (void)
   return answer;
 }
 
-spline_list_type 
+
+
+spline_list_type
 empty_spline_list (void)
 {
   spline_list_type answer;
@@ -85,6 +89,8 @@ empty_spline_list (void)
   return answer;
 }
 
+
+
 /* Return a new spline list with SPLINE as the first element.  */
 
 spline_list_type *
@@ -101,6 +107,7 @@ new_spline_list_with_spline (spline_type spline)
 }
 
 
+
 /* Free the storage in a spline list.  We don't have to free the
    elements, since they are arrays in automatic storage.  And we don't
    want to free the list if it was empty.  */
@@ -115,6 +122,7 @@ free_spline_list(spline_list_type spline_list) {
 }
 
 
+
 /* Append the spline S to the list SPLINE_LIST.  */
 
 void
@@ -128,6 +136,7 @@ append_spline (spline_list_type *l, spline_type s)
 }
 
 
+
 /* Tack the elements in the list S2 onto the end of S1.
    S2 is not changed.  */
 
@@ -149,6 +158,7 @@ concat_spline_lists (spline_list_type *s1, spline_list_type s2)
 }
 
 
+
 /* Return a new, empty, spline list array.  */
 
 spline_list_array_type
@@ -163,6 +173,7 @@ new_spline_list_array (void)
 }
 
 
+
 /* Free the storage in a spline list array.  We don't
    want to free the list if it is empty.  */
 void
@@ -182,6 +193,7 @@ free_spline_list_array (spline_list_array_type *spline_list_array)
 }
 
 
+
 /* Append the spline S to the list SPLINE_LIST_ARRAY.  */
 
 void
@@ -193,3 +205,5 @@ append_spline_list (spline_list_array_type *l, spline_list_type s)
   LAST_SPLINE_LIST_ARRAY_ELT (*l) = s;
 }
 
+
+