Commit Graph

110 Commits

Author SHA1 Message Date
098cf90956 use strict flags for scanfill, also replace shorts with unsigned shorts and ints/bools in some cases. 2013-09-01 03:37:45 +00:00
9e561a641e remove callback BLI_localErrorCallBack from scanfill, was here for years and only ever wrapped printf. 2013-08-28 02:14:24 +00:00
27df6a3b54 scanfill curves, ngons, masks had their own memarena code and would allocate a new one for every fill.
now use BLI_memarena and support passing the arena into the fill function, so the arena is re-used, when scanfill is called in a loop.
2013-08-28 02:07:54 +00:00
f97a4bd254 code cleanup: more zero as NULL pointers. 2013-08-07 03:36:05 +00:00
a050ddf279 remove unused callback 2013-06-26 03:42:45 +00:00
f8c37b083c remove own optimization in scanfill, in rare cases it caused problems, reported as [#35861] 2013-06-24 18:22:59 +00:00
99b55ef6eb add asserts when scanfilling or triangulating with zero length normal. 2013-06-02 22:54:00 +00:00
5018ea5e29 real fix for [#35097], (curve cap flipping).
previous commit was incorrect, the face flipping depended on the orientation of the curve.

fix by passing the bevel direction to the fill function so we can have a reliable front/back.

This also gives some speedup for all curve filling since we can avoid calculating the normal since its already known.
2013-04-26 21:04:12 +00:00
1143b658a0 fix [#34947] Alt-F Fill not working
Regression in r54579.
2013-04-10 23:59:37 +00:00
ece766ee7e code cleanup: unused defines, remove unused scanfill success value from BLI_scanfill_begin(). 2013-04-10 23:52:07 +00:00
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