summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-05-29 09:10:48 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-05-29 09:10:48 +0000
commitf7e1b8683290c347a00e80c0b3779e05892842e1 (patch)
treefbf927864ae5c80d6bbf9bd14c658bc8d9be5c8b /src
parente9f7f66fef8d66865eae4cf731bf502c19dc948e (diff)
downloadzetacomponents-graph-f7e1b8683290c347a00e80c0b3779e05892842e1.zip
zetacomponents-graph-f7e1b8683290c347a00e80c0b3779e05892842e1.tar.gz
- Fixed issue #10861 Circle sector size reducement failes for very big angles.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/driver.php31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/interfaces/driver.php b/src/interfaces/driver.php
index b9a55dd..69aa161 100644
--- a/src/interfaces/driver.php
+++ b/src/interfaces/driver.php
@@ -264,6 +264,7 @@ abstract class ezcGraphDriver
);
// We always need radian values..
+ $degAngle = abs( $endAngle - $startAngle );
$startAngle = deg2rad( $startAngle );
$endAngle = deg2rad( $endAngle );
@@ -300,8 +301,17 @@ abstract class ezcGraphDriver
( $newCenter->y < ( $center->y - $height ) ) ||
( $newCenter->y > ( $center->y + $height ) ) )
{
- // Quick bounding box check
- throw new ezcGraphReducementFailedException();
+ // Quick outer boundings check
+ if ( $degAngle > 180 )
+ {
+ // Use old center for very big angles
+ $newCenter = clone $center;
+ }
+ else
+ {
+ // Do not draw for very small angles
+ throw new ezcGraphReducementFailedException();
+ }
}
else
{
@@ -317,14 +327,23 @@ abstract class ezcGraphDriver
$angle = $direction->angle( new ezcGraphVector( 0, 1 ) );
$outerPoint = new ezcGraphVector(
- sin( $angle ) * $width,
- cos( $angle ) * $height
+ sin( $angle ) * $width / 2,
+ cos( $angle ) * $height / 2
);
// Point is not in ellipse any more
- if ( $distance->x > $outerPoint->x )
+ if ( abs( $distance->x ) > abs( $outerPoint->x ) )
{
- throw new ezcGraphReducementFailedException();
+ if ( $degAngle > 180 )
+ {
+ // Use old center for very big angles
+ $newCenter = clone $center;
+ }
+ else
+ {
+ // Do not draw for very small angles
+ throw new ezcGraphReducementFailedException();
+ }
}
}
OpenPOWER on IntegriCloud