25 double arcVal = std::numeric_limits<double>::max();
26 double deltaxLx = arc->
xPos() - beachPos;
28 if (
std::abs(deltaxLx) > std::numeric_limits<double>::epsilon()) {
29 double deltayPy = yPos - arc->
yPos();
30 double sumPxLx = arc->
xPos() + beachPos;
32 arcVal = 0.5 * (deltayPy * deltayPy / deltaxLx + sumPxLx);
45 double lx = beachLinePos;
46 double deltaX1 = leftArc->
xPos() - lx;
47 double deltaX2 = rightArc->
xPos() - lx;
48 double breakPoint = -std::numeric_limits<double>::max();
51 if (
std::abs(deltaX1 - deltaX2) < std::numeric_limits<double>::epsilon())
52 breakPoint = 0.5 * (rightArc->
yPos() + leftArc->
yPos());
57 double p1x = leftArc->
xPos();
58 double p1y = leftArc->
yPos();
59 double p2x = rightArc->
xPos();
60 double p2y = rightArc->
yPos();
62 double b = 2. * (p2y * deltaX1 - p1y * deltaX2);
64 deltaX2 * (p1y * p1y + deltaX1 * (p1x + lx)) - deltaX1 * (p2y * p2y + deltaX2 * (p2x + lx));
65 double radical = std::max(0., b * b - 4. * a * c);
67 if (radical > 0.) radical = sqrt(radical);
69 double rootPos = 0.5 * (-b + radical) / a;
70 double rootNeg = 0.5 * (-b - radical) / a;
72 roots.first = std::min(rootPos, rootNeg);
73 roots.second = std::max(rootPos, rootNeg);
80 breakPoint = roots.second;
82 breakPoint = roots.first;
90 const IEvent* rightArc)
const 97 double breakPoint =
computeBreak(newSite->
xPos() - 0.000001, leftArc, rightArc, roots);
99 return newSite->
yPos() < breakPoint;
Provides some basic functions operating in IEvent class objects.
bool newSiteToLeft(const IEvent *, const IEvent *, const IEvent *) const
constexpr auto abs(T v)
Returns the absolute value of the argument.
double computeArcVal(const double, const double, const IEvent *) const
std::pair< double, double > RootsPair
virtual double yPos() const =0
virtual double xPos() const =0
double computeBreak(const double, const IEvent *, const IEvent *, RootsPair &) const