375 while(node->getLeftChild()) node = node->
getLeftChild();
383 BSTNode* lastBreakPoint(NULL);
389 while(node->getSuccessor())
392 if (node->getLeftChild() && node->getRightChild())
395 double breakPoint =
m_utilities.
computeBreak(beachLine, node->getPredecessor()->getEvent(), node->getSuccessor()->getEvent(), roots);
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;
400 std::cout <<
" Current left arc x,y: " << node->getPredecessor()->getEvent()->xPos() <<
", " << node->getPredecessor()->getEvent()->yPos() <<
", right arc x,y: " << node->getSuccessor()->getEvent()->xPos() <<
", " << node->getSuccessor()->getEvent()->yPos() <<
", beachLine: " << beachLine;
401 if (node->getPredecessor()->getAssociated()) std::cout <<
", left: " << node->getPredecessor()->getAssociated()->getEvent()->isValid();
402 if (node->getSuccessor()->getAssociated()) std::cout <<
", right: " << node->getSuccessor()->getAssociated()->getEvent()->isValid();
406 std::cout <<
" Previous left arc x,y: " << lastBreakPoint->getPredecessor()->getEvent()->xPos() <<
", " << lastBreakPoint->getPredecessor()->getEvent()->yPos() <<
", right arc x,y: " << lastBreakPoint->getSuccessor()->getEvent()->xPos() <<
", " << lastBreakPoint->getSuccessor()->getEvent()->yPos();
407 if (lastBreakPoint->getPredecessor()->getAssociated()) std::cout <<
", left: " << lastBreakPoint->getPredecessor()->getAssociated()->getEvent()->isValid();
408 if (lastBreakPoint->getSuccessor()->getAssociated()) std::cout <<
", right: " << lastBreakPoint->getSuccessor()->getAssociated()->getEvent()->isValid();
414 lastBreakPointY = breakPoint;
415 lastBreakPoint = node;
421 if (node->getSuccessor())
423 BSTNode*
temp = node;
424 while(temp->getParent() && temp != temp->getParent()->getLeftChild()) temp = temp->getParent();
425 if (temp->getParent()) temp = temp->getParent()->getRightChild();
426 while(temp->getLeftChild()) temp = temp->getLeftChild();
428 if (node->getSuccessor()->getSuccessor() != temp || node != temp->getPredecessor()->getPredecessor())
430 std::cout <<
" --> Successor tree/beach mismatch, leaf # " << nLeaves <<
", node: " << node <<
", " << node->getEvent()->xPos() <<
"/" << node->getEvent()->yPos() <<
", s: " << node->getSuccessor() <<
", ss: " << node->getSuccessor()->getSuccessor() <<
std::endl;
431 std::cout <<
" temp: " << temp <<
", " << temp->getEvent()->xPos() <<
"/" << temp->getEvent()->yPos() <<
", p: " << temp->getPredecessor() <<
", pp: " << temp->getPredecessor()->getPredecessor() <<
std::endl;
435 if (node->getPredecessor())
437 BSTNode* temp = node;
438 while(temp->getParent() && temp != temp->getParent()->getRightChild()) temp = temp->getParent();
439 if (temp->getParent()) temp = temp->getParent()->getLeftChild();
440 while(temp->getRightChild()) temp = temp->getRightChild();
442 if (node->getPredecessor()->getPredecessor() != temp || node != temp->getSuccessor()->getSuccessor())
444 std::cout <<
" --> Predecessor tree/beach mismatch, leaf # " << nLeaves <<
", node: " << node <<
", " << node->getEvent()->xPos() <<
"/" << node->getEvent()->yPos() <<
", p: " << node->getPredecessor() <<
", pp: " << node->getPredecessor()->getPredecessor() <<
std::endl;
445 std::cout <<
" temp: " << temp <<
", " << temp->getEvent()->xPos() <<
"/" << temp->getEvent()->yPos() <<
", s: " << temp->getSuccessor() <<
", ss: " << temp->getSuccessor()->getSuccessor() <<
std::endl;
454 node = node->getSuccessor();
457 if (nBadCompares > 0) std::cout <<
"=======>> Beach line check resulted in " << nBadCompares <<
" bad compares of " << nBreakPoints <<
" break points checked, with " << nLeaves <<
" leaves" <<
std::endl;
EventUtilities m_utilities
static int max(int a, int b)
double computeBreak(const double, const IEvent *, const IEvent *, RootsPair &) const
std::pair< double, double > RootsPair
BSTNode * getLeftChild() const
QTextStream & endl(QTextStream &s)