summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/morpher/quadrilateral.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/morpher/quadrilateral.c b/src/morpher/quadrilateral.c
index 9c73dfa..d5c64b0 100644
--- a/src/morpher/quadrilateral.c
+++ b/src/morpher/quadrilateral.c
@@ -7,12 +7,12 @@ static inline IntVector p2(IntVector n) {
7 return n * n; 7 return n * n;
8} 8}
9 9
10static inline bool not_in_circumcircle(TriangleMap *t, CartesianVector v) { 10static inline bool in_circumcircle(TriangleMap *t, CartesianVector v) {
11 CartesianVector a = t->vertices[0].origin, b = t->vertices[1].origin, c = t->vertices[2].origin; 11 CartesianVector a = t->vertices[0].origin, b = t->vertices[1].origin, c = t->vertices[2].origin;
12 IntVector v2 = p2(v.x) + p2(v.y); 12 IntVector v2 = p2(v.x) + p2(v.y);
13 return matrix_int_det3(a.x - v.x, a.y - v.y, p2(a.x) + p2(a.y) - v2, 13 return matrix_int_det3(a.x - v.x, a.y - v.y, p2(a.x) + p2(a.y) - v2,
14 b.x - v.x, b.y - v.y, p2(b.x) + p2(b.y) - v2, 14 b.x - v.x, b.y - v.y, p2(b.x) + p2(b.y) - v2,
15 c.x - v.x, c.y - v.y, p2(c.x) + p2(c.y) - v2) > 0; 15 c.x - v.x, c.y - v.y, p2(c.x) + p2(c.y) - v2) < 0;
16} 16}
17 17
18static inline void rotate_vertices(TriangleMap *t1, TriangleMap *t2, int e1, int e2) { 18static inline void rotate_vertices(TriangleMap *t1, TriangleMap *t2, int e1, int e2) {
@@ -58,6 +58,6 @@ void quadrilateral_flip_diagonal(TriangleMap *t1, TriangleMap *t2) {
58 58
59bool quadrilateral_is_delaunay(TriangleMap *t1, TriangleMap *t2) { 59bool quadrilateral_is_delaunay(TriangleMap *t1, TriangleMap *t2) {
60 assert(t1 != NULL && t2 != NULL); 60 assert(t1 != NULL && t2 != NULL);
61 return not_in_circumcircle(t1, t2->vertices[(trianglemap_find_common_edge(t2, t1) + 2) % 3].origin) && 61 return !in_circumcircle(t1, t2->vertices[(trianglemap_find_common_edge(t2, t1) + 2) % 3].origin) &&
62 not_in_circumcircle(t2, t1->vertices[(trianglemap_find_common_edge(t1, t2) + 2) % 3].origin); 62 !in_circumcircle(t2, t1->vertices[(trianglemap_find_common_edge(t1, t2) + 2) % 3].origin);
63} 63}