|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Iterator over the edges (segments) of a regular polygon. More...
#include <polygon.H>
Public Member Functions | |
| Segment_Iterator (const Regular_Polygon &poly) | |
| Construct segment iterator from a regular polygon. | |
| bool | has_curr () const |
| Check if there is a current segment. | |
| Segment | get_current_segment () const |
| Get the current segment (edge). | |
| void | next_ne () noexcept |
| Advance to the next segment (no exception on overflow). | |
| void | next () |
| Advance to the next segment. | |
| void | prev () |
| Move to the previous segment. | |
Private Attributes | |
| const Regular_Polygon & | poly_ |
| Reference to the polygon. | |
| size_t | curr_ |
| Current segment index. | |
Iterator over the edges (segments) of a regular polygon.
This iterator provides the same interface as Polygon::Segment_Iterator to enable generic code that works with both polygon types.
|
inline |
|
inline |
Get the current segment (edge).
| std::overflow_error | If no current segment exists. |
Definition at line 1328 of file polygon.H.
References ah_overflow_error_if, curr_, Aleph::divide_and_conquer_partition_dp(), Aleph::Regular_Polygon::get_vertex(), has_curr(), poly_, and Aleph::Regular_Polygon::size().
|
inline |
Check if there is a current segment.
Definition at line 1323 of file polygon.H.
References curr_, poly_, and Aleph::Regular_Polygon::size().
Referenced by get_current_segment(), next(), prev(), TEST_F(), and TEST_F().
|
inline |
Advance to the next segment.
| std::overflow_error | If already at end. |
Definition at line 1340 of file polygon.H.
References ah_overflow_error_if, Aleph::divide_and_conquer_partition_dp(), has_curr(), and next_ne().
Referenced by TEST_F().
|
inlinenoexcept |
|
inline |
Move to the previous segment.
| std::underflow_error | If already at the beginning. |
Definition at line 1348 of file polygon.H.
References ah_underflow_error_if, curr_, Aleph::divide_and_conquer_partition_dp(), and has_curr().
|
private |
Current segment index.
Definition at line 1310 of file polygon.H.
Referenced by get_current_segment(), has_curr(), next_ne(), and prev().
|
private |
Reference to the polygon.
Definition at line 1309 of file polygon.H.
Referenced by get_current_segment(), and has_curr().