58 BSTNode* node = findBestLeaf(event, m_root);
61 node = insertNewLeaf(event, node);
87 if (m_utilities.newSiteToLeft(event, leftLeaf->
getEvent(), rightLeaf->
getEvent()))
90 node = findBestLeaf(event, node->getRightChild());
106 m_nodeVec.push_back(
BSTNode(event));
107 node = &m_nodeVec.back();
125 m_nodeVec.push_back(
BSTNode(event));
127 BSTNode* newLeaf = &m_nodeVec.back();
129 m_nodeVec.push_back(
BSTNode(*node));
131 BSTNode* leftLeaf = &m_nodeVec.back();
133 m_nodeVec.push_back(
BSTNode(event));
135 BSTNode* breakNode = &m_nodeVec.back();
137 m_nodeVec.push_back(
BSTNode(event));
139 BSTNode* topNode = &m_nodeVec.back();
151 else m_root = topNode;
218 if (node == sibling) sibling = nodeParent->
getLeftChild();
285 rebalance(grandParent);
298 countNodes(m_root, nodeCount);
307 countLeaves(m_root, leafCount);
321 std::cout <<
"****** Tree has one branch but not the other! *******" <<
std::endl;
397 if (breakPoint + tolerance < lastBreakPointY)
399 std::cout <<
" #####>> Beach line check gets bad breakpoint, last: " << lastBreakPointY <<
", new: " << breakPoint <<
", roots: " << roots.first <<
"/" << roots.second <<
std::endl;
414 lastBreakPointY = breakPoint;
415 lastBreakPoint = node;
457 if (nBadCompares > 0) std::cout <<
"=======>> Beach line check resulted in " << nBadCompares <<
" bad compares of " << nBreakPoints <<
" break points checked, with " << nLeaves <<
" leaves" <<
std::endl;
531 if (depthLeft - depthRight > 2) node = rotateWithLeftChild(node);
532 else if (depthRight - depthLeft > 2) node = rotateWithRightChild(node);
556 else m_root = newTopNode;
588 else m_root = newTopNode;
void checkBeachLine(double) const
BSTNode * rotateWithLeftChild(BSTNode *)
void setRightChild(BSTNode *node)
void setSuccessor(BSTNode *node)
BSTNode class definiton specifically for use in constructing Voronoi diagrams. We are trying to follo...
void rebalance(BSTNode *)
Tree balancing functions.
BSTNode * getParent() const
int getTreeDepth(const BSTNode *) const
This recovers the depth of longest branch in the tree below input node.
Represents the beachline implemented as a self balancing binary search tree.
BSTNode * findBestLeaf(const IEvent *event) const
BSTNode * getAssociated() const
BSTNode * insertNewLeaf(IEvent *)
void setLeftChild(BSTNode *node)
virtual double yPos() const =0
void setParent(BSTNode *node)
Allow setting of the points.
BSTNode * getRightChild() const
virtual void setBSTNode(BSTNode *)=0
static int max(int a, int b)
int traverseBeachLeft(BSTNode *) const
BSTNode * removeLeaf(BSTNode *)
void setAssociated(BSTNode *node)
virtual bool isValid() const =0
int traverseBeachRight(BSTNode *) const
virtual double xPos() const =0
int getDepth() const
recover the data members
int traverseBeach() const
BSTNode * getPredecessor() const
BSTNode * rotateWithRightChild(BSTNode *)
std::pair< double, double > RootsPair
void setFace(dcel2d::Face *face)
void setPredecessor(BSTNode *node)
virtual void setInvalid() const =0
Interface for configuring the particular algorithm tool.
IEvent * getEvent() const
def parent(G, child, parent_type)
BSTNode * getSuccessor() const
BSTNode * getLeftChild() const
QTextStream & endl(QTextStream &s)
Event finding and building.
void setHalfEdge(dcel2d::HalfEdge *half)