Commit Graph

133 Commits

Author SHA1 Message Date
5513da65b2 Cleanup: trailing space for BLI 2018-06-17 16:32:54 +02:00
bb6fbc64ae Docs: scanfill.c purpose 2016-05-06 00:45:38 +10:00
dbf1257b14 Minor optimization for scanfill
Replace angle with with cosine calculation.
2016-04-20 09:53:40 +10:00
9c782c17ba Cleanup: hopefully last int->bool one in this area! 2014-12-01 17:11:55 +01:00
7d040d2a08 Cleanup: use BLI_listbase_*** prefix for count,sort,sort_r 2014-11-16 13:57:58 +01:00
bba80ed7af Cleanup 2014-08-17 12:18:40 +10:00
0b6412607f Comments 2014-08-07 14:42:47 +10:00
483d8da9bc Code cleanup: use 'const' for arrays (blenlib) 2014-04-27 00:25:15 +10:00
0319db1063 Correct own recent changes broke release builds 2014-03-30 20:35:59 +11:00
ae8327dbf3 Mask: add option to detect self intersections 2014-02-13 19:12:28 +11:00
c85e66e7fe Scanfill: add user-flags for edges and verts, useful elsewhere. 2014-02-13 16:46:51 +11:00
fcb06097a5 Scanfill: name flags better and comment unused SF_EDGE_BOUNDARY flag. 2014-02-13 14:13:42 +11:00
108ad34429 Mask: option not to treat overlapping curves as holes 2014-02-13 11:48:46 +11:00
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
6110a5bdef Scanfill: use poly_nr as an index rather then index + 1 2014-02-06 02:12:46 +11:00
41d23116aa Scanfill: malloc arrays and zero init members 2014-02-06 01:03:02 +11:00
d598dcd461 Code cleanup: remove scdata from ScanFillContext 2014-02-05 05:39:28 +11:00
6c17d2141b Scanfill: optimize filling curves, text, masks - skip calculating holes
Support for tagging polygon numbers when adding scanfill data,
saves having to calculate connectivity afterwards (which can take approx half overall scanfill time for complex curves).
2014-02-05 05:27:01 +11:00
db74968402 Scanfill: minor optimization, comment unused code, avoid vert loop 2014-02-05 05:27:01 +11:00
8b1731e13d Scanfill: skip checks for loose edges when they can't occur
Only editmesh needs this, text, curves, masks - can all skip this check
2014-02-04 02:57:27 +11:00
0d7586739a Code cleanup: replace while -> for loops 2014-02-04 02:23:34 +11:00
af93ebcb50 Code Cleanup: style and redundant casts 2014-01-16 19:15:53 +11:00
6f5ced4a30 Math Lib: add dist_squared_to_line_v2, avoids sqrt in scanfill and 3d-text 2013-12-28 17:23:59 +11:00
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