Commit Graph

100 Commits

Author SHA1 Message Date
25fe5c20aa code cleanup: rename ScanFillVert.h --> edge_tot, SF_VERT_UNKNOWN --> SF_VERT_AVAILABLE 2013-02-21 17:15:55 +00:00
7fa256815f skip fix from r54579 when holes aren't used (keeps bmesh ngon filling fast) 2013-02-15 12:57:11 +00:00
964c35771c Bug fix #34177
Blender's triangulator has been rescued :)
This commit fixes errors with concave holes inside polygons.

Simple explanation:

Blender "ScanFill" works by sorting vertices from top-left to bottom-right, and connecting
these vertices with a sorted list of edges they have.

The inner loop then goes over every vertex, its edges, and tries to make triangles by
checking vertices that are next in the list.
- if the triangle has points inside: it creates an edge to this vertex, and continues
- else: add new triangle.

Very simple, fast and efficient. But it needed one more check for the first step: it should
check every vertex inside the triangle, and pick the best vertex for an edge based on forming 
the sharpest angle with the tested edge. That solves the case for concave holes.

Blender ScanFill was coded 20 years ago, and is an own invention. I wanted a triangulator that
just fills any collection of polygons, including with holes.
No idea if this was ever published in a paper!
2013-02-15 12:26:47 +00:00
942ad6d9cd style cleanup 2013-02-10 17:06:05 +00:00
4a427d8e0d style cleanup 2012-12-29 01:54:58 +00:00
f0c1bc830c add option to BLI_scanfill_calc() - BLI_SCANFILL_CALC_HOLES, gives some speedup for BMesh ngons which never have holes and ensures predictable triangle count (totvert - 2), which is needed for pre-calculating array size. 2012-12-27 06:39:27 +00:00
f9e339ef00 fix/workaround [#33281] script goes into not responding
scanfill remove-doubles pass assumes ordered edges (as with curves), otherwise it can hang.
workaround this problem by skipping removing-doubles for mesh ngons, since this isnt such a common case as it is with curves and we can just not support it.
2012-11-26 23:18:04 +00:00
b867f9f17e style cleanup: comments & spelling 2012-11-18 01:22:31 +00:00
aeba4950c3 style cleanup 2012-10-27 10:42:28 +00:00
f70d2c65d8 rename api functions...
- minf, maxf, mini, maxi --> min_ff, max_ff, min_ii, max_ii
2012-10-23 13:28:22 +00:00
1767b65846 style cleanup: also rename bmesh_decimate.c --> bmesh_decimate_collapse.c 2012-10-23 03:38:26 +00:00
2fb8292005 style cleanup 2012-09-16 04:58:18 +00:00
a0ae47f06c add some missing NULL checks, a few parts of the code used a pointer then checked it for NULL after.
also made it more clear that some areas assume the pointer isnt null (remove redundant NULL checks).
2012-09-11 02:18:27 +00:00
b96c622015 style cleanup 2012-08-11 22:12:32 +00:00
c41e1e434a code cleanup: replace MIN2/MAX2 with minf/maxf 2012-07-29 16:59:51 +00:00
1597ad9377 style cleanup 2012-07-01 09:54:44 +00:00
c8ebfe1d12 code cleanup:
- use bmesh iterator macros in more places
- rename scanfill variables (were using same names as mesh faces/verts which was confusing)
2012-05-13 14:47:53 +00:00
bddc7dfc20 style cleanup: remaining BLI files. 2012-05-12 15:13:06 +00:00
4c5502bfd6 code cleanup: function naming for BLI functions. 2012-05-05 00:23:55 +00:00
8765dfccf7 style cleanup: correct typos 2012-04-21 14:14:58 +00:00
d7542be6ac code cleanup: more minor changes to scanfill 2012-04-18 14:36:56 +00:00
abcaec0edc code cleanup: replace magic numbers in scanfill with defines, also use some vector functions where possible 2012-04-18 14:30:57 +00:00
ca913254aa fix for eternal loop in scanfill,
The cause for this is bmesh faces which have zero area have their normals set to a fake value (Z-Up), this would break scanfill, possible fixes are to calculate the faces normal each time or tag as invalid but its easiest to avoid the eternal loop with an extra test.
2012-04-18 14:06:59 +00:00
6389301eb5 fix for own error in recent scanfill updates, scanfill can hang if run on a polygon with no area. 2012-04-18 05:52:18 +00:00
195d6c1b1a minor speedup for scanfill, dont calculate the normal if its already known - use for editmode ngon filling. 2012-04-16 18:24:49 +00:00
67f8e3a3a7 inline function for "Newell's Method" used for normal calc. 2012-04-16 16:49:37 +00:00
e889fa4678 improve scanfill for uneven ngons, previously scanfill would use the most angular corner, but this made non planer ngons rip frequently (often reported problem).
now calculate the normal as with ngons.
2012-04-16 16:24:55 +00:00
0635f8101c make scanfill threadsafe (wasnt threadsafe before BMesh merge but before the merge it didn't need to be) - now rendering uses its better if its threadsafe. 2012-04-16 06:48:57 +00:00
fb1e60762f style cleanup: scanfill, spelling and use NULL rather then 0 2012-04-16 05:23:40 +00:00
79693e4543 code cleanup: avoid confusion with incorrectly named argument to BLI_edgefill(), was 'mat_nr', now 'do_quad_tri_speedup' 2012-04-16 05:03:04 +00:00
b8a71efeba style cleanup: follow style guide for/with/if spacing 2012-03-24 07:52:14 +00:00
69e6894b15 style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:18:31 +00:00
577bef62eb Fix #30543: tessellating ngons with small angles was failing. There was a quite
arbitrary limit of pi/24 for picking 3 vertices to use for computing a normal,
now it uses vertices with the maximum angle between them.
2012-03-20 19:32:31 +00:00
dfdfa3d51b code cleanup: replace macros VECCOPY, VECADD, VECSUB, INPR - with BLI_math funcs.
added copy float/double funcs: copy_v3fl_v3db(), copy_v3db_v3fl(). 2d & 4d too.
2012-03-09 06:04:17 +00:00
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
ed04c21374 code cleanup: use float vector size in function definitions, and const's where the values are unchanged. 2012-02-28 14:05:00 +00:00
1cad189e32 fix harmless but annoying memory leak prints, "newmem", now free all scanfill memory on exit. 2012-02-19 22:36:24 +00:00
a368e6771a - remove some unused editmesh functions.
- copy & rename EditMesh stricts for use with scanfill (remove unused members)
2012-02-19 22:17:30 +00:00
d74c564235 svn merge ^/trunk/blender -r42333:42361 2011-12-02 23:02:21 +00:00
06c3d5bd09 de-duplicate dominant axis calculation, exact same checks were in 6 different places.
added function:  axis_dominant_v3(...)
2011-12-02 22:14:20 +00:00
faa022563d svn merge ^/trunk/blender -r42245:42261 2011-11-29 18:18:56 +00:00
06ea86c0a8 Allow scanfill caller to specify boundary edges and use to fix knifetool extra-face bug 2011-11-29 11:49:53 +00:00
b2c7dd2d5c Fix for [#28528] Disappearing Faces
Bring back some old scanfill code to handle tesselating polys with some zero-length edges. This code used to cause #4544 but I haven't been able to recreate that now, so I'm going to revive the old code and if #4544 does come back, we'll have to fix it some other way I guess (or come up with a better solution for zero-length edges in polys).
2011-11-22 14:04:33 +00:00
707fcc42a3 replace macros with math functions 2011-11-16 17:37:20 +00:00
e84c0980a3 correct indentation and some whitespace edits (no functional changes) 2011-11-11 13:09:14 +00:00
15e6d6cd75 svn merge ^/trunk/blender -r41226:41227 . 2011-10-24 12:43:08 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
7a103d33eb fix for assert 2011-09-24 16:52:54 +00:00
b392539e40 optimization for scanfill allocation function.
- replace "size= 4*( (size+3)/4 );" with "size = (size + 3 ) & ~3;"
- split new_mem_element into 2 functions, one to reset, another to allocate so allocating isnt checking to reset each time.
2011-09-24 16:38:02 +00:00
3f91c0ab5d correct edit some comments 2011-09-09 14:51:30 +00:00