From: Barak Itkin Date: Fri, 4 May 2012 20:25:53 +0000 (+0300) Subject: Fix the rendering code to use the library API X-Git-Tag: p2tc-0.1.0~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=650dc3f98df265fdebe4f4aae7cb3b5c1c293706;p=poly2tri-c Fix the rendering code to use the library API --- diff --git a/refine/refine.h b/refine/refine.h new file mode 100644 index 0000000..038ef0d --- /dev/null +++ b/refine/refine.h @@ -0,0 +1,22 @@ +#ifndef __P2TC_REFINE_H__ +#define __P2TC_REFINE_H__ + +#include "utils.h" +#include "math.h" + +#include "vector2.h" +#include "circle.h" +#include "line.h" +#include "bounded-line.h" +#include "pslg.h" + +#include "point.h" +#include "edge.h" +#include "triangle.h" +#include "mesh.h" + +#include "cluster.h" +#include "cdt.h" +#include "delaunay-terminator.h" + +#endif \ No newline at end of file diff --git a/render/mesh-render.c b/render/mesh-render.c index 912b0dc..50ba8b7 100755 --- a/render/mesh-render.c +++ b/render/mesh-render.c @@ -1,71 +1,26 @@ #include #include #include -#include +#include #include "mesh-render.h" /* Most computations using the Barycentric Coordinates are Based on * http://www.blackpawn.com/texts/pointinpoly/default.html */ /* This function is simply to make sure the code is consitant */ -void -p2tr_triangle_barycentric_get_points (P2tRTriangle *self, - P2tRPoint **A, - P2tRPoint **B, - P2tRPoint **C) +static inline void +p2tr_triangle_barycentric_get_points (P2trTriangle *self, + P2trPoint **A, + P2trPoint **B, + P2trPoint **C) { - *A = p2tr_edge_get_end (self->edges[2]); - *B = p2tr_edge_get_end (self->edges[0]); - *C = p2tr_edge_get_end (self->edges[1]); + *A = P2TR_TRIANGLE_GET_POINT(self, 0); + *B = P2TR_TRIANGLE_GET_POINT(self, 1); + *C = P2TR_TRIANGLE_GET_POINT(self, 2); } #define USE_BARYCENTRIC(u,v,A,B,C) ((A) + (v)*((B)-(A)) + (u)*((C)-(A))) -gboolean -p2tr_triangle_compute_barycentric_coords (P2tRTriangle *tr, - gdouble Px, - gdouble Py, - gdouble *u_out, - gdouble *v_out) -{ - P2tRPoint *A, *B, *C; - - gdouble u, v; - gdouble v0x, v0y, v1x, v1y, v2x, v2y; - gdouble dot00, dot01, dot02, dot11, dot12; - gdouble invDenom; - - p2tr_triangle_barycentric_get_points (tr, &A, &B, &C); - - /* v0 = C-A */ - v0x = C->x - A->x; - v0y = C->y - A->y; - /* v1 = B-A */ - v1x = B->x - A->x; - v1y = B->y - A->y; - /* v2 = P-A */ - v2x = Px - A->x; - v2y = Py - A->y; - - /* Compute dot products */ - dot00 = v0x * v0x + v0y * v0y; - dot01 = v0x * v1x + v0y * v1y; - dot02 = v0x * v2x + v0y * v2y; - dot11 = v1x * v1x + v1y * v1y; - dot12 = v1x * v2x + v1y * v2y; - - /* Compute barycentric coordinates */ - invDenom = 1 / (dot00 * dot11 - dot01 * dot01); - - /* P = A + v*(B-A) + u*(C-A) */ - *u_out = u = (dot11 * dot02 - dot01 * dot12) * invDenom; - *v_out = v = (dot00 * dot12 - dot01 * dot02) * invDenom; - - /* Check if point is in triangle */ - return (u > -EPSILON2) && (v > -EPSILON2) && (u + v < 1 + EPSILON2); - -} - /* This function implements box logic to see if a point is contained in a * triangles bounding box. This is very useful for cases where there are many * triangles to test against a single point, and most of them aren't even near @@ -77,118 +32,19 @@ p2tr_triangle_compute_barycentric_coords (P2tRTriangle *tr, * See http://lightningismyname.blogspot.com/2011/08/quickboxa-quick-point-in-triangle-test.html */ gboolean -p2tr_triangule_quick_box_test (P2tRTriangle *self, +p2tr_triangule_quick_box_test (P2trTriangle *self, gdouble Px, gdouble Py) { - P2tRPoint *A = p2tr_edge_get_end (self->edges[2]); - P2tRPoint *B = p2tr_edge_get_end (self->edges[0]); - P2tRPoint *C = p2tr_edge_get_end (self->edges[1]); - - register gboolean xPBorder = B->x <= Px; - register gboolean yPBorder = B->y <= Py; - - return (((A->x <= Px) == xPBorder) && (xPBorder == (C->x <= Px))) - || (((A->y <= Py) == yPBorder) && (yPBorder == (C->y <= Py))); -} -/** - * p2tr_triangulation_locate_point2: - * @T: A triangulation object - * @X: The point to locate - * @guess: Some triangle near the point, or NULL if not known. - * WARNING! The triangle must be inside the same continuos region as the - * point! If not, this function may return wrong values! - * - * Returns: A triangle containing the point, or NULL if the point is outside the - * triangulation domain. - */ -P2tRTriangle* -p2tr_triangulation_locate_point2 (P2tRTriangulation *T, - gdouble Px, - gdouble Py, - P2tRTriangle *guess, - gdouble *u, - gdouble *v) -{ - if (guess == NULL || ! p2tr_hash_set_contains (T->tris, guess)) - { - /* If we have nothing, check all the triangles. - * TODO: This can probably be improved by sampling several triangles at - * random, picking the closest and using it as a guess.*/ - P2tRTriangle *tr = NULL; - P2trHashSetIter iter; - p2tr_hash_set_iter_init (&iter, T->tris); - while (p2tr_hash_set_iter_next (&iter, (gpointer*)&tr)) - { - if (p2tr_triangule_quick_box_test (tr, Px, Py)) - continue; - else if (p2tr_triangle_compute_barycentric_coords (tr, Px, Py, u, v)) - return tr; - } - return NULL; - } - else - { - /* Maintain a set of checked triangles, and a queue of ones to check. - * For each triangle in the queue, check if it has the point, and if not - * then add it's neighbors at the end of the queue. This also gaurantess - * to some level a search that starts local around the triangles and only - * goes farther if needed. */ - P2tRHashSet *checked = p2tr_hash_set_set_new (g_direct_hash, g_direct_equal, NULL); - P2tRTriangle *result = NULL, *current = NULL; - GQueue tris; - gint i; - - g_queue_init (&tris); - g_queue_push_tail (&tris, guess); - - while (! g_queue_is_empty (&tris)) - { - current = (P2tRTriangle*) g_queue_pop_head (&tris); - if (p2tr_triangle_compute_barycentric_coords (current, Px, Py, u, v)) - { - result = current; - break; - } - else for (i = 0; i < 3; i++) - { - P2tRTriangle *neighbor = current->edges[i]->mirror->tri; - if (neighbor != NULL && ! p2tr_hash_set_contains (checked, neighbor)) - g_queue_push_tail (&tris, current->edges[i]->mirror->tri); - } - - p2tr_hash_set_insert (checked, current); - } - - /* If the queue is empty, then we have nothing to free. It's struct is - * allocated directly on the stack and it has nothing dynamic in it. */ - - g_hash_table_destroy (checked); - - return result; - } -} - -void p2tr_test_point_to_color (P2tRPoint* point, gfloat *dest, gpointer user_data) -{ -/* - GRand* sr = g_rand_new_with_seed ((*((guchar*)&point->x)) ^ (*((guchar*)&point->y))); - gfloat temp; + P2trPoint *A = self->edges[2]->end; + P2trPoint *B = self->edges[0]->end; + P2trPoint *C = self->edges[1]->end; - temp = (gfloat) g_rand_double (sr); - dest[0] = ABS (temp); + register gboolean xPBorder = B->c.x <= Px; + register gboolean yPBorder = B->c.y <= Py; - temp = (gfloat) g_rand_double (sr); - dest[1] = ABS (temp); - - temp = (gfloat) g_rand_double (sr); - dest[2] = ABS (temp); - - dest[3] = 1; -*/ - dest[0] = 0; - dest[1] = 0.5; - dest[2] = 1; + return (((A->c.x <= Px) == xPBorder) && (xPBorder == (C->c.x <= Px))) + || (((A->c.y <= Py) == yPBorder) && (yPBorder == (C->c.y <= Py))); } #define uvt3_u(ptr) (((ptr)+0)->u) @@ -196,47 +52,48 @@ void p2tr_test_point_to_color (P2tRPoint* point, gfloat *dest, gpointer user_dat #define uvt3_t(ptr) (((ptr)+2)->tri) void -p2tr_mesh_render_cache_uvt (P2tRTriangulation *T, - P2tRuvt *dest, - P2tRImageConfig *config) +p2tr_mesh_render_cache_uvt (P2trMesh *T, + P2truvt *dest, + P2trImageConfig *config) { p2tr_mesh_render_cache_uvt_exact (T, dest, config->x_samples * config->y_samples, config); } void -p2tr_mesh_render_cache_uvt_exact (P2tRTriangulation *T, - P2tRuvt *dest, - gint dest_len, - P2tRImageConfig *config) +p2tr_mesh_render_cache_uvt_exact (P2trMesh *T, + P2truvt *dest, + gint dest_len, + P2trImageConfig *config) { gint x, y, n = dest_len; - P2tRuvt *uvt = dest; - P2tRTriangle *tr_prev = NULL; + P2truvt *uvt = dest; + P2trTriangle *tr_prev = NULL; + P2trVector2 pt; + + pt.x = config->min_x; + pt.y = config->min_y; - uvt3_t(uvt) = p2tr_triangulation_locate_point2 (T, config->min_x, config->min_y, NULL, &uvt3_u(uvt), &uvt3_v(uvt)); + uvt3_t(uvt) = p2tr_mesh_find_point_local2 (T, &pt, NULL, &uvt3_u(uvt), &uvt3_v(uvt)); tr_prev = uvt3_t(uvt); - for (y = 0; y < config->y_samples; y++) - for (x = 0; x < config->x_samples; x++) - { - if (n-- == 0) return; - gdouble Px = config->min_x + x * config->step_x; - gdouble Py = config->min_y + y * config->step_y; - uvt3_t(uvt) = p2tr_triangulation_locate_point2 (T, Px, Py, tr_prev, &uvt3_u(uvt), &uvt3_v(uvt)); - tr_prev = uvt3_t(uvt); - uvt += 3; - } + for (y = 0, pt.y = config->min_y; y < config->y_samples; y++, pt.y += config->step_y) + for (x = 0, pt.x = config->min_x; x < config->x_samples; x++, pt.x += config->step_x) + { + if (n-- == 0) return; + uvt3_t(uvt) = p2tr_mesh_find_point_local2 (T, &pt, tr_prev, &uvt3_u(uvt), &uvt3_v(uvt)); + tr_prev = uvt3_t(uvt); + uvt += 3; + } } - void -p2tr_mesh_render_scanline (P2tRTriangulation *T, +p2tr_mesh_render_scanline (P2trMesh *T, gfloat *dest, - P2tRImageConfig *config, - P2tRPointToColorFunc pt2col, + P2trImageConfig *config, + P2trPointToColorFunc pt2col, gpointer pt2col_user_data) { - P2tRuvt *uvt_cache = g_new (P2tRuvt, 3 * config->x_samples * config->y_samples); + P2truvt *uvt_cache = g_new (P2truvt, 3 * config->x_samples * config->y_samples); GTimer *timer = g_timer_new (); g_timer_start (timer); @@ -256,20 +113,20 @@ p2tr_mesh_render_scanline (P2tRTriangulation *T, void -p2tr_mesh_render_scanline2 (P2tRuvt *uvt_cache, +p2tr_mesh_render_scanline2 (P2truvt *uvt_cache, gfloat *dest, - P2tRImageConfig *config, - P2tRPointToColorFunc pt2col, + P2trImageConfig *config, + P2trPointToColorFunc pt2col, gpointer pt2col_user_data) { - P2tRuvt *uvt_p = uvt_cache; + P2truvt *uvt_p = uvt_cache; gdouble u, v; - P2tRTriangle *tr_prev = NULL, *tr_now; + P2trTriangle *tr_prev = NULL, *tr_now; gint x, y; - P2tRPoint *A = NULL, *B = NULL, *C = NULL; + P2trPoint *A = NULL, *B = NULL, *C = NULL; gfloat *col = g_new (gfloat, config->cpp); gfloat *colA = g_new (gfloat, config->cpp); @@ -326,7 +183,7 @@ p2tr_mesh_render_scanline2 (P2tRuvt *uvt_cache, void p2tr_write_ppm (FILE *f, gfloat *dest, - P2tRImageConfig *config) + P2trImageConfig *config) { gint x, y; fprintf (f, "P3\n"); diff --git a/render/mesh-render.h b/render/mesh-render.h index 907d41f..a93cd57 100755 --- a/render/mesh-render.h +++ b/render/mesh-render.h @@ -1,17 +1,7 @@ -/* - * File: mesh-render.h - * Author: Barak - * - * Created on 1 אוגוסט 2011, 15:37 - */ +#ifndef __P2TR_RENDER_MESH_RENDER_H__ +#define __P2TR_RENDER_MESH_RENDER_H__ -#ifndef MESH_RENDER_H -#define MESH_RENDER_H - -#ifdef __cplusplus -extern "C" -{ -#endif +#include typedef struct { /* Minimal X and Y coordinates to start sampling at */ @@ -23,51 +13,43 @@ typedef struct { /* The amount of channels per pixel, both in destination buffer and in the * colors returned from the matching point-to-color function */ guint cpp; -} P2tRImageConfig; +} P2trImageConfig; -typedef void (*P2tRPointToColorFunc) (P2tRPoint* point, gfloat *dest, gpointer user_data); +typedef void (*P2trPointToColorFunc) (P2trPoint* point, gfloat *dest, gpointer user_data); typedef union { - P2tRTriangle *tri; + P2trTriangle *tri; gdouble u; gdouble v; -} P2tRuvt; +} P2truvt; -void p2tr_test_point_to_color (P2tRPoint* point, gfloat *dest, gpointer user_data); +void p2tr_test_point_to_color (P2trPoint* point, gfloat *dest, gpointer user_data); void -p2tr_mesh_render_cache_uvt (P2tRTriangulation *T, - P2tRuvt *dest, - P2tRImageConfig *config); +p2tr_mesh_render_cache_uvt (P2trMesh *T, + P2truvt *dest, + P2trImageConfig *config); /* Like the regular version, but cache only the specified amount of * pixels */ void -p2tr_mesh_render_cache_uvt_exact (P2tRTriangulation *T, - P2tRuvt *dest, +p2tr_mesh_render_cache_uvt_exact (P2trMesh *T, + P2truvt *dest, gint dest_len, - P2tRImageConfig *config); + P2trImageConfig *config); void -p2tr_mesh_render_scanline (P2tRTriangulation *T, +p2tr_mesh_render_scanline (P2trMesh *T, gfloat *dest, - P2tRImageConfig *config, - P2tRPointToColorFunc pt2col, + P2trImageConfig *config, + P2trPointToColorFunc pt2col, gpointer pt2col_user_data); void -p2tr_mesh_render_scanline2 (P2tRuvt *uvt_cache, +p2tr_mesh_render_scanline2 (P2truvt *uvt_cache, gfloat *dest, - P2tRImageConfig *config, - P2tRPointToColorFunc pt2col, + P2trImageConfig *config, + P2trPointToColorFunc pt2col, gpointer pt2col_user_data); - - - -#ifdef __cplusplus -} #endif - -#endif /* MESH_RENDER_H */ - diff --git a/render/svg-plot.c b/render/svg-plot.c index 5f6cd4b..f056de6 100755 --- a/render/svg-plot.c +++ b/render/svg-plot.c @@ -102,226 +102,43 @@ p2tr_plot_svg_plot_init (FILE *outfile) } void -p2tr_plot_svg_plot_edge (P2tREdge *self, const gchar* color, FILE* outfile) +p2tr_plot_svg_plot_edge (P2trEdge *self, const gchar* color, FILE* outfile) { - gdouble x1 = p2tr_edge_get_start (self)->x; - gdouble y1 = p2tr_edge_get_start (self)->y; - gdouble x2 = p2tr_edge_get_end (self)->x; - gdouble y2 = p2tr_edge_get_end (self)->y; - gdouble R = sqrt ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) / 2; + gdouble x1 = P2TR_EDGE_START (self)->c.x; + gdouble y1 = P2TR_EDGE_START (self)->c.y; + gdouble x2 = self->end->c.x; + gdouble y2 = self->end->c.y; p2tr_plot_svg_plot_line (x1, y1, x2, y2, color, outfile); - // if (p2tr_edge_is_encroached (self)) // p2tr_plot_svg_plot_circle ((x1 + x2) / 2, (y1 + y2) / 2, R, "red", outfile); } void -p2tr_plot_svg_plot_triangle (P2tRTriangle *self, const gchar* color, FILE* outfile) +p2tr_plot_svg_plot_triangle (P2trTriangle *self, const gchar* color, FILE* outfile) { - P2tRCircle c; + P2trCircle c; p2tr_triangle_circumcircle (self, &c); p2tr_plot_svg_plot_edge (self->edges[0], color, outfile); p2tr_plot_svg_plot_edge (self->edges[1], color, outfile); p2tr_plot_svg_plot_edge (self->edges[2], color, outfile); - p2tr_plot_svg_plot_circle (c.x, c.y, c.radius, "green", outfile); - p2tr_plot_svg_fill_point (self->edges[0]->end->x, self->edges[0]->end->y, "blue", outfile); - p2tr_plot_svg_fill_point (self->edges[1]->end->x, self->edges[1]->end->y, "blue", outfile); - p2tr_plot_svg_fill_point (self->edges[2]->end->x, self->edges[2]->end->y, "blue", outfile); + p2tr_plot_svg_plot_circle (c.center.x, c.center.y, c.radius, "green", outfile); + p2tr_plot_svg_fill_point (self->edges[0]->end->c.x, self->edges[0]->end->c.y, "blue", outfile); + p2tr_plot_svg_fill_point (self->edges[1]->end->c.x, self->edges[1]->end->c.y, "blue", outfile); + p2tr_plot_svg_fill_point (self->edges[2]->end->c.x, self->edges[2]->end->c.y, "blue", outfile); } void -CCWTest (FILE* outfile) -{ - P2tRPoint *A = p2tr_point_new (50, 50); - gdouble C[8][2] = { - {0, 0}, - {50, 0}, - {100, 0}, - {100, 50}, - {100, 100}, - {50, 100}, - {0, 100}, - {0, 50} - }; - - gint lenC = sizeof (C) / (2 * sizeof (gdouble)); - - gint j; - for (j = 0; j < lenC; j++) - { - gint k; - do - { - k = rand () % lenC; - } - while (C[k][0] == INFINITY && C[k][1] == INFINITY); - - gdouble *h = C[k]; - - p2tr_point_edge_to (A, p2tr_point_new (h[0], h[1])); - - h[0] = h[1] = INFINITY; - } - - gint i = 0; - GList *iter; - - foreach (iter, A->edges) - { - gchar color[18]; - P2tREdge *e = (P2tREdge*) iter->data; - gint val = i * 255 / lenC; - - sprintf (color, "#%02x%02x%02x", val, val, val); - p2tr_plot_svg_plot_edge (e, color, outfile); - i++; - } -} - -void -TriangleClockwiseTest (FILE* outfile) -{ - - const gchar * ecolors[3] = {"#ff0000", "#00ff00", "#0000ff"}; - const gchar * mecolors[3] = {"#770000", "#007700", "#000077"}; - const gchar * ptcolors[3] = {"#ff00ff", "#ffff00", "#00ffff"}; - - const gchar * names[3] = {"A", "B", "C"}; - - P2tRPoint * pts[3]; - int i; - for (i = 0; i < 3; i++) - { - pts[i] = p2tr_point_new (r (), r ()); - } - - P2tREdge * edges[3]; - for (i = 0; i < 3; i++) - { - edges[i] = p2tr_edge_new (pts[i], pts[(i + 1) % 3]); - } - - P2tRTriangle *tri = p2tr_triangle_new (edges[0], edges[1], edges[2], NULL); - - for (i = 0; i < 3; i++) - { - p2tr_plot_svg_plot_edge (tri->edges[i]->mirror, mecolors[i], outfile); - } - - for (i = 0; i < 3; i++) - { - p2tr_plot_svg_plot_edge (tri->edges[i], ecolors[i], outfile); - } - - for (i = 0; i < 3; i++) - { - P2tRPoint *P = p2tr_edge_get_start (tri->edges[i]); - p2tr_plot_svg_fill_point (P->x, P->y, ptcolors[i], outfile); - } -} - -void -refineTest(FILE* outfile) -{ - /* - gdouble RAW[5][2] = {{10,10},{50,50},{55,130},{0,100},{30,50}}; - P2tRPoint *X[5]; - gint N = 5; - */ - gdouble RAW[10][2] = {{10,10},{30,30},{50,50},{52.5,90},{55,130},{27.5,115},{0,100},{15,75},{30,50},{20,30}}; - P2tRPoint *X[10]; - gint N = 10; - - GList *XEs = NULL; - int i; - - for (i = 0; i < N; i++) - { - X[i] = p2tr_point_new (RAW[i][0], RAW[i][1]); - p2tr_plot_svg_fill_point (RAW[i][0], RAW[i][1], "blue", outfile); - } - - fprintf (stderr, "Preparing to work on %d points\n", N); - for (i = 0; i < N; i++) - { - P2tREdge *E = p2tr_edge_new (X[N-i-1], X[N-1-((i+1)%N)]); - XEs = g_list_prepend (XEs, E); - p2tr_edge_set_constrained (E, TRUE); - } - - P2tRTriangulation *T = p2tr_triangulateA (X,N); - - { - GList *liter; - foreach (liter, XEs) - p2tr_validate_edge ((P2tREdge*)liter->data); - } - - DelaunayTerminator (T,XEs,M_PI/6,p2tr_false_delta); - - { - P2trHashSetIter iter; - P2tRTriangle *t; - p2tr_hash_set_iter_init (&iter, T->tris); - while (p2tr_hash_set_iter_next (&iter, (gpointer*)&t)) - { - p2tr_assert_and_explain (t != NULL, "NULL triangle found!\n"); - p2tr_assert_and_explain (t->edges[0] != NULL && t->edges[1] != NULL && t->edges[2] != NULL, - "Removed triangle found!\n"); - p2tr_plot_svg_plot_triangle (t, "black", outfile); - - p2tr_validate_edge (t->edges[0]); - p2tr_validate_edge (t->edges[1]); - p2tr_validate_edge (t->edges[2]); - - } - } - -#if FALSE - GPtrArray* points = mvc_findEdgePoints (T); - //PlotPoints (points); - - P2tRPoint *testX = p2tr_point_new (40, 45); - p2tr_plot_svg_fill_point (testX->x, testX->y, "red"); - /* Give special care for the part after the last point - it may have less - * points than other parts */ - gint div = points->len / 16; - P2tRHashSet *allPts = p2tr_hash_set_set_new (g_direct_hash, g_direct_equal, NULL); - for (i = 0; i < 16; i++) - { - gint index1 = i * div; - gint index2 = MIN ((i + 1) * div, points->len); /* In the last iteration, take the last */ - mvc_makePtList (testX, points, index1, index2, allPts); - } - - { - gint count = 0; - P2trHashSetIter iter; - P2tRPoint *pt; - p2tr_hash_set_iter_init (&iter, allPts); - while (p2tr_hash_set_iter_next (&iter, (gpointer*)&pt)) - { - p2tr_plot_svg_fill_point (pt->x, pt->y, "orange"); - count++; - } - fprintf (stderr, "In total, had %d sample points\n", count); - } -#endif -} - - -void -p2tr_plot_svg (P2tRTriangulation *T, FILE *outfile) +p2tr_plot_svg (P2trMesh *T, FILE *outfile) { P2trHashSetIter siter; - P2tRTriangle *tr; + P2trTriangle *tr; p2tr_debug ("Starting to write SVG output\n"); p2tr_plot_svg_plot_init (outfile); - p2tr_hash_set_iter_init (&siter, T->tris); + p2tr_hash_set_iter_init (&siter, T->triangles); while (p2tr_hash_set_iter_next (&siter, (gpointer*)&tr)) p2tr_plot_svg_plot_triangle (tr, "black", outfile); diff --git a/render/svg-plot.h b/render/svg-plot.h index e581902..2acc124 100755 --- a/render/svg-plot.h +++ b/render/svg-plot.h @@ -33,13 +33,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SVG_PLOT_H -#define SVG_PLOT_H - -#ifdef __cplusplus -extern "C" -{ -#endif +#ifndef __P2TC_RENDER_SVG_PLOT_H__ +#define __P2TC_RENDER_SVG_PLOT_H__ #include @@ -80,19 +75,14 @@ void p2tr_plot_svg_plot_init (FILE* outfile); void -p2tr_plot_svg_plot_edge (P2tREdge *self, const gchar* color, FILE* outfile); +p2tr_plot_svg_plot_edge (P2trEdge *self, const gchar* color, FILE* outfile); void -p2tr_plot_svg_plot_triangle (P2tRTriangle *self, const gchar* color, FILE* outfile); +p2tr_plot_svg_plot_triangle (P2trTriangle *self, const gchar* color, FILE* outfile); #define r() (10+(rand () % 91)) void -p2tr_plot_svg (P2tRTriangulation *T, FILE* outfile); +p2tr_plot_svg (P2trMesh *T, FILE* outfile); -#ifdef __cplusplus -} #endif - -#endif /* SVG_PLOT_H */ -