Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::SweepLineSegmentIntersection::StatusTree Class Reference

Sweep-line status as a balanced tree with O(log n) updates. More...

Collaboration diagram for Aleph::SweepLineSegmentIntersection::StatusTree:
[legend]

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 Nodemerge (Node *a, Node *b)
 
static Nodeinsert_by_label (Node *root, Node *node)
 
static void split_by_label (Node *root, const Geom_Number &label, Node *&left, Node *&right)
 
static Nodeerase_by_label (Node *root, const Geom_Number &label, Node *&removed)
 
static void destroy (const Node *n)
 

Private Attributes

Noderoot_ = nullptr
 
const Array< Segment > & segs_
 
std::mt19937 rng_ {0x5f3759dfu}
 
Array< Node * > nodes_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ StatusTree()

Aleph::SweepLineSegmentIntersection::StatusTree::StatusTree ( const Array< Segment > &  segs)
inlineexplicit

◆ ~StatusTree()

Aleph::SweepLineSegmentIntersection::StatusTree::~StatusTree ( )
inline

Definition at line 6189 of file geom_algorithms.H.

References destroy(), and root_.

Member Function Documentation

◆ contains()

bool Aleph::SweepLineSegmentIntersection::StatusTree::contains ( const size_t  seg) const
inline

◆ destroy()

static void Aleph::SweepLineSegmentIntersection::StatusTree::destroy ( const Node n)
inlinestaticprivate

◆ erase()

void Aleph::SweepLineSegmentIntersection::StatusTree::erase ( const size_t  seg)
inline

◆ erase_by_label()

static Node * Aleph::SweepLineSegmentIntersection::StatusTree::erase_by_label ( Node root,
const Geom_Number label,
Node *&  removed 
)
inlinestaticprivate

◆ fresh_label_between()

Geom_Number Aleph::SweepLineSegmentIntersection::StatusTree::fresh_label_between ( const size_t  pred,
const size_t  succ 
) const
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().

◆ insert()

void Aleph::SweepLineSegmentIntersection::StatusTree::insert ( const size_t  seg,
const Geom_Number sx 
)
inline

◆ insert_by_label()

◆ merge()

static Node * Aleph::SweepLineSegmentIntersection::StatusTree::merge ( Node a,
Node b 
)
inlinestaticprivate

◆ predecessor()

size_t Aleph::SweepLineSegmentIntersection::StatusTree::predecessor ( const size_t  seg) const
inline

◆ predecessor_for_insert()

size_t Aleph::SweepLineSegmentIntersection::StatusTree::predecessor_for_insert ( const size_t  seg,
const Geom_Number sx 
) const
inlineprivate

◆ split_by_label()

static void Aleph::SweepLineSegmentIntersection::StatusTree::split_by_label ( Node root,
const Geom_Number label,
Node *&  left,
Node *&  right 
)
inlinestaticprivate

◆ successor()

◆ successor_for_insert()

size_t Aleph::SweepLineSegmentIntersection::StatusTree::successor_for_insert ( const size_t  seg,
const Geom_Number sx 
) const
inlineprivate

Member Data Documentation

◆ nodes_

Array<Node *> Aleph::SweepLineSegmentIntersection::StatusTree::nodes_
private

◆ rng_

std::mt19937 Aleph::SweepLineSegmentIntersection::StatusTree::rng_ {0x5f3759dfu}
private

Definition at line 6045 of file geom_algorithms.H.

Referenced by insert().

◆ root_

Node* Aleph::SweepLineSegmentIntersection::StatusTree::root_ = nullptr
private

◆ segs_

const Array<Segment>& Aleph::SweepLineSegmentIntersection::StatusTree::segs_
private

Definition at line 6044 of file geom_algorithms.H.

Referenced by predecessor_for_insert(), and successor_for_insert().


The documentation for this class was generated from the following file: