if (points != NULL)
{
- g_ptr_array_add (*points, p2t_point_new (ptc[0], ptc[1]));
+ g_ptr_array_add (*points, p2t_point_new_dd (ptc[0], ptc[1]));
countPts++;
}
}
g_print ("Read %d points and %d colors\n", countPts, countCls);
}
-/* In order to find the maximal length of a filename path, most
- * platforms have either the macro MAX_PATH, or PATH_MAX. This is a
- * guess which tries them both */
-
-#ifdef MAX_PATH
-#define P2TC_MAX_PATH MAX_PATH
-#else
-#define P2TC_MAX_PATH PATH_MAX
-#endif
-
/* Calculate a "deterministic random" color for each point
* based on its memory address. Since we know that least-significant bytes
* of the point address will change more than the mor-important ones, we
P2trCDT *rcdt;
P2trDelaunayTerminator *dt;
- gchar buf[P2TC_MAX_PATH+1];
+ gchar *buf;
gfloat *im;
+ P2trImageConfig imc;
context = g_option_context_new ("- Create a fine mesh from a given PSLG");
g_option_context_add_main_entries (context, entries, NULL);
-// g_option_context_add_group (context, gtk_get_option_group (TRUE));
-
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_print ("option parsing failed: %s\n", error->message);
fclose (out);
+ buf = g_newa(char, strlen(output_file) + 5);
sprintf (buf, "%s.ppm", output_file);
if ((out = fopen (buf, "w")) == NULL)
exit (1);
}
- P2trImageConfig imc;
-
+ g_free (buf);
+ buf = NULL;
+
imc.cpp = 4;
imc.min_x = imc.min_y = 0;
imc.step_x = imc.step_y = 0.2;
g_free (im);
- // p2tr_triangulation_free (T);
+#if FALSE
+ p2tr_triangulation_free (T);
-// for (i = 0; i < pts->len; i++)
-// {
-// p2tr_point_unref ((P2trPoint*) g_ptr_array_index (pts, i));
-// }
+ for (i = 0; i < pts->len; i++)
+ {
+ p2tr_point_unref ((P2trPoint*) g_ptr_array_index (pts, i));
+ }
+#endif
g_ptr_array_free (pts, TRUE);
g_array_free (colors, TRUE);
# Find a C compiler
AC_PROG_CC
+# Pedantic errors please
+CFLAGS="$CFLAGS -Wall -Werror -ansi -pedantic"
+
# Find the standard math functions
# Taken from http://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html
AC_SEARCH_LIBS([log10], [m], [], [
P2trPoint *A = NULL, *B = NULL, *C = NULL;
- gfloat *col = g_new (gfloat, config->cpp);
gfloat *colA = g_new (gfloat, config->cpp);
gfloat *colB = g_new (gfloat, config->cpp);
gfloat *colC = g_new (gfloat, config->cpp);
P2trImageConfig *config)
{
gint x, y;
+ gfloat *pixel;
+
fprintf (f, "P3\n");
fprintf (f, "%d %d\n", config->x_samples, config->y_samples);
fprintf (f, "255\n");
- gfloat *pixel = dest;
+ pixel = dest;
for (y = 0; y < config->y_samples; y++)
{
void
p2tr_plot_svg_plot_arrow (gdouble x1, gdouble y1, gdouble x2, gdouble y2, const gchar* color, FILE *outfile)
{
- p2tr_plot_svg_plot_line (x1, y1, x2, y2, color, outfile);
-
gdouble dy = y2 - y1;
gdouble dx = x2 - x1;
gdouble angle = atan2 (dy, dx);
-
gdouble temp = angle - ARROW_SIDE_ANGLE;
+
+ p2tr_plot_svg_plot_line (x1, y1, x2, y2, color, outfile);
+
p2tr_plot_svg_plot_line (x2, y2, x2 - ARROW_HEAD_SIZE * cos (temp), y2 - ARROW_HEAD_SIZE * sin (temp), color, outfile);
temp = angle + ARROW_SIDE_ANGLE;
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);
+#if FALSE
+ if (p2tr_edge_is_encroached (self))
+ p2tr_plot_svg_plot_circle ((x1 + x2) / 2, (y1 + y2) / 2, R, "red", outfile);
+#endif
}
void
#include <refine/refine.h>
#define PLOT_LINE_WIDTH 0.40
-#define ARROW_SIDE_ANGLE (M_PI / 180 * 30)
+#define ARROW_SIDE_ANGLE (G_PI / 180 * 30)
#define ARROW_HEAD_SIZE 2.0
#define X_SCALE 3.