1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:26:27 +02:00
cae-tools/poly2d
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
..
test poly2d/: add foreach_v2d* and foreach_edges looping constructs 2012-05-08 14:06:00 -03:00
cgal_helper.h poly2d (p2d_is_cw, p2d_is_closed, p2d_no_intersect, p2d_vertices): use better types 2015-01-10 21:16:47 -03:00
f2d_tri_holes.cpp poly2d/: store actual values in struct f2d, not pointers 2013-10-14 11:11:27 -03:00
f2d_tri.c Revert "poly2d/p2d_hsort.c (p2d_hier_free): make freeing of polygons optional" 2013-10-14 11:13:22 -03:00
Makefile poly2d/: add triangulation (untested) 2013-10-13 20:33:05 -03:00
p2d_area_holes.cpp poly2d/p2d_area_holes.cpp (recurse_area): correct confusing indentation 2015-01-18 20:15:44 -03:00
p2d_area.c Revert "poly2d/p2d_hsort.c (p2d_hier_free): make freeing of polygons optional" 2013-10-14 11:13:22 -03:00
p2d_attrib.c poly2d/p2d_attrib.c (angle_3): don't divide by zero ... 2015-01-18 20:27:26 -03:00
p2d_contains_point.c poly2d (p2d_contains_point): use "bool" instead of "int" 2015-01-10 21:21:29 -03:00
p2d_contains_poly.c poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00
p2d_copy.c poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00
p2d_free.c poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00
p2d_gnuplot.c poly2d/ (p2d_write_gnuplot, p2d_write_gnuplot_all): use "bool" instead of "int" 2015-01-10 21:22:39 -03:00
p2d_hsort.c Revert "poly2d/p2d_hsort.c (p2d_hier_free): make freeing of polygons optional" 2013-10-14 11:13:22 -03:00
p2d_hsort.h Revert "poly2d/p2d_hsort.c (p2d_hier_free): make freeing of polygons optional" 2013-10-14 11:13:22 -03:00
p2d_make.c poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00
p2d_offset.cpp poly2d/: automatically switch between clockwise and counter-clockwise polygons 2012-05-07 22:12:21 -03:00
poly2d.h poly2d/ (p2d_write_gnuplot, p2d_write_gnuplot_all): use "bool" instead of "int" 2015-01-10 21:22:39 -03:00
README poly2h/: auto-generate dependencies also for C++ code 2012-05-07 22:53:45 -03:00
util.h poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00
v2d_intersect.c poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00
v2d_line_distance.c poly2d/: Yet another 2D polygon library (WIP) 2012-05-06 23:51:38 -03:00

poly2d - Yet another 2D polygon library
=======================================

Why do we need another 2D polygon library, if there are already CGAL,
Boost, Clipper, GPC, ... ?

All the above are either written in a weird language, are under a
non-Free license, or simply don't provide the feature set we need
here. poly2d is written in C, doesn't depend on non-standard
libraries, and is licensed under the GPL (will change to LGPL).

poly2d serves itself liberally from code already in cameo but
provides a simpler and cleaner interface. The first objective is
to provide the tools to replace the (badly broken) area filling
operation in cameo. Later, poly2d could replace more parts of
cameo.

poly2d puts more emphasis on simplicity than on performance. Some
functions expect closed polygons that don't self-intersect. For now,
it doesn't matter whether polygons are clockwise or counter-clockwise. 
The table below shows the capabilities

Open     Min. vertices
|  Concave
|  |  Self-intersect
|  |  |  |
Y  Y  Y  0		p2d_contains_poly(b), p2d_copy, p2d_free, p2d_free_all,
			p2d_is_closed, p2d_no_intersect, p2d_reverse,
			p2d_vertices, p2d_write_gnuplot, p2d_write_gnuplot_all
Y  Y  Y  1		p2d_read_gnuplot
-  Y  Y  0		p2d_simplify
-  Y  -  3		p2d_is_cw
-  Y  -  3		p2d_contains_point, p2d_contains_poly (a),
-  Y  -  3		p2d_area*, p2d_offset*

Not yet implemented:
- p2d_simplify (low priority - the offsetting from CGAL already covers
  the main use case)

Not yet specified:
- subtraction (do we actually need it ?)

Other:
- change the license from GPL to LGPL
- transform CGAL's idea of outer polygons into something we can use
- check for memory leaks

Prerequisite:
libcgal-dev