diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-01-13 17:00:30 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-01-13 17:00:30 +0000 |
commit | 5f5a8de77e06443c59bcf50d15e47b5fe67615ea (patch) | |
tree | 2611c281183de0c9e5018cb3650902c6c15129f5 /basegfx | |
parent | 3575de67581725882a0ebd25daa3efec4c1a78de (diff) |
INTEGRATION: CWS presperf01 (1.15.2); FILE MERGED
2004/12/17 22:37:35 thb 1.15.2.1: #i36093# Added createPolygonFromEllipse(), mapped createPolygonFromCircle to that. Added some more files in source/tools
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dpolygontools.cxx | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 24fdabab58bc..8f9b5eb99dfd 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygontools.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: rt $ $Date: 2004-12-13 08:48:11 $ + * last change: $Author: kz $ $Date: 2005-01-13 18:00:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1432,30 +1432,36 @@ namespace basegfx B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double nRadius ) { + return createPolygonFromEllipse( rCenter, nRadius, nRadius ); + } + + B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double nRadiusX, double nRadiusY ) + { B2DPolygon aRet; const double aX( rCenter.getX() ); const double aY( rCenter.getY() ); const double nKappa( (M_SQRT2-1.0)*4.0/3.0 ); - const double l( nRadius * nKappa ); + const double nlX( nRadiusX * nKappa ); + const double nlY( nRadiusY * nKappa ); - aRet.append( B2DPoint( aX, aY-nRadius ) ); - aRet.append( B2DPoint( aX+nRadius, aY ) ); - aRet.append( B2DPoint( aX, aY+nRadius ) ); - aRet.append( B2DPoint( aX-nRadius, aY ) ); + aRet.append( B2DPoint( aX, aY-nRadiusY ) ); + aRet.append( B2DPoint( aX+nRadiusX, aY ) ); + aRet.append( B2DPoint( aX, aY+nRadiusY ) ); + aRet.append( B2DPoint( aX-nRadiusX, aY ) ); - aRet.setControlPointA( 0, B2DPoint( aX+l, aY-nRadius ) ); - aRet.setControlPointB( 0, B2DPoint( aX+nRadius, aY-l ) ); + aRet.setControlPointA( 0, B2DPoint( aX+nlX, aY-nRadiusY ) ); + aRet.setControlPointB( 0, B2DPoint( aX+nRadiusX, aY-nlY ) ); - aRet.setControlPointA( 1, B2DPoint( aX+nRadius, aY+l ) ); - aRet.setControlPointB( 1, B2DPoint( aX+l, aY+nRadius ) ); + aRet.setControlPointA( 1, B2DPoint( aX+nRadiusX, aY+nlY ) ); + aRet.setControlPointB( 1, B2DPoint( aX+nlX, aY+nRadiusY ) ); - aRet.setControlPointA( 2, B2DPoint( aX-l, aY+nRadius ) ); - aRet.setControlPointB( 2, B2DPoint( aX-nRadius, aY+l ) ); + aRet.setControlPointA( 2, B2DPoint( aX-nlX, aY+nRadiusY ) ); + aRet.setControlPointB( 2, B2DPoint( aX-nRadiusX, aY+nlY ) ); - aRet.setControlPointA( 3, B2DPoint( aX-nRadius, aY-l ) ); - aRet.setControlPointB( 3, B2DPoint( aX-l, aY-nRadius ) ); + aRet.setControlPointA( 3, B2DPoint( aX-nRadiusX, aY-nlY ) ); + aRet.setControlPointB( 3, B2DPoint( aX-nlX, aY-nRadiusY ) ); aRet.setClosed( true ); |