Commit Graph

21 Commits

Author SHA1 Message Date
69fa77d279 Various convex hull fixes
* Lower the required number of vertices from four to three. The new
  backend correctly outputs a triangle in this case.

* Fix the check for the number of input vertices. Before it was
  counting total number of input elements including edges and faces.

* Don't mark edges as holes if they are loose.

* Don't allow duplicate faces to be created.

* If use_existing_faces isn't enabled, but a face in the convex hull
  has the same vertices as an existing face in the mesh, mark it as
  output geometry rather than interior geometry.

* Fixes bug [#32960] Convex hull operator crashes when 'make holes' is
  selected.
  projects.blender.org/tracker/?func=detail&atid=498&aid=32960&group_id=9
2012-10-25 04:08:51 +00:00
1dadd3b7c6 Partially replace convex hull implementation with Bullet implementation
* Bullet's convex hull implementation is significantly more robust
  than the one I implemented, as well as being faster.

* This fixes bug [#32864] "Convex Hull fails in some cases."
  projects.blender.org/tracker/?func=detail&aid=32864&group_id=9&atid=498

  That bug, and others like it, relate to the poor handling of
  co-planar surfaces in the input. Pretty much any model that is
  simple-subdivided a few times gave very bad results before, Bullet's
  implementation handles this much better.

* In order to ensure a smooth transition, the Bullet output is
  translated into the existing HullTriangle hash structure. This makes
  it easy to ensure that the existing slot output stays the same; the
  interactions between the slots are somewhat complicated, detangling
  is a TODO.

* Reviewed by Brecht:
  https://codereview.appspot.com/6741063
2012-10-23 23:54:15 +00:00
e75f5c8208 quiet -Wmissing-prototypes warnings, and enable this warning by default for C with gcc.
helps for finding unused functions and making functions static, also did some minor code cleanup.
2012-09-15 01:52:28 +00:00
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
3a0593cc3d code cleanup: dont use function calls like dot_v3v3, pow and sqrt within macros which results in calling the function multiple times needlessly.
also added some comments.
2012-07-06 22:48:28 +00:00
2336aadb80 decrease size for convex hull epsilon when checking which side of a face the vertex is on.
this doesnt fix all cases but works better then it did.
2012-07-06 20:16:04 +00:00
1a9e7a00f3 style cleanup: var names 2012-07-06 19:22:21 +00:00
5f3bd06f37 code cleanup: use a define for bmesh hull epsilon 2012-07-05 18:03:07 +00:00
8b865c01cd style cleanup: comments 2012-06-30 22:49:33 +00:00
f57c1c8b34 Avoid adding overlapping triangles in convex hull
Add an epsilon value to the point-outside-hull test, helps when some
of the input vertices are nearly coplanar.

Fixes bug [#31941] convex hull fails (and depends on vertex order when it shouldn't)
http://projects.blender.org/tracker/index.php?func=detail&aid=31941&group_id=9&atid=498
2012-06-27 18:39:17 +00:00
9dd981a440 style cleanup: block comments 2012-05-16 23:37:23 +00:00
ed33320e3f Code cleanup: simplify standard GHash creation.
Added four new functions as shortcuts to creating GHashes that use the
standard ptr/str/int/pair hash and compare functions.

GHash *BLI_ghash_ptr_new(const char *info);
GHash *BLI_ghash_str_new(const char *info);
GHash *BLI_ghash_int_new(const char *info);
GHash *BLI_ghash_pair_new(const char *info);

Replaced almost all occurrences of BLI_ghash_new() with one of the
above functions.
2012-05-16 00:51:36 +00:00
0de912b82d Partial fix for bug #31458 Convex Hull operator crash
Change hull's point/triangle side test to > rather than >=.

This seems to fix the (infinite?) loop, but not the crash.
2012-05-14 20:59:08 +00:00
f87fda5864 Fix precision issue for bmo_hull.interior_geom output slot.
Keep track of interior verts during the hull build to avoid
imprecise floating-point test afterward.
2012-05-14 20:58:59 +00:00
4ea8c9ab38 Small hull bmop fix, distance check from plane needs absolute value. 2012-05-04 03:25:46 +00:00
2a1ba8c85b style cleanup: formatting and some float/double promotion 2012-05-03 19:57:24 +00:00
6f0cb140b0 Initialize an input in bmo_hull. 2012-05-02 23:29:52 +00:00
933b3166fc style cleanup: guys - set your editors to tabs! 2012-05-01 17:51:03 +00:00
8f3ed0501e code cleanup: quiet clang warnings, these would likely never but wont hurt to quiet them, 2012-04-30 10:47:32 +00:00
5979893711 style cleanup: edits to convex hull. 2012-04-30 10:39:35 +00:00
70f1279eab Add convex hull operator (bmesh operator and wm operator.)
Image-heavy user documentation:
http://wiki.blender.org/index.php/User:Nicholasbishop/Convex_Hull

Thanks to Campbell for providing code review:
http://codereview.appspot.com/6114060
2012-04-29 16:09:40 +00:00