From a0202ae7310caf2ec1113b2f54c4ff4bcdac1f59 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 16 Sep 2023 03:56:34 +0000 Subject: fix compilation failures introduced by recent changes git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4659 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pamtosvg/Makefile | 2 +- converter/other/pamtosvg/curve.c | 23 ++++++-------- converter/other/pamtosvg/epsilon.c | 2 -- converter/other/pamtosvg/fit.c | 60 +++++++++++++++++------------------ converter/other/pamtosvg/output-svg.c | 2 +- converter/other/pamtosvg/point.c | 2 +- converter/other/pamtosvg/spline.c | 10 +++--- converter/other/pamtosvg/spline.h | 3 +- converter/other/pamtosvg/vector.c | 2 +- 9 files changed, 49 insertions(+), 57 deletions(-) (limited to 'converter/other') diff --git a/converter/other/pamtosvg/Makefile b/converter/other/pamtosvg/Makefile index aba40ba5..d67281d5 100644 --- a/converter/other/pamtosvg/Makefile +++ b/converter/other/pamtosvg/Makefile @@ -20,7 +20,7 @@ ADDL_OBJECTS = \ curve.o \ point.o \ vector.o \ - epsilon-equal.o \ + epsilon.o \ autotrace.o \ pxl-outline.o \ bitmap.o \ diff --git a/converter/other/pamtosvg/curve.c b/converter/other/pamtosvg/curve.c index 369a0cd3..0785dde5 100644 --- a/converter/other/pamtosvg/curve.c +++ b/converter/other/pamtosvg/curve.c @@ -24,17 +24,17 @@ #include "curve.h" -static float_coord +static Point int_to_real_coord(pm_pixelcoord const int_coord) { /*---------------------------------------------------------------------------- Turn an integer point into a real one. -----------------------------------------------------------------------------*/ - float_coord real_coord; + Point real_coord; real_coord.x = int_coord.col; real_coord.y = int_coord.row; real_coord.z = 0.0; - + return real_coord; } @@ -76,13 +76,13 @@ void move_curve(curve * const dstP, curve * const srcP) { - /* Move ownership of dynamically allocated memory from source + /* Move ownership of dynamically allocated memory from source to destination; destroy source. */ if (CURVE_LENGTH(dstP) > 0) free(dstP->point_list); - + *dstP = *srcP; free(srcP); @@ -106,8 +106,8 @@ free_curve(curve * const curveP) { void -append_point(curve_type const curve, - float_coord const coord) { +append_point(curve_type const curve, + Point const coord) { CURVE_LENGTH(curve)++; REALLOCARRAY_NOFAIL(curve->point_list, CURVE_LENGTH(curve)); @@ -159,7 +159,7 @@ log_curve(curve * const curveP, /* If the curve is short enough, don't use ellipses. */ if (CURVE_LENGTH(curveP) <= NUM_TO_PRINT * 2) { unsigned int thisPoint; - + for (thisPoint = 0; thisPoint < CURVE_LENGTH(curveP); ++thisPoint) { LOG_CURVE_POINT(curveP, thisPoint, print_t); LOG(" "); @@ -276,7 +276,7 @@ new_curve_list_array (void) void free_curve_list_array(const curve_list_array_type * const curve_list_array, - at_progress_func notify_progress, + at_progress_func notify_progress, void * const client_data) { unsigned this_list; @@ -290,7 +290,7 @@ free_curve_list_array(const curve_list_array_type * const curve_list_array, client_data); free_curve_list(&CURVE_LIST_ARRAY_ELT (*curve_list_array, this_list)); } - + /* If the character was empty, it won't have any curves. */ if (curve_list_array->data != NULL) free(curve_list_array->data); @@ -308,6 +308,3 @@ append_curve_list(curve_list_array_type * const curve_list_array, CURVE_LIST_ARRAY_LENGTH(*curve_list_array)); LAST_CURVE_LIST_ARRAY_ELT (*curve_list_array) = curve_list; } - - - diff --git a/converter/other/pamtosvg/epsilon.c b/converter/other/pamtosvg/epsilon.c index d0c06560..0c914dae 100644 --- a/converter/other/pamtosvg/epsilon.c +++ b/converter/other/pamtosvg/epsilon.c @@ -1,5 +1,3 @@ -/* epsilon-equal.c: define a error resist compare. */ - #include #include "epsilon.h" diff --git a/converter/other/pamtosvg/fit.c b/converter/other/pamtosvg/fit.c index 9465ff75..627435cf 100644 --- a/converter/other/pamtosvg/fit.c +++ b/converter/other/pamtosvg/fit.c @@ -38,7 +38,7 @@ #include "vector.h" #include "curve.h" #include "pxl-outline.h" -#include "epsilon-equal.h" +#include "epsilon.h" #define CUBE(x) ((x) * (x) * (x)) @@ -1157,17 +1157,17 @@ splineLinearEnough(spline_type * const splineP, LOG ("Checking linearity:\n"); - A = END_POINT(*splineP).x - START_POINT(*splineP).x; - B = END_POINT(*splineP).y - START_POINT(*splineP).y; - C = END_POINT(*splineP).z - START_POINT(*splineP).z; + A = END_POINT(*splineP).x - BEG_POINT(*splineP).x; + B = END_POINT(*splineP).y - BEG_POINT(*splineP).y; + C = END_POINT(*splineP).z - BEG_POINT(*splineP).z; startEndDist = (float) (SQR(A) + SQR(B) + SQR(C)); LOG1("start_end_distance is %.3f.\n", sqrt(startEndDist)); LOG3(" Line endpoints are (%.3f, %.3f, %.3f) and ", - START_POINT(*splineP).x, - START_POINT(*splineP).y, - START_POINT(*splineP).z); + BEG_POINT(*splineP).x, + BEG_POINT(*splineP).y, + BEG_POINT(*splineP).z); LOG3("(%.3f, %.3f, %.3f)\n", END_POINT(*splineP).x, END_POINT(*splineP).y, END_POINT(*splineP).z); @@ -1180,9 +1180,9 @@ splineLinearEnough(spline_type * const splineP, float const t = CURVE_T(curve, thisPoint); Point const splinePoint = evaluate_spline(*splineP, t); - float const a = splinePoint.x - START_POINT(*splineP).x; - float const b = splinePoint.y - START_POINT(*splineP).y; - float const c = splinePoint.z - START_POINT(*splineP).z; + float const a = splinePoint.x - BEG_POINT(*splineP).x; + float const b = splinePoint.y - BEG_POINT(*splineP).y; + float const c = splinePoint.z - BEG_POINT(*splineP).z; float const w = (A*a + B*b + C*c) / startEndDist; @@ -1240,7 +1240,7 @@ fitWithLine(curve * const curveP) { LOG("Fitting with straight line:\n"); SPLINE_DEGREE(line) = LINEARTYPE; - START_POINT(line) = CONTROL1(line) = CURVE_POINT(curveP, 0); + BEG_POINT(line) = CONTROL1(line) = CURVE_POINT(curveP, 0); END_POINT(line) = CONTROL2(line) = LAST_CURVE_POINT(curveP); /* Make sure that this line is never changed to a cubic. */ @@ -1272,31 +1272,29 @@ fitOneSpline(curve * const curveP, Make it a cubic spline. -----------------------------------------------------------------------------*/ - /* We already have the start and end points of the spline, so all - we need are the control points. And we know in what direction - each control point is from its respective end point, so all we - need to figure out is its distance. (The control point's - distance from the end point is an indication of how long the - curve goes in its direction). + /* We already have the start and end points of the spline, so all we need + are the control points. And we know in what direction each control + point is from its respective end point, so all we need to figure out is + its distance. (The control point's distance from the end point is an + indication of how long the curve goes in its direction). - We call the distance from an end point to the associated control - point "alpha". + We call the distance from an end point to the associated control point + "alpha". - We want to find starting and ending alpha that minimize the - least-square error in approximating *curveP with the spline. + We want to find starting and ending alpha that minimize the + least-square error in approximating *curveP with the spline. - How we do that is a complete mystery to me, but the original author - said to see pp.57--59 of the Phoenix thesis. I haven't seen that. + How we do that is a complete mystery to me, but the original author + said to see pp. 57-59 of the Phoenix thesis. I haven't seen that. - In our expression of the math here, we use a struct with "beg" and - "end" members where the paper uses a matrix with "1" and "2" - subscripts, respectively. A C array is a closer match to a math - matrix, but we think the struct is easier to read. - - The B?(t) here corresponds to B_i^3(U_i) there. - The Bernstein polynomials of degree n are defined by - B_i^n(t) = { n \choose i } t^i (1-t)^{n-i}, i = 0..n + In our expression of the math here, we use a struct with "beg" and + "end" members where the paper uses a matrix with "1" and "2" + subscripts, respectively. A C array is a closer match to a math + matrix, but we think the struct is easier to read. + The B?(t) here corresponds to B_i^3(U_i) there. + The Bernstein polynomials of degree n are defined by + B_i^n(t) = { n \choose i } t^i (1-t)^{n-i}, i = 0..n */ struct VectorPair { Vector beg; diff --git a/converter/other/pamtosvg/output-svg.c b/converter/other/pamtosvg/output-svg.c index 53a8d4fd..13ac5201 100644 --- a/converter/other/pamtosvg/output-svg.c +++ b/converter/other/pamtosvg/output-svg.c @@ -82,7 +82,7 @@ out_splines(FILE * const fileP, (shape.centerline || splineList.open) ? "fill" : "stroke"); } fprintf(fileP, "M%g %g", - START_POINT(first).x, height - START_POINT(first).y); + BEG_POINT(first).x, height - BEG_POINT(first).y); outSplineList(fileP, splineList, height); diff --git a/converter/other/pamtosvg/point.c b/converter/other/pamtosvg/point.c index 94502d83..690f6d80 100644 --- a/converter/other/pamtosvg/point.c +++ b/converter/other/pamtosvg/point.c @@ -1,6 +1,6 @@ #include -#include "epsilon-equal.h" +#include "epsilon.h" #include "point.h" diff --git a/converter/other/pamtosvg/spline.c b/converter/other/pamtosvg/spline.c index 9535ec6a..6d867131 100644 --- a/converter/other/pamtosvg/spline.c +++ b/converter/other/pamtosvg/spline.c @@ -18,15 +18,15 @@ 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); } diff --git a/converter/other/pamtosvg/spline.h b/converter/other/pamtosvg/spline.h index b0a731f8..cfdce248 100644 --- a/converter/other/pamtosvg/spline.h +++ b/converter/other/pamtosvg/spline.h @@ -18,10 +18,9 @@ typedef at_spline_type spline_type; #define ELLIPSETYPE AT_ELLIPSETYPE #define CIRCLETYPE AT_CIRCLETYPE -#define START_POINT(spl) ((spl).v[0]) +#define BEG_POINT(spl) ((spl).v[0]) #define CONTROL1(spl) ((spl).v[1]) #define CONTROL2(spl) ((spl).v[2]) -#define BEG_POINT(spl) ((spl).v[0]) #define END_POINT(spl) ((spl).v[3]) #define SPLINE_DEGREE(spl) ((spl).degree) #define SPLINE_LINEARITY(spl) ((spl).linearity) diff --git a/converter/other/pamtosvg/vector.c b/converter/other/pamtosvg/vector.c index e91c6a24..8972f4a5 100644 --- a/converter/other/pamtosvg/vector.c +++ b/converter/other/pamtosvg/vector.c @@ -10,7 +10,7 @@ #include "vector.h" #include "message.h" -#include "epsilon-equal.h" +#include "epsilon.h" static float acosD(float const v, -- cgit 1.4.1