]> granicus.if.org Git - poly2tri-c/commitdiff
Make flip-fixing a bit more efficient by trying to "give up" eralier
authorBarak Itkin <lightningismyname@gmail.com>
Sat, 28 Jul 2012 12:55:09 +0000 (15:55 +0300)
committerBarak Itkin <lightningismyname@gmail.com>
Sat, 28 Jul 2012 12:55:09 +0000 (15:55 +0300)
poly2tri-c/refine/cdt-flipfix.c

index e359cdde81dcabc25ddcf47bd03205556d391e5d..3efeb0989d6adb8240754c837db063eeaee4adf1 100644 (file)
@@ -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);