30 double deltaxLx = arc->
xPos() - beachPos;
32 if (std::abs(deltaxLx) > std::numeric_limits<double>::epsilon())
34 double deltayPy = yPos - arc->
yPos();
35 double sumPxLx = arc->
xPos() + beachPos;
37 arcVal = 0.5 * (deltayPy * deltayPy / deltaxLx + sumPxLx);
47 double lx = beachLinePos;
48 double deltaX1 = leftArc->
xPos() - lx;
49 double deltaX2 = rightArc->
xPos() - lx;
53 if (std::abs(deltaX1 - deltaX2) < std::numeric_limits<double>::epsilon()) breakPoint = 0.5 * (rightArc->
yPos() + leftArc->
yPos());
59 double p1x = leftArc->
xPos();
60 double p1y = leftArc->
yPos();
61 double p2x = rightArc->
xPos();
62 double p2y = rightArc->
yPos();
64 double b = 2. * (p2y * deltaX1 - p1y * deltaX2);
65 double c = deltaX2 * (p1y * p1y + deltaX1 * (p1x + lx)) - deltaX1 * (p2y * p2y + deltaX2 * (p2x + lx));
66 double radical =
std::max(0.,b * b - 4. * a * c);
68 if (radical > 0.) radical = sqrt(radical);
70 double rootPos = 0.5 * (-b + radical) / a;
71 double rootNeg = 0.5 * (-b - radical) / a;
73 roots.first =
std::min(rootPos, rootNeg);
74 roots.second =
std::max(rootPos, rootNeg);
80 if (p1x < p2x) breakPoint = roots.second;
81 else breakPoint = roots.first;
94 double breakPoint =
computeBreak(newSite->
xPos()-0.000001, leftArc, rightArc, roots);
96 return newSite->
yPos() < breakPoint;
Provides some basic functions operating in IEvent class objects.
bool newSiteToLeft(const IEvent *, const IEvent *, const IEvent *) const
Represents the beachline implemented as a self balancing binary search tree.
double computeArcVal(const double, const double, const IEvent *) const
virtual double yPos() const =0
virtual double xPos() const =0
double computeBreak(const double, const IEvent *, const IEvent *, RootsPair &) const
std::pair< double, double > RootsPair