|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Inward (erosion) and outward (dilation) offset of convex polygons. More...
#include <geom_algorithms.H>
Static Public Member Functions | |
| static Polygon | inward (const Polygon &convex_poly, const Geom_Number &distance) |
| Inward offset (erosion) of a convex polygon. | |
| static Polygon | outward (const Polygon &convex_poly, const Geom_Number &distance) |
| Outward offset (dilation) of a convex polygon. | |
Static Private Member Functions | |
| static Array< Point > | extract_verts (const Polygon &poly) |
| static Geom_Number | signed_double_area (const Array< Point > &v) |
| static bool | is_convex (const Array< Point > &v) |
| static void | ensure_ccw (Array< Point > &v) |
| static void | offset_edge (const Point &a, const Point &b, const Geom_Number &d, const bool inward, Point &oa, Point &ob) |
| Compute two points on the offset line of edge (a, b) moved by distance d along its outward (or inward) normal. | |
| static Point | line_intersect (const Point &a1, const Point &a2, const Point &b1, const Point &b2) |
| Line-line intersection of (a1,a2) and (b1,b2). | |
Friends | |
| class | PolygonOffset |
Inward (erosion) and outward (dilation) offset of convex polygons.
The inward offset shrinks the polygon by moving each edge inward by a perpendicular distance d, then intersecting the resulting half-planes. The outward offset expands it by moving edges outward and computing consecutive offset-line intersections.
Definition at line 8863 of file geom_algorithms.H.
Definition at line 8883 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::ensure_ccw().
|
inlinestaticprivate |
Definition at line 8867 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::extract_vertices().
|
inlinestatic |
Inward offset (erosion) of a convex polygon.
| convex_poly | A closed convex polygon. |
| distance | Perpendicular distance to move each edge inward. |
Definition at line 8956 of file geom_algorithms.H.
References ah_domain_error_if, Aleph::divide_and_conquer_partition_dp(), ensure_ccw(), extract_verts(), is_convex(), offset_edge(), Aleph::Array< T >::reserve(), and Aleph::Array< T >::size().
Referenced by offset_edge(), TEST_F(), and TEST_F().
Definition at line 8877 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::is_convex(), and Aleph::Array< T >::size().
|
inlinestaticprivate |
Line-line intersection of (a1,a2) and (b1,b2).
Definition at line 8926 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Point::get_x(), and Aleph::Point::get_y().
Referenced by Aleph::PolygonOffset::line_intersect(), and outward().
|
inlinestaticprivate |
Compute two points on the offset line of edge (a, b) moved by distance d along its outward (or inward) normal.
inward=true for CCW polygon means the normal is (dy, -dx) pointing to the interior.
The entire computation is performed in mpfr_class space because perpendicular-distance normalization involves sqrt, which is irrational for general rational inputs. Staying in mpfr avoids the costly mpfr->mpq->mpfr round-trips that produce large-denominator rationals and degrade subsequent arithmetic.
Definition at line 8897 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Point::get_x(), Aleph::Point::get_y(), hypot(), and inward().
Referenced by inward(), Aleph::PolygonOffset::offset_edge(), and outward().
|
inlinestatic |
Outward offset (dilation) of a convex polygon.
| convex_poly | A closed convex polygon. |
| distance | Perpendicular distance to move each edge outward. |
Definition at line 8993 of file geom_algorithms.H.
References Aleph::Polygon::add_vertex(), ah_domain_error_if, Aleph::Polygon::close(), Aleph::divide_and_conquer_partition_dp(), ensure_ccw(), extract_verts(), is_convex(), line_intersect(), offset_edge(), Aleph::Array< T >::reserve(), Aleph::Polygon::size(), and Aleph::Array< T >::size().
Referenced by TEST_F().
|
inlinestaticprivate |
Definition at line 8872 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::signed_double_area().
|
friend |
Definition at line 8865 of file geom_algorithms.H.