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>2014-03-30 05:00:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-03-30 05:05:42 +0400
commit3bd15fcf15e6f4ebcf45b5e5483a2d3b2e53058b (patch)
tree0e24bee68a014e699f3824b5d3615a94e1fa1862 /source/blender
parent2702170717b450432dd22cb0abe3fd6dd9ede8fd (diff)
Correction for poly_to_tri_count (used over-complicated method)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/intern/math_geom_inline.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index c6f36464d51..4b1d6a94185 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -213,28 +213,13 @@ MINLINE int min_axis_v3(const float vec[3])
/**
* Simple method to find how many tri's we need when we already know the corner+poly count.
*
- * Formula is:
- *
- * tri = ((corner_count / poly_count) - 2) * poly_count;
- *
- * Use doubles since this is used for allocating and we
- * don't want float precision to give incorrect results.
- *
* \param poly_count The number of ngon's/tris (1-2 sided faces will give incorrect results)
* \param corner_count - also known as loops in BMesh/DNA
*/
MINLINE int poly_to_tri_count(const int poly_count, const int corner_count)
{
- if (poly_count != 0) {
- const double poly_count_d = (double)poly_count;
- const double corner_count_d = (double)corner_count;
- BLI_assert(poly_count > 0);
- BLI_assert(corner_count > 0);
- return (int)((((corner_count_d / poly_count_d) - 2.0) * poly_count_d) + 0.5);
- }
- else {
- return 0;
- }
+ BLI_assert(corner_count > poly_count * 2);
+ return corner_count - (poly_count * 2);
}
MINLINE float plane_point_side_v3(const float plane[4], const float co[3])