|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Sweep-line status as a balanced tree with O(log n) updates. More...
Classes | |
| struct | Node |
Public Member Functions | |
| StatusTree (const Array< Segment > &segs) | |
| ~StatusTree () | |
| bool | contains (const size_t seg) const |
| void | insert (const size_t seg, const Geom_Number &sx) |
| void | erase (const size_t seg) |
| size_t | predecessor (const size_t seg) const |
| size_t | successor (const size_t seg) const |
Private Member Functions | |
| size_t | predecessor_for_insert (const size_t seg, const Geom_Number &sx) const |
| size_t | successor_for_insert (const size_t seg, const Geom_Number &sx) const |
| Geom_Number | fresh_label_between (const size_t pred, const size_t succ) const |
Static Private Member Functions | |
| static Node * | merge (Node *a, Node *b) |
| static Node * | insert_by_label (Node *root, Node *node) |
| static void | split_by_label (Node *root, const Geom_Number &label, Node *&left, Node *&right) |
| static Node * | erase_by_label (Node *root, const Geom_Number &label, Node *&removed) |
| static void | destroy (const Node *n) |
Private Attributes | |
| Node * | root_ = nullptr |
| const Array< Segment > & | segs_ |
| std::mt19937 | rng_ {0x5f3759dfu} |
| Array< Node * > | nodes_ |
Sweep-line status as a balanced tree with O(log n) updates.
Maintains an order label per active segment. Labels are updated only when segments are inserted/removed or reinserted at intersection events. This avoids global re-sorting while supporting predecessor/successor queries in logarithmic time.
Definition at line 6032 of file geom_algorithms.H.
|
inlineexplicit |
Definition at line 6182 of file geom_algorithms.H.
References Aleph::Array< T >::append(), Aleph::divide_and_conquer_partition_dp(), nodes_, and Aleph::Array< T >::reserve().
|
inline |
Definition at line 6189 of file geom_algorithms.H.
Definition at line 6194 of file geom_algorithms.H.
References nodes_.
Referenced by erase(), insert(), Aleph::SweepLineSegmentIntersection::operator()(), predecessor(), and successor().
|
inlinestaticprivate |
Definition at line 6128 of file geom_algorithms.H.
References destroy(), Aleph::SweepLineSegmentIntersection::StatusTree::Node::left, and Aleph::SweepLineSegmentIntersection::StatusTree::Node::right.
Referenced by ~StatusTree(), and destroy().
Definition at line 6215 of file geom_algorithms.H.
References contains(), Aleph::divide_and_conquer_partition_dp(), erase_by_label(), nodes_, and root_.
Referenced by Aleph::SweepLineSegmentIntersection::operator()().
|
inlinestaticprivate |
Definition at line 6105 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), erase_by_label(), Aleph::SweepLineSegmentIntersection::StatusTree::Node::left, merge(), and root().
Referenced by erase(), and erase_by_label().
|
inlineprivate |
Definition at line 6170 of file geom_algorithms.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), nodes_, and pred.
Referenced by insert().
|
inline |
Definition at line 6199 of file geom_algorithms.H.
References contains(), fresh_label_between(), insert_by_label(), nodes_, pred, predecessor_for_insert(), rng_, root_, and successor_for_insert().
Referenced by Aleph::SweepLineSegmentIntersection::operator()().
|
inlinestaticprivate |
Definition at line 6061 of file geom_algorithms.H.
References insert_by_label(), Aleph::SweepLineSegmentIntersection::StatusTree::Node::label, Aleph::SweepLineSegmentIntersection::StatusTree::Node::left, Aleph::SweepLineSegmentIntersection::StatusTree::Node::priority, Aleph::SweepLineSegmentIntersection::StatusTree::Node::right, root(), and split_by_label().
Referenced by insert(), and insert_by_label().
|
inlinestaticprivate |
Definition at line 6048 of file geom_algorithms.H.
References Aleph::SweepLineSegmentIntersection::StatusTree::Node::left, merge(), Aleph::SweepLineSegmentIntersection::StatusTree::Node::priority, and Aleph::SweepLineSegmentIntersection::StatusTree::Node::right.
Referenced by erase_by_label(), and merge().
|
inline |
Definition at line 6226 of file geom_algorithms.H.
References contains(), Aleph::divide_and_conquer_partition_dp(), nodes_, pred, and root_.
Referenced by Aleph::SweepLineSegmentIntersection::operator()().
|
inlineprivate |
Definition at line 6137 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), pred, root_, segs_, and Aleph::SweepLineSegmentIntersection::status_less().
Referenced by insert().
|
inlinestaticprivate |
Definition at line 6083 of file geom_algorithms.H.
References Aleph::SweepLineSegmentIntersection::StatusTree::Node::left, root(), and split_by_label().
Referenced by insert_by_label(), and split_by_label().
|
inline |
Definition at line 6246 of file geom_algorithms.H.
References contains(), Aleph::divide_and_conquer_partition_dp(), Aleph::SweepLineSegmentIntersection::StatusTree::Node::left, nodes_, Aleph::SweepLineSegmentIntersection::StatusTree::Node::right, root_, and Aleph::SweepLineSegmentIntersection::StatusTree::Node::seg.
Referenced by Aleph::SweepLineSegmentIntersection::operator()().
|
inlineprivate |
Definition at line 6153 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), root_, Aleph::SweepLineSegmentIntersection::StatusTree::Node::seg, segs_, and Aleph::SweepLineSegmentIntersection::status_less().
Referenced by insert().
Definition at line 6046 of file geom_algorithms.H.
Referenced by StatusTree(), contains(), erase(), fresh_label_between(), insert(), predecessor(), and successor().
|
private |
Definition at line 6045 of file geom_algorithms.H.
Referenced by insert().
Definition at line 6043 of file geom_algorithms.H.
Referenced by ~StatusTree(), erase(), insert(), predecessor(), predecessor_for_insert(), successor(), and successor_for_insert().
Definition at line 6044 of file geom_algorithms.H.
Referenced by predecessor_for_insert(), and successor_for_insert().