|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
O(n log n) triangulation of simple polygons via y-monotone partition + linear-time monotone triangulation. More...
#include <geom_algorithms.H>
Classes | |
| class | EdgeStatusTree |
Public Member Functions | |
| DynList< Triangle > | operator() (Polygon p) const |
| Triangulate a simple polygon. | |
Private Types | |
| enum class | VertexType { START , END , SPLIT , MERGE , REGULAR } |
| Classification of vertices for y-monotone decomposition. More... | |
Static Private Member Functions | |
| static Array< Point > | extract_vertices (const Polygon &p) |
| static Geom_Number | signed_double_area (const Array< Point > &v) |
| static void | ensure_ccw (Array< Point > &v) |
| static bool | is_above (const Point &a, const Point &b) |
| Lexicographical "above" comparison (y primary, x secondary). | |
| static bool | is_below (const Point &a, const Point &b) |
| Lexicographical "below" comparison. | |
| static bool | edge_goes_down (const Array< Point > &verts, const size_t edge) |
Check if the edge starting at edge points downwards. | |
| static Geom_Number | edge_x_at_y (const Array< Point > &verts, const size_t edge, const Geom_Number &y) |
| static bool | edge_status_less (const size_t lhs, const size_t rhs, const Geom_Number &sweep_y, const Array< Point > &verts) |
| static DynList< Triangle > | triangulate_monotone (const Array< Point > &verts) |
| Triangulate a y-monotone polygon given as a vertex array. | |
| static VertexType | classify_vertex (const Array< Point > &v, const size_t i) |
| static bool | regular_interior_right (const Array< Point > &v, const size_t i) |
| static Array< Array< size_t > > | build_faces_from_diagonals (const Array< Point > &verts, const DynSetTree< std::pair< size_t, size_t > > &diagonals) |
| static Array< Array< size_t > > | decompose_to_monotone_faces (const Array< Point > &verts) |
| static bool | is_y_monotone (const Array< Point > &v) |
| Check if a CCW polygon vertex array is y-monotone. | |
O(n log n) triangulation of simple polygons via y-monotone partition + linear-time monotone triangulation.
Definition at line 6091 of file geom_algorithms.H.
|
strongprivate |
Classification of vertices for y-monotone decomposition.
| Enumerator | |
|---|---|
| START | |
| END | |
| SPLIT | |
| MERGE | |
| REGULAR | |
Definition at line 6112 of file geom_algorithms.H.
|
inlinestaticprivate |
Definition at line 6508 of file geom_algorithms.H.
References Aleph::and, Aleph::Array< T >::append(), Aleph::Array< T >::empty(), Aleph::Point::get_x(), Aleph::Point::get_y(), Aleph::in_place_sort(), Aleph::in_place_unique(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::Array< T >::is_empty(), k, pred, Aleph::Array< T >::reserve(), Aleph::DynSetTree< Key, Tree, Compare >::search(), and Aleph::Array< T >::size().
Referenced by decompose_to_monotone_faces().
|
inlinestaticprivate |
Definition at line 6483 of file geom_algorithms.H.
References Aleph::and, Aleph::CW, END, is_above(), is_below(), MERGE, Aleph::next(), Aleph::orientation(), REGULAR, Aleph::Array< T >::size(), SPLIT, and START.
Referenced by decompose_to_monotone_faces().
|
inlinestaticprivate |
Definition at line 6622 of file geom_algorithms.H.
References Aleph::and, Aleph::Array< T >::append(), build_faces_from_diagonals(), classify_vertex(), edge_goes_down(), END, Aleph::MonotonePolygonTriangulation::EdgeStatusTree::erase(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::MonotonePolygonTriangulation::EdgeStatusTree::insert(), is_y_monotone(), Aleph::MonotonePolygonTriangulation::EdgeStatusTree::left_edge_of_point(), MERGE, Aleph::quicksort_op(), REGULAR, regular_interior_right(), Aleph::Array< T >::reserve(), Aleph::Array< T >::size(), SPLIT, and START.
Referenced by operator()().
|
inlinestaticprivate |
Check if the edge starting at edge points downwards.
Definition at line 6140 of file geom_algorithms.H.
References is_below(), and Aleph::Array< T >::size().
Referenced by decompose_to_monotone_faces().
|
inlinestaticprivate |
Definition at line 6157 of file geom_algorithms.H.
References edge_x_at_y().
Referenced by Aleph::MonotonePolygonTriangulation::EdgeStatusTree::predecessor_for_insert(), and Aleph::MonotonePolygonTriangulation::EdgeStatusTree::successor_for_insert().
|
inlinestaticprivate |
Definition at line 6145 of file geom_algorithms.H.
References Aleph::Point::get_x(), Aleph::Point::get_y(), Aleph::Array< T >::size(), and y.
Referenced by edge_status_less(), and Aleph::MonotonePolygonTriangulation::EdgeStatusTree::left_edge_of_point().
|
inlinestaticprivate |
Definition at line 6104 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::ensure_ccw().
Referenced by operator()().
|
inlinestaticprivate |
Definition at line 6094 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::extract_vertices().
Referenced by operator()().
|
inlinestaticprivate |
Lexicographical "above" comparison (y primary, x secondary).
Definition at line 6124 of file geom_algorithms.H.
References Aleph::and, Aleph::Point::get_x(), and Aleph::Point::get_y().
Referenced by classify_vertex(), and is_below().
|
inlinestaticprivate |
Lexicographical "below" comparison.
Definition at line 6132 of file geom_algorithms.H.
References is_above().
Referenced by classify_vertex(), edge_goes_down(), and regular_interior_right().
|
inlinestaticprivate |
Check if a CCW polygon vertex array is y-monotone.
Definition at line 6861 of file geom_algorithms.H.
References Aleph::and, Aleph::next(), and Aleph::Array< T >::size().
Referenced by decompose_to_monotone_faces(), and operator()().
Triangulate a simple polygon.
For convex and y-monotone polygons, the result is computed directly in O(n). For general simple polygons, the polygon is partitioned into y-monotone sub-polygons in O(n log n), then each sub-polygon is triangulated in linear time.
| p | The polygon (will not be modified; a copy is used). |
| domain_error | if polygon is not closed or has < 3 vertices. |
| domain_error | if polygon is degenerate (zero area). |
Definition at line 6795 of file geom_algorithms.H.
References Aleph::Polygon::add_vertex(), ah_domain_error_if, Aleph::Array< T >::append(), Aleph::DynList< T >::append(), Aleph::Polygon::close(), decompose_to_monotone_faces(), ensure_ccw(), extract_vertices(), LocateFunctions< Container, Type >::get_it(), Aleph::Polygon::is_closed(), is_y_monotone(), Aleph::Array< T >::reserve(), signed_double_area(), Aleph::Polygon::size(), Aleph::Array< T >::size(), Aleph::size(), and triangulate_monotone().
|
inlinestaticprivate |
Definition at line 6503 of file geom_algorithms.H.
References is_below(), and Aleph::Array< T >::size().
Referenced by decompose_to_monotone_faces().
|
inlinestaticprivate |
Definition at line 6099 of file geom_algorithms.H.
References Aleph::GeomPolygonUtils::signed_double_area().
Referenced by operator()().
|
inlinestaticprivate |
Triangulate a y-monotone polygon given as a vertex array.
Definition at line 6379 of file geom_algorithms.H.
References Aleph::and, Aleph::Array< T >::append(), Aleph::DynList< T >::append(), Aleph::area_of_parallelogram(), Aleph::FixedStack< T >::is_empty(), Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), Aleph::quicksort_op(), Aleph::Array< T >::reserve(), Aleph::Array< T >::size(), Aleph::FixedStack< T >::size(), and Aleph::FixedStack< T >::top().
Referenced by operator()().