Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-13 01:38:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-13 01:38:13 +0400
commit07ffbbfcb6b4448b147e54eab303a029b10db04e (patch)
treeab9ce1532ca2ed7611709821417b8fd9f2c9a578 /source/blender/blenlib/intern
parente3cfca511f55495de1b58bf714fb4b8cabc633db (diff)
better fix for [#30529], find the right axis rather then checking for folded quads.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/math_geom.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index b8cb9790d9e..fab6b7b1066 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -3054,25 +3054,23 @@ float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], fl
}
/* evaluate if entire quad is a proper convex quad */
- int is_quad_convex_v3(const float *v1, const float *v2, const float *v3, const float *v4)
+ int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
{
float nor[3], nor1[3], nor2[3], vec[4][2];
int axis_a, axis_b;
/* define projection, do both trias apart, quad is undefined! */
- /* strictly speaking this isn't necessarily convex,
- * but when try normals point away from eachother
- * we don't wan't to make that face */
- normal_tri_v3(nor1, v2, v3, v4);
- normal_tri_v3(nor2, v1, v2, v4);
- if (UNLIKELY(dot_v3v3(nor1, nor2) < 0.0f)) {
- return FALSE;
- }
normal_tri_v3(nor1, v1, v2, v3);
normal_tri_v3(nor2, v1, v3, v4);
+
+ /* when the face is folded over as 2 tris we probably don't want to create
+ * a quad from it, but go ahead with the intersection test since this
+ * isn't a function for degenerate faces */
if (UNLIKELY(dot_v3v3(nor1, nor2) < 0.0f)) {
- return FALSE;
+ /* flip so adding normals in the opposite direction
+ * doesnt give a zero length vector */
+ negate_v3(nor2);
}
add_v3_v3v3(nor, nor1, nor2);