[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53340] trunk/blender/source/blender/ blenlib/intern/math_geom_inline.c: correction for poly_to_tri_count() when given zero poly count.
Campbell Barton
ideasman42 at gmail.com
Thu Dec 27 06:08:24 CET 2012
Revision: 53340
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53340
Author: campbellbarton
Date: 2012-12-27 05:08:16 +0000 (Thu, 27 Dec 2012)
Log Message:
-----------
correction for poly_to_tri_count() when given zero poly count.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/math_geom_inline.c
Modified: trunk/blender/source/blender/blenlib/intern/math_geom_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom_inline.c 2012-12-27 04:18:22 UTC (rev 53339)
+++ trunk/blender/source/blender/blenlib/intern/math_geom_inline.c 2012-12-27 05:08:16 UTC (rev 53340)
@@ -173,9 +173,16 @@
*/
MINLINE int poly_to_tri_count(const int poly_count, const int corner_count)
{
- const double poly_count_d = (double)poly_count;
- const double corner_count_d = (double)corner_count;
- return (int)((((corner_count_d / poly_count_d) - 2.0) * poly_count_d) + 0.5);
+ 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;
+ }
}
#endif /* __MATH_GEOM_INLINE_C__ */
More information about the Bf-blender-cvs
mailing list