diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 14:04:31 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 14:04:31 +0300 |
commit | 0d2d4a6d4a75ac38c41f872c88255eab70e88ab7 (patch) | |
tree | b7a7518af86dddba48e05a98b3c2be55e8804721 /source/blender/blenlib/intern/delaunay_2d.c | |
parent | 9b416c66fb714bdfd15a481489dbf650d0f389ea (diff) | |
parent | cfc6f9eb18e701f5be601b95c45004e8cf7fbc81 (diff) |
Merge branch 'master' into temp-ui-button-type-refactortemp-ui-button-type-refactor
Diffstat (limited to 'source/blender/blenlib/intern/delaunay_2d.c')
-rw-r--r-- | source/blender/blenlib/intern/delaunay_2d.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/source/blender/blenlib/intern/delaunay_2d.c b/source/blender/blenlib/intern/delaunay_2d.c index 08ccff695c1..7199e461c6c 100644 --- a/source/blender/blenlib/intern/delaunay_2d.c +++ b/source/blender/blenlib/intern/delaunay_2d.c @@ -600,19 +600,19 @@ static int site_lexicographic_cmp(const void *a, const void *b) if (co1[0] < co2[0]) { return -1; } - else if (co1[0] > co2[0]) { + if (co1[0] > co2[0]) { return 1; } - else if (co1[1] < co2[1]) { + if (co1[1] < co2[1]) { return -1; } - else if (co1[1] > co2[1]) { + if (co1[1] > co2[1]) { return 1; } - else if (s1->orig_index < s2->orig_index) { + if (s1->orig_index < s2->orig_index) { return -1; } - else if (s1->orig_index > s2->orig_index) { + if (s1->orig_index > s2->orig_index) { return 1; } return 0; @@ -952,7 +952,7 @@ static void initial_triangulation(CDT_state *cdt) } #endif - /* Now dedup according to user-defined epsilon. + /* Now de-duplicate according to user-defined epsilon. * We will merge a vertex into an earlier-indexed vertex * that is within epsilon (Euclidean distance). * Merges may cascade. So we may end up merging two things @@ -974,7 +974,7 @@ static void initial_triangulation(CDT_state *cdt) if (jco[0] > xend) { break; /* No more j's to process. */ } - else if (jco[1] > yend) { + if (jco[1] > yend) { /* Get past any string of v's with the same x and too-big y. */ xcur = jco[0]; while (++j < n) { @@ -1414,7 +1414,7 @@ static bool get_next_crossing_from_vert(CDT_state *cdt, ok = true; break; } - else if (t->face != cdt->outer_face) { + if (t->face != cdt->outer_face) { orient2 = orient2d(vcur->co, vb->co, v2->co); #ifdef DEBUG_CDT if (dbg_level > 1) { @@ -1683,14 +1683,12 @@ static void add_edge_constraint( (cd_prev->lambda != 0.0 && cd_prev->in->vert != v && cd_prev->in->next->vert != v)) { break; } - else { - cd_prev->lambda = -1.0; /* Mark cd_prev as 'deleted'. */ + cd_prev->lambda = -1.0; /* Mark cd_prev as 'deleted'. */ #ifdef DEBUG_CDT - if (dbg_level > 0) { - fprintf(stderr, "deleted crossing %d\n", j); - } -#endif + if (dbg_level > 0) { + fprintf(stderr, "deleted crossing %d\n", j); } +#endif } if (j < i - 1) { /* Some crossings were deleted. Fix the in and out edges across gap. */ @@ -2002,19 +2000,19 @@ static int evl_cmp(const void *a, const void *b) if (area->e_id < sb->e_id) { return -1; } - else if (area->e_id > sb->e_id) { + if (area->e_id > sb->e_id) { return 1; } - else if (area->lambda < sb->lambda) { + if (area->lambda < sb->lambda) { return -1; } - else if (area->lambda > sb->lambda) { + if (area->lambda > sb->lambda) { return 1; } - else if (area->v_id < sb->v_id) { + if (area->v_id < sb->v_id) { return -1; } - else if (area->v_id > sb->v_id) { + if (area->v_id > sb->v_id) { return 1; } return 0; @@ -2386,9 +2384,7 @@ static const CDT_input *modify_input_for_near_edge_ends(const CDT_input *input, if (new_input != NULL) { return (const CDT_input *)new_input; } - else { - return input; - } + return input; } static void free_modified_input(CDT_input *input) @@ -2745,7 +2741,7 @@ static int edge_to_sort_cmp(const void *a, const void *b) if (e1->len_squared > e2->len_squared) { return -1; } - else if (e1->len_squared < e2->len_squared) { + if (e1->len_squared < e2->len_squared) { return 1; } return 0; @@ -4320,7 +4316,7 @@ static void exactinit(void) */ static int fast_expansion_sum_zeroelim( - int elen, double *e, int flen, double *f, double *h) /* h cannot be e or f. */ + int elen, const double *e, int flen, const double *f, double *h) /* h cannot be e or f. */ { double Q; INEXACT double Qnew; @@ -4405,7 +4401,7 @@ static int fast_expansion_sum_zeroelim( */ static int scale_expansion_zeroelim(int elen, - double *e, + const double *e, double b, double *h) /* e and h cannot be the same. */ { @@ -4451,7 +4447,7 @@ static int scale_expansion_zeroelim(int elen, * See either version of my paper for details. */ -static double estimate(int elen, double *e) +static double estimate(int elen, const double *e) { double Q; int eindex; @@ -4570,17 +4566,13 @@ static double orient2d(const double *pa, const double *pb, const double *pc) if (detright <= 0.0) { return det; } - else { - detsum = detleft + detright; - } + detsum = detleft + detright; } else if (detleft < 0.0) { if (detright >= 0.0) { return det; } - else { - detsum = -detleft - detright; - } + detsum = -detleft - detright; } else { return det; |