|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Iterator over the edges (segments) of a polygon. More...
#include <polygon.H>
Public Member Functions | |
| Segment_Iterator (const Polygon &poly) | |
| Construct a segment iterator from a polygon. | |
| bool | has_curr () const |
| Check if there is a current segment. | |
| Segment | get_current_segment () const |
| Get the current segment (edge). | |
Public Member Functions inherited from Aleph::Dlink::Iterator | |
| Iterator (Dlink *head_ptr) noexcept | |
Initialize an iterator on the first item of the list pointed by head_ptr. | |
| Iterator (const Dlink &list) noexcept | |
Initialize an iterator on the first item of list. | |
| void | set (Dlink *new_curr) noexcept |
| Set the current node . | |
| Iterator () noexcept | |
| void | reset_first () noexcept |
| Reset the iterator to the first item of list. | |
| void | reset_last () noexcept |
| Reset the iterator to the last item of list. | |
| void | end () noexcept |
| Put the iterator out of range. | |
| bool | has_curr () const noexcept |
Return true if the iterator has current item. | |
| bool | is_last () const noexcept |
| Dlink * | get_curr_ne () const noexcept |
| Return the current link guaranteeing no exception. Be careful. | |
| Dlink * | get_curr () const |
| Return the current node of iterator. | |
| constexpr bool | is_in_first () const noexcept |
Return true if the iterator is positiones on the first item. | |
| bool | is_in_last () const noexcept |
Return true if the iterator is positiones on the last item. | |
| void | prev_ne () noexcept |
| Move the iterator one position backward guaranteeing no exception. | |
| void | prev () |
| Move the iterator one position backward. | |
| void | next_ne () noexcept |
| Move the iterator one position backward guaranteeing no exception. | |
| void | next () |
| Move the iterator one position forward. | |
| constexpr bool | operator== (const Iterator &it) const noexcept |
Return true if this and it are positioned on the same item. | |
| constexpr bool | operator!= (const Iterator &it) const noexcept |
Return true if this and it hace different states. | |
| Dlink * | del () |
| Remove from the list the current node and move the iterator one position forward. | |
| Dlink * | del_ne () noexcept |
| constexpr bool | verify (Dlink *l) const noexcept |
Return true if the iterator is on the list pointed by l | |
| constexpr bool | verify (const Iterator &it) const noexcept |
Return true if this and it are on the same list. | |
Private Attributes | |
| Polygon & | poly_ |
| Reference to the polygon being iterated. | |
Additional Inherited Members | |
Public Types inherited from Aleph::Dlink::Iterator | |
| using | Set_Type = Dlink |
| The set type. | |
| using | Item_Type = Dlink * |
| The type of elements of container. | |
Iterator over the edges (segments) of a polygon.
Provides sequential access to all edges of the polygon. For a closed polygon, this includes the edge from the last vertex back to the first.
Construct a segment iterator from a polygon.
| poly | The polygon to iterate over. |
| std::domain_error | If the polygon has fewer than 2 vertices. |
Definition at line 527 of file polygon.H.
References ah_domain_error_if, Aleph::Dlink::is_unitarian_or_empty(), poly_, and Aleph::Polygon::vertex_list_.
|
inline |
Get the current segment (edge).
| std::domain_error | If at last vertex of an open polygon. |
Definition at line 548 of file polygon.H.
References ah_domain_error_if, Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Vertex::dlink_to_vertex(), Aleph::Dlink::Iterator::get_curr(), Aleph::Polygon::get_first_vertex(), Aleph::Polygon::is_closed(), Aleph::Dlink::Iterator::is_in_last(), Aleph::Vertex::next_vertex(), poly_, and Aleph::Vertex::to_point().
Referenced by Aleph::Polygon::close(), Aleph::Polygon::is_convex(), and TEST_F().
|
inline |
Check if there is a current segment.
Definition at line 537 of file polygon.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Dlink::Iterator::has_curr(), Aleph::Polygon::is_closed(), and Aleph::Dlink::Iterator::is_in_last().
Referenced by brute_convex_distance_squared(), Aleph::Polygon::centroid(), demo_coverage_area(), Aleph::CuttingEarsTriangulation::diagonalize(), Aleph::Polygon::intersects_with(), Aleph::Polygon::is_convex(), Aleph::Polygon::locate_point(), Aleph::TrapezoidalMapPointLocation::operator()(), Aleph::TrapezoidalMapPointLocation::operator()(), Aleph::ShortestPathInPolygon::operator()(), Aleph::Polygon::perimeter(), Aleph::ConvexPolygonDistanceGJK::polygons_intersect_or_contain(), Aleph::detail::shortest_path_portals(), Aleph::Polygon::signed_area(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
private |
Reference to the polygon being iterated.
Definition at line 521 of file polygon.H.
Referenced by Segment_Iterator(), and get_current_segment().