Commit Graph

27 Commits

Author SHA1 Message Date
Werner Almesberger 9994a4c09b poly2d/Makefile: "install" and "uninstall" should be "phony", too 2017-01-24 16:34:48 -03:00
Werner Almesberger 385bd601a6 poly2d/p2d_attrib.c (p2d_is_cw): check that the angle isn't NaN
Been had by this a little too often ...
2015-01-19 02:59:43 -03:00
Werner Almesberger 155cfa3d44 poly2d/p2d_attrib.c (angle_3): prevent acos() domain errors
Rounding errors could push us slightly outside the [-1, 1] range, which
caused acos() to return NaN, which in turn broke p2d_is_cw, and eventually
tripped create_interior_skeleton_and_offset_polygons_with_holes_2.
2015-01-19 02:57:40 -03:00
Werner Almesberger ae8d393859 test/bugs: add regression tests for p2d_no_intersect and angle_3 bugs
That's commits 84f9d3c3b4
and 7ca942d0e9
2015-01-18 20:57:09 -03:00
Werner Almesberger 149fc262ff poly2d/: change license from GPLv2+ to LGPLv2.1+ 2015-01-18 20:45:44 -03:00
Werner Almesberger 7ca942d0e9 poly2d/p2d_attrib.c (angle_3): don't divide by zero ...
This broke p2d_is_cw which in turn tripped
CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2
with the infamous

terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: lParent
File: /usr/include/CGAL/arrange_offset_polygons_2.h
Line: 94
2015-01-18 20:27:26 -03:00
Werner Almesberger 05d3d50421 poly2d/p2d_attrib.c: correct line wrap in title comment (how did this get there ?) 2015-01-18 20:20:37 -03:00
Werner Almesberger de7df0b41c poly2d/p2d_attrib.c (angle_3): put spaces around operators 2015-01-18 20:17:58 -03:00
Werner Almesberger 6084b52c15 poly2d/p2d_area_holes.cpp (recurse_area): correct confusing indentation 2015-01-18 20:15:44 -03:00
Werner Almesberger 84f9d3c3b4 poly2d/p2d_attrib.c (p2d_no_intersect): don't test last vs. first segment
This one case slipped through. Surprisingly, it rarely produced a
complaint.
2015-01-18 09:09:43 -03:00
Werner Almesberger 5808a4001f poly2d/ (p2d_write_gnuplot, p2d_write_gnuplot_all): use "bool" instead of "int" 2015-01-10 21:22:39 -03:00
Werner Almesberger 3cc284d9c1 poly2d (p2d_contains_point): use "bool" instead of "int" 2015-01-10 21:21:29 -03:00
Werner Almesberger cba417fc37 poly2d (p2d_is_cw, p2d_is_closed, p2d_no_intersect, p2d_vertices): use better types
There's more to the world than just "int" ...
2015-01-10 21:16:47 -03:00
Werner Almesberger ebb7d028ea Revert "poly2d/p2d_hsort.c (p2d_hier_free): make freeing of polygons optional"
This reverts commit d758359791.
2013-10-14 11:13:22 -03:00
Werner Almesberger 626dbe52e1 poly2d/: store actual values in struct f2d, not pointers
... since the data structures they point to have internal use only.
2013-10-14 11:11:27 -03:00
Werner Almesberger ca271dd313 poly2d/f2d_tri.c (f2d_free_all): free list of faces 2013-10-13 22:09:49 -03:00
Werner Almesberger d0b5696a07 poly2d/f2d_tri_holes.cpp (find_point): don't loop forever on closed polygons 2013-10-13 21:57:50 -03:00
Werner Almesberger d758359791 poly2d/p2d_hsort.c (p2d_hier_free): make freeing of polygons optional 2013-10-13 21:29:48 -03:00
Werner Almesberger 3d8a8d04aa poly2d/f2d_tri_holes.cpp (tri_holes_append): rename to f2d_tri_holes_append 2013-10-13 21:29:13 -03:00
Werner Almesberger f93e93ca89 poly2d/: add triangulation (untested) 2013-10-13 20:33:05 -03:00
Werner Almesberger 53fe70950d poly2d/: try to work around spurious aborts in CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2
cameo encountered spurious aborts with the following message:

  terminate called after throwing an instance of 'CGAL::Precondition_exception
  what():  CGAL ERROR: precondition violation!
  Expr: is_simple_2(first, last, traits)
  File: /usr/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h
  Line: 420

These aborts come and go even if just the coordinate origin is slightly
changed. Setting CGAL_POLYGON_NO_PRECONDITIONS in p2d_area_holes.cpp
made them go away in some cases, but cameo could still run into an
assertion violation (in CGAL).

We now check all the polygons, outer boundary and holes, being sent to
CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2 for
simplicity, and stop recursing if there is any hint of a problem.

This seems to avoid trouble for now, but the issue deserves further
investigation.
2012-08-22 13:50:19 -03:00
Werner Almesberger 3ee5b1aa31 poly2d/: add foreach_v2d* and foreach_edges looping constructs 2012-05-08 14:06:00 -03:00
Werner Almesberger 038667d0d8 poly2d/p2d_hsort.c (p2d_hier_free): use p2d_free, not p2d_free_all
This caused a double free.
2012-05-08 00:51:43 -03:00
Werner Almesberger 7f813b5254 poly2h/: auto-generate dependencies also for C++ code 2012-05-07 22:53:45 -03:00
Werner Almesberger a950c5b13c poly2d/: simplify semantics of first/next offset in area fill 2012-05-07 22:45:39 -03:00
Werner Almesberger 46c8f8653c poly2d/: automatically switch between clockwise and counter-clockwise polygons
The only functions that care about this at the moment are from CGAL,
and there we can determine from context what to do.
2012-05-07 22:12:21 -03:00
Werner Almesberger dfa85075e8 poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00