From d8d0b875f620511534afcc555f07c6e7a26785b1 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Thu, 25 Jan 2007 10:03:02 +0000 Subject: INTEGRATION: CWS aw040 (1.12.16); FILE MERGED 2007/01/15 16:03:33 aw 1.12.16.1: #i72104# angle computation needst to use the last non-zero vector when one control vector is zero --- basegfx/source/curve/b2dcubicbezier.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'basegfx/source/curve') diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 81b91f0f5e8a..dff487b521e0 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -4,9 +4,9 @@ * * $RCSfile: b2dcubicbezier.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: obo $ $Date: 2006-09-17 07:58:29 $ + * last change: $Author: obo $ $Date: 2007-01-25 11:03:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -78,8 +78,20 @@ namespace basegfx if(nMaxRecursionDepth) { // do angle test - const B2DVector aLeft(rfEA - rfPA); - const B2DVector aRight(rfEB - rfPB); + B2DVector aLeft(rfEA - rfPA); + B2DVector aRight(rfEB - rfPB); + + // #i72104# + if(aLeft.equalZero()) + { + aLeft = rfEB - rfPA; + } + + if(aRight.equalZero()) + { + aRight = rfEA - rfPB; + } + const double fCurrentAngle(aLeft.angle(aRight)); if(fabs(fCurrentAngle) > (F_PI - fAngleBound)) @@ -155,7 +167,7 @@ namespace basegfx else { const B2DVector aBase(rfPB - rfPA); - const bool bBaseEqualZero(aLeft.equalZero()); + const bool bBaseEqualZero(aBase.equalZero()); // #i72104# if(!bBaseEqualZero) { @@ -226,7 +238,7 @@ namespace basegfx bool bAngleIsSmallerLeft(bAllParallel && bLeftEqualZero); if(!bAngleIsSmallerLeft) { - const B2DVector aLeftLeft(aS1L - rfPA); + const B2DVector aLeftLeft(bLeftEqualZero ? aS2L - aS1L : aS1L - rfPA); // #i72104# const B2DVector aRightLeft(aS2L - aS3C); const double fCurrentAngleLeft(aLeftLeft.angle(aRightLeft)); bAngleIsSmallerLeft = (fabs(fCurrentAngleLeft) > (F_PI - rfAngleBound)); @@ -237,7 +249,7 @@ namespace basegfx if(!bAngleIsSmallerRight) { const B2DVector aLeftRight(aS2R - aS3C); - const B2DVector aRightRight(aS1R - rfPB); + const B2DVector aRightRight(bRightEqualZero ? aS2R - aS1R : aS1R - rfPB); // #i72104# const double fCurrentAngleRight(aLeftRight.angle(aRightRight)); bAngleIsSmallerRight = (fabs(fCurrentAngleRight) > (F_PI - rfAngleBound)); } -- cgit v1.2.3