diff options
Diffstat (limited to 'basegfx/source/curve')
-rw-r--r-- | basegfx/source/curve/b2dbeziertools.cxx | 35 | ||||
-rw-r--r-- | basegfx/source/curve/b2dcubicbezier.cxx | 8 | ||||
-rw-r--r-- | basegfx/source/curve/b2dquadraticbezier.cxx | 8 |
3 files changed, 27 insertions, 24 deletions
diff --git a/basegfx/source/curve/b2dbeziertools.cxx b/basegfx/source/curve/b2dbeziertools.cxx index 0e6e24a071da..3512b87ca992 100644 --- a/basegfx/source/curve/b2dbeziertools.cxx +++ b/basegfx/source/curve/b2dbeziertools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dbeziertools.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2003-11-12 12:09:52 $ + * last change: $Author: aw $ $Date: 2003-11-26 14:40:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,6 +62,10 @@ #include <limits> #include <algorithm> +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + #include <basegfx/curve/b2dbeziertools.hxx> #ifndef _BGFX_CURVE_B2DCUBICBEZIER_HXX @@ -148,7 +152,7 @@ namespace basegfx { public: AngleErrorFunctor( const double& angleBounds ) : - mfTanAngle( tan( angleBounds ) ), + mfTanAngle( angleBounds * F_PI180 ), mfLastTanAngle( ::std::numeric_limits<double>::max() ) { } @@ -213,14 +217,21 @@ namespace basegfx double fCurrAngle( ::std::numeric_limits<double>::max() ); - if( !numeric::fTools::equalZero( scalarVecADDB ) ) - fCurrAngle = fabs( crossVecADDB / scalarVecADDB ); - - if( !numeric::fTools::equalZero( scalarVecStartTangentAD ) ) - fCurrAngle = ::std::min( fCurrAngle, fabs( crossVecStartTangentAD / scalarVecStartTangentAD ) ); - - if( !numeric::fTools::equalZero( scalarVecDBEndTangent ) ) - fCurrAngle = ::std::min( fCurrAngle, fabs( crossVecDBEndTangent / scalarVecDBEndTangent ) ); + // anyone has zero denominator? then we're at + // +infinity, anyway + if( !numeric::fTools::equalZero( scalarVecADDB ) && + !numeric::fTools::equalZero( scalarVecStartTangentAD ) && + !numeric::fTools::equalZero( scalarVecDBEndTangent ) ) + { + if( scalarVecADDB > 0.0 && + scalarVecStartTangentAD > 0.0 && + scalarVecDBEndTangent > 0.0 ) + { + fCurrAngle = ::std::max( fabs( atan2( crossVecADDB, scalarVecADDB ) ), + ::std::max( fabs( atan2( crossVecStartTangentAD, scalarVecStartTangentAD ) ), + fabs( atan2( crossVecDBEndTangent, scalarVecDBEndTangent ) ) ) ); + } + } // stop if error measure does not improve anymore. This is a // safety guard against floating point inaccuracies. @@ -261,7 +272,7 @@ namespace basegfx prevent endless looping. */ template < class ErrorFunctor > int ImplAdaptiveSubdivide( polygon::B2DPolygon& rPoly, - const ErrorFunctor& rErrorFunctor, + ErrorFunctor rErrorFunctor, const double P1x, const double P1y, const double P2x, const double P2y, const double P3x, const double P3y, diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 19eadc8dab49..9633aa6b5130 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dcubicbezier.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-06 16:30:27 $ + * last change: $Author: aw $ $Date: 2003-11-26 14:40:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,10 +63,6 @@ #include <basegfx/curve/b2dcubicbezier.hxx> #endif -#ifndef _TOOLS_DEBUG_HXX -#include <tools/debug.hxx> -#endif - ////////////////////////////////////////////////////////////////////////////// namespace basegfx diff --git a/basegfx/source/curve/b2dquadraticbezier.cxx b/basegfx/source/curve/b2dquadraticbezier.cxx index 5db6c1d42775..607d10b4a7bc 100644 --- a/basegfx/source/curve/b2dquadraticbezier.cxx +++ b/basegfx/source/curve/b2dquadraticbezier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dquadraticbezier.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-06 16:30:27 $ + * last change: $Author: aw $ $Date: 2003-11-26 14:40:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,10 +63,6 @@ #include <basegfx/curve/b2dquadraticbezier.hxx> #endif -#ifndef _TOOLS_DEBUG_HXX -#include <tools/debug.hxx> -#endif - #ifndef _BGFX_NUMERIC_FTOOLS_HXX #include <basegfx/numeric/ftools.hxx> #endif |