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>2013-05-31 10:28:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-31 10:28:11 +0400
commit54e8cacdcf5fb06441530d7c5b10265733f6e54f (patch)
tree2f5a7fb07ae1894d19d6687a10d517bedda9d664 /source/blender/bmesh
parent58a748431e7b3b268a0b8f77b09279ed0c19eca2 (diff)
improve edgering subdivide curvature calculations (calculate length projected onto the normal plane).
also correct recely added asserts.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide_edgering.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index 0b3aeec0aea..871ebdf0feb 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -86,6 +86,7 @@ static float bezier_handle_calc_length_v3(const float co_a[3], const float no_a[
const float dot = dot_v3v3(no_a, no_b);
/* gives closest approx at a circle with 2 parallel handles */
float fac = 1.333333f;
+ float len;
if (dot < 0.0f) {
/* scale down to 0.666 if we point directly at each other rough but ok */
/* TODO, current blend from dot may not be optimal but its also a detail */
@@ -93,7 +94,25 @@ static float bezier_handle_calc_length_v3(const float co_a[3], const float no_a[
fac = (fac * t) + (0.75f * (1.0f - t));
}
- return (len_v3v3(co_a, co_b) * 0.5f) * fac;
+#if 0
+ len = len_v3v3(co_a, co_b);
+#else
+ /* 2d length projected on plane of normals */
+ {
+ float co_a_ofs[3];
+ cross_v3_v3v3(co_a_ofs, no_a, no_b);
+ if (len_squared_v3(co_a_ofs) > FLT_EPSILON) {
+ add_v3_v3(co_a_ofs, co_a);
+ closest_to_line_v3(co_a_ofs, co_b, co_a, co_a_ofs);
+ }
+ else {
+ copy_v3_v3(co_a_ofs, co_a);
+ }
+ len = len_v3v3(co_a_ofs, co_b);
+ }
+#endif
+
+ return (len * 0.5f) * fac;
}
static void bm_edgeloop_vert_tag(struct BMEdgeLoopStore *el_store, const bool tag)