extern std::vector<Real> SolveQuadratic(const Real & a, const Real & b, const Real & c, const Real & min = 0, const Real & max = 1);
- extern std::vector<Real> SolveCubic(const Real & a, const Real & b, const Real & c, const Real & d, const Real & min = 0, const Real & max = 1, const Real & delta = 1e-9);
+ extern std::vector<Real> SolveCubic(const Real & a, const Real & b, const Real & c, const Real & d, const Real & min = 0, const Real & max = 1, const Real & delta = 1e-4);
/** A _cubic_ bezier. **/
struct Bezier
{
Real t1 = *it;
if (t1 == t0) continue;
- Debug(" -- t0: %f to t1: %f", Double(t0), Double(t1));
+ Debug(" -- t0: %f to t1: %f: %f", Double(t0), Double(t1), (t1 + t0)/Real(2));
Real ptx, pty;
Evaluate(ptx, pty, ((t1 + t0) / Real(2)));
if (r.PointIn(ptx, pty))
{
+ Debug("Adding segment: (point at %f, %f)", Double(ptx), Double(pty));
all_beziers.push_back(this->ReParametrise(t0, t1));
}
else
}
inline bool PointIn(Real pt_x, Real pt_y) const
{
- if (pt_x < x) return false;
- if (pt_y < y) return false;
- if (pt_x > x + w) return false;
- if (pt_y > y + h) return false;
+ if (pt_x <= x) return false;
+ if (pt_y <= y) return false;
+ if (pt_x >= x + w) return false;
+ if (pt_y >= y + h) return false;
return true;
}
};
#ifndef QUADTREE_DISABLED
if (m_bounds_dirty)
{
- if (false && (m_bounds.x > 1.0 || m_bounds.x < 0.0 || m_bounds.y > 1.0 || m_bounds.y < 0.0 || m_bounds.w > 1.0 || m_bounds.h > 1.0))
+ if ( (m_bounds.x > 1.0 || m_bounds.x < 0.0 || m_bounds.y > 1.0 || m_bounds.y < 0.0 || m_bounds.w > 1.0 || m_bounds.h > 1.0))
{
//TODO: Generate a new parent node.
if (m_document.GetQuadTree().nodes[m_current_quadtree_node].parent != QUADTREE_EMPTY)