From: Barak Itkin Date: Sat, 28 Jul 2012 12:55:09 +0000 (+0300) Subject: Make flip-fixing a bit more efficient by trying to "give up" eralier X-Git-Tag: p2tc-0.1.0~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b410eea5c1c511620abda8cad1e80f88cf9d406a;p=poly2tri-c Make flip-fixing a bit more efficient by trying to "give up" eralier --- diff --git a/poly2tri-c/refine/cdt-flipfix.c b/poly2tri-c/refine/cdt-flipfix.c index e359cdd..3efeb09 100644 --- a/poly2tri-c/refine/cdt-flipfix.c +++ b/poly2tri-c/refine/cdt-flipfix.c @@ -132,16 +132,16 @@ p2tr_cdt_try_flip (P2trCDT *self, AB = to_flip; - CA = p2tr_point_get_edge_to (C, A, FALSE); - AD = p2tr_point_get_edge_to (A, D, FALSE); - DB = p2tr_point_get_edge_to (D, B, FALSE); - BC = p2tr_point_get_edge_to (B, C, FALSE); - /* Check if the quadriliteral ADBC is concave (because if it is, we * can't flip the edge) */ if (p2tr_triangle_circumcircle_contains_point (AB->tri, &D->c) != P2TR_INCIRCLE_IN) return NULL; + CA = p2tr_point_get_edge_to (C, A, FALSE); + AD = p2tr_point_get_edge_to (A, D, FALSE); + DB = p2tr_point_get_edge_to (D, B, FALSE); + BC = p2tr_point_get_edge_to (B, C, FALSE); + p2tr_edge_remove (AB); DC = p2tr_mesh_new_edge (self->mesh, D, C, FALSE);