diff options
Diffstat (limited to 'basegfx/source/workbench/bezierclip.cxx')
-rw-r--r-- | basegfx/source/workbench/bezierclip.cxx | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx index c35eb2a6b3a8..d7162afaa1ac 100644 --- a/basegfx/source/workbench/bezierclip.cxx +++ b/basegfx/source/workbench/bezierclip.cxx @@ -27,8 +27,6 @@ #include "bezierclip.hxx" #include "gauss.hxx" - - // what to test #define WITH_ASSERTIONS //#define WITH_CONVEXHULL_TEST @@ -43,10 +41,6 @@ //#define WITH_SAFEFOCUSPARAM_DETAILED_TEST #define WITH_BEZIERCLIP_TEST - - - - /* Implementation of the so-called 'Fat-Line Bezier Clipping Algorithm' by Sederberg et al. * * Actual reference is: T. W. Sederberg and T Nishita: Curve @@ -54,8 +48,6 @@ * (9), 1990, pp. 538--549 */ - - /* Misc helper * =========== */ @@ -74,21 +66,15 @@ int fallFac( int n, int k ) return res; } - - int fac( int n ) { return fallFac(n, n); } - - /* Bezier fat line clipping part * ============================= */ - - void Impl_calcFatLine( FatLine& line, const Bezier& c ) { // Prepare normalized implicit line @@ -108,7 +94,6 @@ void Impl_calcFatLine( FatLine& line, const Bezier& c ) line.c = -(line.a*c.p0.x + line.b*c.p0.y); - // Determine bounding fat line from it // =================================== @@ -270,7 +255,6 @@ bool Impl_calcSafeParams( double& t1, return bIntersection; } - /* calculates two t's for the given bernstein polynomial: the first is * the intersection of the min value line with the convex hull from * the left, the second is the intersection of the max value line with @@ -340,8 +324,6 @@ bool Impl_calcSafeParams_clip( double& t1, #endif } - - void Impl_deCasteljauAt( Bezier& part1, Bezier& part2, const Bezier& input, @@ -389,8 +371,6 @@ void Impl_deCasteljauAt( Bezier& part1, } } - - void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, double t2_c1, const Bezier& c2_part, const FatLine& bounds_c2 ) { @@ -473,8 +453,6 @@ void printCurvesWithSafeRange( const Bezier& c1, const Bezier& c2, double t1_c1, offset += 1; } - - void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, const Bezier& c2, const Bezier& c2_part, double t1_c1, double t2_c1 ) @@ -548,8 +526,6 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, offset += 1; } - - /** determine parameter ranges [0,t1) and (t2,1] on c1, where c1 is guaranteed to lie outside c2. Returns false, if the two curves don't even intersect. @@ -628,14 +604,10 @@ bool Impl_calcClipRange( double& t1, return false; } - - /* Tangent intersection part * ========================= */ - - void Impl_calcFocus( Bezier& res, const Bezier& c ) { // arbitrary small value, for now @@ -693,7 +665,6 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // (P0.y - P1.y)c0 + (P3.y - P2.y)c1 = (P3.x - P0.x)/3 // (P1.x - P0.x)c0 + (P2.x - P3.x)c1 = (P3.y - P0.y)/3 - // so, this is what we calculate here (determine c0 and c1): fMatrix[0] = c.p1.x - c.p0.x; fMatrix[1] = c.p2.x - c.p3.x; @@ -761,8 +732,6 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) res.p3.y = c.p3.y + 3*fRes[1]*(c.p3.x - c.p2.x); } - - bool Impl_calcSafeParams_focus( double& t1, double& t2, const Bezier& curve, @@ -796,7 +765,6 @@ bool Impl_calcSafeParams_focus( double& t1, // d_i = \sum_{j+k=i, j\in\{0,...,n\}, k\in\{0,...,n-1\}} \frac{\binom{n}{j}\binom{n-1}{k}}{\binom{2n-1}{i}} n (P_{k+1} - P_k)^T(P_j - F) - // Okay, but F is now not a single point, but itself a curve // F(u). Thus, for every value of u, we get a different 2n-1 // bezier curve from the above equation. Therefore, we have a @@ -821,14 +789,12 @@ bool Impl_calcSafeParams_focus( double& t1, // \fallfac are so-called falling factorials (see Concrete // Mathematics, p. 47 for a definition). - // now, for tensor product bezier curves, the convex hull property // holds, too. Thus, we simply project the control points (t_{ij}, // u_{ij}, d_{ij}) onto the (t,d) plane and calculate the // intersections of the convex hull with the t axis, as for the // bezier clipping case. - // calc polygon of control points (t_{ij}, d_{ij}): const int n( 3 ); // cubic bezier curves, as a matter of fact @@ -900,8 +866,6 @@ bool Impl_calcSafeParams_focus( double& t1, #endif } - - /** Calc all values t_i on c1, for which safeRanges functor does not give a safe range on c1 and c2. @@ -1144,8 +1108,6 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera } } - - struct ClipBezierFunctor { bool operator()( double& t1_c1, @@ -1159,8 +1121,6 @@ struct ClipBezierFunctor } }; - - struct BezierTangencyFunctor { bool operator()( double& t1_c1, @@ -1187,8 +1147,6 @@ struct BezierTangencyFunctor } }; - - /** Perform a bezier clip (curve against curve) @param result @@ -1476,7 +1434,6 @@ int main(int argc, const char *argv[]) << c1_part3.p2.y << "," << c1_part3.p3.y << ",t) title \"left " << i << "\""; - if( i+1<sizeof(someCurves)/sizeof(Bezier) ) cout << ",\\" << endl; else @@ -1575,7 +1532,6 @@ int main(int argc, const char *argv[]) << focus.p2.y << "," << focus.p3.y << ",t) title \"focus " << i << "\""; - if( i+1<sizeof(someCurves)/sizeof(Bezier) ) cout << ",\\" << endl; else |