m4_define([lt_age], [0])
# Declare the package details
-AC_INIT([poly2tri-c], p2tc_real_version, [lightningismyname@gmail.com])
+AC_INIT([poly2tri-c],[p2tc_real_version],[lightningismyname@gmail.com])
P2TC_MAJOR_VERSION=p2tc_major_version
P2TC_MINOR_VERSION=p2tc_minor_version
LDFLAGS="$LDFLAGS $GLIB_LIBS"
LIBS="$LIBS $GLIB_LIBS"
+# Allow building with debugging symbols
+AC_MSG_CHECKING([whether to turn on debugging])
+AC_ARG_ENABLE(debug,
+ AS_HELP_STRING([--enable-debug],[turn on debugging (default=no)]),
+ if eval "test x$enable_debug = xyes"; then
+ DEBUGFLAG="-g"
+ fi)
+
+if test -n "$DEBUGFLAG"; then
+ AC_MSG_RESULT([yes])
+ CFLAGS="$DEBUGFLAG $CFLAGS"
+else
+ AC_MSG_RESULT([no])
+fi
+
+# Allow forcing a validation of the CDT after each refinement step
+AC_MSG_CHECKING([whether to enable CDT validation during refinement])
+AC_ARG_ENABLE(cdt-validation,
+ AS_HELP_STRING([--enable-cdt-validation],[turn on CDT validation during refinement (WARNING: SLOW!, default=no)]),
+ if eval "test x$enable_cdt_validation = xyes"; then
+ P2TR_ENABLE_CDT_VALIDATION="TRUE"
+ fi)
+
+if test -n "$P2TR_ENABLE_CDT_VALIDATION"; then
+ CDTVFLAG="-DP2TR_CDT_VALIDATE=TRUE"
+ AC_MSG_RESULT([yes])
+else
+ CDTVFLAG="-DP2TR_CDT_VALIDATE=FALSE"
+ AC_MSG_RESULT([no])
+fi
+
+CFLAGS="$CDTVFLAG $CFLAGS"
+
# Output this configuration header file
AC_CONFIG_HEADERS([config.h])
gboolean inserted = FALSE;
gint i;
- p2tr_cdt_validate_unused (self);
+ P2TR_CDT_VALIDATE_UNUSED (self);
if (point_location_guess == NULL)
tri = p2tr_mesh_find_point (self->mesh, pc);
/* We no longer need the triangle */
p2tr_triangle_unref (tri);
- p2tr_cdt_validate_unused (self);
+ P2TR_CDT_VALIDATE_UNUSED (self);
return pt;
}
GList *fan = NULL, *new_edges = NULL;
P2trHashSet *fan_edges;
- p2tr_cdt_validate_unused (self);
+ P2TR_CDT_VALIDATE_UNUSED (self);
p2tr_edge_remove (e);
p2tr_edge_unref (CY);
}
- p2tr_cdt_validate_unused (self);
+ P2TR_CDT_VALIDATE_UNUSED (self);
return new_edges;
}
P2trPSLG *outline;
} P2trCDT;
-void p2tr_cdt_validate_unused (P2trCDT* self);
-
/**
* Create a new P2trCDT from an existing P2tCDT. The resulting P2trCDT
* does not depend on the original P2tCDT which can be freed
*/
void p2tr_cdt_validate_edges (P2trCDT *self);
+void p2tr_cdt_validate_unused (P2trCDT* self);
+
/**
* Make sure the constrained empty circum-circle property holds,
* meaning that each triangles circum-scribing circle is either empty
*/
void p2tr_cdt_validate_cdt (P2trCDT *self);
+#if P2TR_CDT_VALIDATE
+#define P2TR_CDT_VALIDATE_EDGES(CDT) p2tr_cdt_validate_edges(CDT)
+#define P2TR_CDT_VALIDATE_UNUSED(CDT) p2tr_cdt_validate_unused(CDT)
+#define P2TR_CDT_VALIDATE_CDT(CDT) p2tr_cdt_validate_cdt(CDT)
+#else
+#define P2TR_CDT_VALIDATE_EDGES(CDT) G_STMT_START { } G_STMT_END
+#define P2TR_CDT_VALIDATE_UNUSED(CDT) G_STMT_START { } G_STMT_END
+#define P2TR_CDT_VALIDATE_CDT(CDT) G_STMT_START { } G_STMT_END
+#endif
+
/**
* Insert a point into the triangulation while preserving the
* constrained delaunay property
P2trVTriangle *vt;
gint steps = 0;
- p2tr_cdt_validate_cdt(self->mesh);
+ P2TR_CDT_VALIDATE_CDT (self->mesh);
if (steps++ >= max_steps)
return;
p2tr_dt_enqueue_segment (self, s);
SplitEncroachedSubsegments (self, 0, p2tr_refiner_false_too_big);
- p2tr_cdt_validate_cdt(self->mesh);
+ P2TR_CDT_VALIDATE_CDT (self->mesh);
p2tr_hash_set_iter_init (&hs_iter, self->mesh->mesh->triangles);
while (p2tr_hash_set_iter_next (&hs_iter, (gpointer*)&t))
P2trVEdgeSet *E;
P2trPoint *cPoint;
- p2tr_cdt_validate_cdt (self->mesh);
+ P2TR_CDT_VALIDATE_CDT (self->mesh);
p2tr_triangle_get_circum_circle (t, &tCircum);
c = &tCircum.center;