lib_LTLIBRARIES = libp2tc-refine.la
-libp2tc_refine_la_SOURCES = bounded-line.c bounded-line.h cdt.c cdt.h circle.c circle.h cluster.c cluster.h delaunay-terminator.c delaunay-terminator.h edge.c edge.h line.c line.h math.c math.h mesh.c mesh.h point.c point.h pslg.c pslg.h refine.h triangle.c triangle.h triangulation.h utils.c utils.h vector2.c vector2.h visibility.c visibility.h
+libp2tc_refine_la_SOURCES = bounded-line.c bounded-line.h cdt.c cdt.h circle.c circle.h cluster.c cluster.h delaunay-terminator.c delaunay-terminator.h edge.c edge.h line.c line.h rmath.c rmath.h mesh.c mesh.h point.c point.h pslg.c pslg.h refine.h triangle.c triangle.h triangulation.h utils.c utils.h vector2.c vector2.h visibility.c visibility.h
opposite = p2tr_triangle_get_opposite_point (e->mirror->tri, e->mirror);
if (! p2tr_circle_test_point_outside(&circum_circle, &opposite->c))
{
- P2trEdge *flipped;
+ P2trEdge *flipped = NULL;
if (p2tr_cdt_try_flip (self, e, &tris_to_fix, &flipped))
{
g_queue_push_tail (&flipped_edges, flipped);
#include <glib.h>
#include "utils.h"
-#include "math.h"
+#include "rmath.h"
#include "point.h"
#include "edge.h"
ChooseSplitVertex(P2trEdge *e, P2trVector2 *dst)
{
gdouble sourceLength = p2tr_edge_get_length(e);
- gdouble newLength = pow(2, round(LOG2(sourceLength)));
+ gdouble newLengthFloor = pow(2, floor(LOG2(sourceLength)));
+ gdouble newLengthCeil = newLengthFloor * 2;
+ gdouble newLength =
+ (sourceLength - newLengthFloor < newLengthCeil - sourceLength)
+ ? newLengthFloor : newLengthCeil;
gdouble ratio, resultLength;
/* IMPORTANT! DIVIDE BY 2! */
#define __P2TC_REFINE_H__
#include "utils.h"
-#include "math.h"
+#include "rmath.h"
#include "vector2.h"
#include "circle.h"
#include "cdt.h"
#include "delaunay-terminator.h"
-#endif
\ No newline at end of file
+#endif
#include <math.h>\r
#include <glib.h>\r
-#include "math.h"\r
+#include "rmath.h"\r
\r
gdouble\r
p2tr_math_length_sq (gdouble x1, gdouble y1,\r
#include <glib.h>
#include "utils.h"
-#include "math.h"
+#include "rmath.h"
#include "point.h"
#include "edge.h"
&P2TR_TRIANGLE_GET_POINT(self,1)->c,
&P2TR_TRIANGLE_GET_POINT(self,2)->c,
pt, u, v);
-}
\ No newline at end of file
+}
#define __P2TC_REFINE_TRIANGLE_H__
#include <glib.h>
-#include "math.h"
+#include "rmath.h"
#include "triangulation.h"
/**
gdouble *v);
#define P2TR_TRIANGLE_GET_POINT(tr,index) ((tr)->edges[((index)+3-1)%3]->end)
-#endif
\ No newline at end of file
+#endif