Because merging is going to be fun.
authorDavid Gow <[email protected]>
Thu, 11 Sep 2014 12:08:27 +0000 (20:08 +0800)
committerDavid Gow <[email protected]>
Thu, 11 Sep 2014 12:08:27 +0000 (20:08 +0800)
src/bezier.h
src/rect.h
src/view.cpp

index 2b0c1e1..206cbc8 100644 (file)
@@ -15,7 +15,7 @@ namespace IPDF
        
        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> 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
 
        /** A _cubic_ bezier. **/
        struct Bezier
@@ -293,11 +293,12 @@ namespace IPDF
                        {
                                Real t1 = *it;
                                if (t1 == t0) continue;
                        {
                                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))
                                {
                                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
                                        all_beziers.push_back(this->ReParametrise(t0, t1));
                                }
                                else
index 46aa5fb..3c4a105 100644 (file)
@@ -20,10 +20,10 @@ namespace IPDF
                }
                inline bool PointIn(Real pt_x, Real pt_y) const
                {
                }
                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;
                }
        };
                        return true;
                }
        };
index 26e0591..554fb03 100644 (file)
@@ -173,7 +173,7 @@ void View::Render(int width, int height)
 #ifndef QUADTREE_DISABLED
        if (m_bounds_dirty)
        {
 #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)
                {
                        //TODO: Generate a new parent node.
                        if (m_document.GetQuadTree().nodes[m_current_quadtree_node].parent != QUADTREE_EMPTY)

UCC git Repository :: git.ucc.asn.au