26 double deltaxLx = arc->
xPos() - beachPos;
28 if (
std::abs(deltaxLx) > std::numeric_limits<double>::epsilon())
30 double deltayPy = yPos - arc->
yPos();
31 double sumPxLx = arc->
xPos() + beachPos;
33 arcVal = 0.5 * (deltayPy * deltayPy / deltaxLx + sumPxLx);
43 double lx = beachLinePos;
44 double deltaX1 = leftArc->
xPos() - lx;
45 double deltaX2 = rightArc->
xPos() - lx;
49 if (
std::abs(deltaX1 - deltaX2) < std::numeric_limits<double>::epsilon()) breakPoint = 0.5 * (rightArc->
yPos() + leftArc->
yPos());
55 double p1x = leftArc->
xPos();
56 double p1y = leftArc->
yPos();
57 double p2x = rightArc->
xPos();
58 double p2y = rightArc->
yPos();
60 double b = 2. * (p2y * deltaX1 - p1y * deltaX2);
61 double c = deltaX2 * (p1y * p1y + deltaX1 * (p1x + lx)) - deltaX1 * (p2y * p2y + deltaX2 * (p2x + lx));
62 double radical =
std::max(0.,b * b - 4. * a * c);
64 if (radical > 0.) radical = sqrt(radical);
66 double rootPos = 0.5 * (-b + radical) / a;
67 double rootNeg = 0.5 * (-b - radical) / a;
69 roots.first =
std::min(rootPos, rootNeg);
70 roots.second =
std::max(rootPos, rootNeg);
76 if (p1x < p2x) breakPoint = roots.second;
77 else breakPoint = roots.first;
90 double breakPoint =
computeBreak(newSite->
xPos()-0.000001, leftArc, rightArc, roots);
92 return newSite->
yPos() < breakPoint;
Provides some basic functions operating in IEvent class objects.
bool newSiteToLeft(const IEvent *, const IEvent *, const IEvent *) const
double computeArcVal(const double, const double, const IEvent *) const
virtual double yPos() const =0
static int max(int a, int b)
virtual double xPos() const =0
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
double computeBreak(const double, const IEvent *, const IEvent *, RootsPair &) const
std::pair< double, double > RootsPair