Go nuts with Qt
[ipdf/code.git] / src / bezier.h
index 449d7bd..f3df458 100644 (file)
@@ -11,8 +11,8 @@ namespace IPDF
        
        inline std::pair<Real,Real> SolveQuadratic(const Real & a, const Real & b, const Real & c)
        {
-               Real x0((b + Sqrt(b*b - Real(4)*a*c))/(Real(2)*a));
-               Real x1((b - Sqrt(b*b - Real(4)*a*c))/(Real(2)*a));
+               Real x0((-b + Sqrt(b*b - Real(4)*a*c))/(Real(2)*a));
+               Real x1((-b - Sqrt(b*b - Real(4)*a*c))/(Real(2)*a));
                return std::pair<Real,Real>(x0,x1);
        }
 
@@ -64,11 +64,16 @@ namespace IPDF
 
                Rect SolveBounds() const;
                
+               Bezier ToAbsolute(const Rect & bounds) const
+               {
+                       return Bezier(*this, bounds);
+               }
+               
                /** Convert absolute control points to control points relative to bounds
                 * (This basically does the opposite of the Copy constructor)
                 * ie: If this is absolute, the returned Bezier will be relative to the bounds rectangle
                 */
-               Bezier CopyInverse(const Rect & bounds) const
+               Bezier ToRelative(const Rect & bounds) const
                {
                        // x' <- (x - x0)/w etc
                        // special cases when w or h = 0

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