diff --git a/poly2d/cgal_helper.h b/poly2d/cgal_helper.h index 8e6886f..8c649e0 100644 --- a/poly2d/cgal_helper.h +++ b/poly2d/cgal_helper.h @@ -1,8 +1,8 @@ /* * cgal_helper.h - Conversions between poly2d and CGAL * - * Written 2012 by Werner Almesberger - * Copyright 2012 by Werner Almesberger + * Written 2012, 2015 by Werner Almesberger + * Copyright 2012, 2015 by Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,8 @@ */ extern "C" { + #include + #include "poly2d.h" } @@ -35,7 +37,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Polygon_2 Polygon_2; -static inline Polygon_2 p2d_to_P2(const struct p2d *p, int ccw) +static inline Polygon_2 p2d_to_P2(const struct p2d *p, bool ccw) { const struct v2d *v; Polygon_2 np; diff --git a/poly2d/p2d_attrib.c b/poly2d/p2d_attrib.c index 7cde546..48932a2 100644 --- a/poly2d/p2d_attrib.c +++ b/poly2d/p2d_attrib.c @@ -1,8 +1,8 @@ /* * p2d_attrib.c - Determine various polygon attributes * - * Written 2012 by Werner Almesberger - * Copyright 2012 Werner Almesberger + * Written 2012, 2015 by Werner Almesberger + * Copyright 2012, 2015 Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -11,6 +11,7 @@ */ +#include #include #include @@ -46,7 +47,7 @@ static double angle_3(const struct v2d *a, const struct v2d *b, * If we predominantly turn to the right, then the path must be clockwise. */ -int p2d_is_cw(const struct p2d *p) +bool p2d_is_cw(const struct p2d *p) { const struct v2d *v; double a = 0; @@ -65,7 +66,7 @@ int p2d_is_cw(const struct p2d *p) } -int p2d_is_closed(const struct p2d *p) +bool p2d_is_closed(const struct p2d *p) { return p->v == p->last || p->last->next; } @@ -76,7 +77,7 @@ int p2d_is_closed(const struct p2d *p) * go unnoticed. */ -int p2d_no_intersect(const struct p2d *p) +bool p2d_no_intersect(const struct p2d *p) { const struct v2d *v, *u; @@ -106,10 +107,10 @@ int p2d_no_intersect(const struct p2d *p) } -int p2d_vertices(const struct p2d *p) +unsigned p2d_vertices(const struct p2d *p) { const struct v2d *v; - int n = 0; + unsigned n = 0; v = p->v; while (v) { diff --git a/poly2d/poly2d.h b/poly2d/poly2d.h index 407994f..023ec51 100644 --- a/poly2d/poly2d.h +++ b/poly2d/poly2d.h @@ -121,10 +121,10 @@ struct p2d *p2d_reverse(const struct p2d *p); * p2d_vertices counts the number of vertices in a polygon. */ -int p2d_is_cw(const struct p2d *p); -int p2d_is_closed(const struct p2d *p); -int p2d_no_intersect(const struct p2d *p); -int p2d_vertices(const struct p2d *p); +bool p2d_is_cw(const struct p2d *p); +bool p2d_is_closed(const struct p2d *p); +bool p2d_no_intersect(const struct p2d *p); +unsigned p2d_vertices(const struct p2d *p); /* * Convert a possibly self-intersecting polygon into one or more simple