diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2012-02-29 18:23:31 +0400 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2012-02-29 18:23:31 +0400 |
commit | 0d2ba6bff6c99fb3096a5fa71e7dbe7371d8fc3d (patch) | |
tree | d104fc909b6605df2a36f4f3a8a6a8f2ef129c15 /source/blender | |
parent | d330efa08405a0c0532b93ce6019b08e89c6266d (diff) |
Code cleanup, no functional change: use mathutils copy
Also renamed a variable to make intent clearer (else seemed like
there was a bug).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 3712d9944f5..83b00a45806 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -645,11 +645,11 @@ static int linecrossesf(const float v1[2], const float v2[2], const float v3[2], int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]) { int ax, ay; - float co2[3], cent[3] = {0.0f, 0.0f, 0.0f}, out[3] = {FLT_MAX * 0.5f, FLT_MAX * 0.5f, 0}; + float co2[2], cent[2] = {0.0f, 0.0f}, out[2] = {FLT_MAX * 0.5f, FLT_MAX * 0.5f}; BMLoop *l_iter; BMLoop *l_first; int crosses = 0; - float eps = 1.0f + (float)FLT_EPSILON * 150.0f; + float onepluseps = 1.0f + (float)FLT_EPSILON * 150.0f; if (dot_v3v3(f->no, f->no) <= FLT_EPSILON * 10) BM_face_normal_update(bm, f); @@ -664,7 +664,6 @@ int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]) co2[0] = co[ax]; co2[1] = co[ay]; - co2[2] = 0; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { @@ -676,15 +675,13 @@ int BM_face_point_inside_test(BMesh *bm, BMFace *f, const float co[3]) l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { - float v1[3], v2[3]; + float v1[2], v2[2]; - v1[0] = (l_iter->prev->v->co[ax] - cent[ax]) * eps + cent[ax]; - v1[1] = (l_iter->prev->v->co[ay] - cent[ay]) * eps + cent[ay]; - v1[2] = 0.0f; + v1[0] = (l_iter->prev->v->co[ax] - cent[ax]) * onepluseps + cent[ax]; + v1[1] = (l_iter->prev->v->co[ay] - cent[ay]) * onepluseps + cent[ay]; - v2[0] = (l_iter->v->co[ax] - cent[ax]) * eps + cent[ax]; - v2[1] = (l_iter->v->co[ay] - cent[ay]) * eps + cent[ay]; - v2[2] = 0.0f; + v2[0] = (l_iter->v->co[ax] - cent[ax]) * onepluseps + cent[ax]; + v2[1] = (l_iter->v->co[ay] - cent[ay]) * onepluseps + cent[ay]; crosses += linecrossesf(v1, v2, co2, out) != 0; } while ((l_iter = l_iter->next) != l_first); @@ -700,9 +697,9 @@ static int goodline(float (*projectverts)[3], BMFace *f, int v1i, double v1[3], v2[3], v3[3], pv1[3], pv2[3]; int i; - VECCOPY(v1, projectverts[v1i]); - VECCOPY(v2, projectverts[v2i]); - VECCOPY(v3, projectverts[v3i]); + copy_v3_v3(v1, projectverts[v1i]); + copy_v3_v3(v2, projectverts[v2i]); + copy_v3_v3(v3, projectverts[v3i]); if (testedgeside(v1, v2, v3)) { return FALSE; @@ -716,8 +713,8 @@ static int goodline(float (*projectverts)[3], BMFace *f, int v1i, continue; } - VECCOPY(pv1, projectverts[BM_elem_index_get(l_iter->v)]); - VECCOPY(pv2, projectverts[BM_elem_index_get(l_iter->next->v)]); + copy_v3_v3(pv1, projectverts[BM_elem_index_get(l_iter->v)]); + copy_v3_v3(pv2, projectverts[BM_elem_index_get(l_iter->next->v)]); //if (linecrosses(pv1, pv2, v1, v3)) return FALSE; |