summaryrefslogtreecommitdiffstats
path: root/src/renderer
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-04-26 10:34:37 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-04-26 10:34:37 +0000
commit2165dfa54ac706984b47e2358fef91c220e1481f (patch)
treee373c352dd1994a29bee81bbff8637fa87f86eb4 /src/renderer
parent02bed03a4e8d2acee8c5d5a2de09602164213e98 (diff)
downloadzetacomponents-graph-2165dfa54ac706984b47e2358fef91c220e1481f.zip
zetacomponents-graph-2165dfa54ac706984b47e2358fef91c220e1481f.tar.gz
- Fixed order of points in arrow head polygons
# No visual difference in compariosion files - Fixes arrow heads in rotated axis in radar charts
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/2d.php17
-rw-r--r--src/renderer/3d.php6
2 files changed, 11 insertions, 12 deletions
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index 985b8bf..7663ddb 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -1179,13 +1179,11 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
$end->y += $boundings->y0;
// Determine normalized direction
- $direction = new ezcGraphCoordinate(
+ $direction = new ezcGraphVector(
$start->x - $end->x,
$start->y - $end->y
);
- $length = sqrt( pow( $direction->x, 2) + pow( $direction->y, 2 ) );
- $direction->x /= $length;
- $direction->y /= $length;
+ $direction->unify();
// Draw axis
$this->driver->drawLine(
@@ -1204,6 +1202,9 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
)
);
+ $orthogonalDirection = clone $direction;
+ $orthogonalDirection->rotateClockwise();
+
$this->driver->drawPolygon(
array(
new ezcGraphCoordinate(
@@ -1212,18 +1213,18 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
),
new ezcGraphCoordinate(
$end->x
- + $direction->y * $size / 2
+ - $orthogonalDirection->x * $size / 2
+ $direction->x * $size,
$end->y
- + $direction->x * $size / 2
+ - $orthogonalDirection->y * $size / 2
+ $direction->y * $size
),
new ezcGraphCoordinate(
$end->x
- - $direction->y * $size / 2
+ + $orthogonalDirection->x * $size / 2
+ $direction->x * $size,
$end->y
- - $direction->x * $size / 2
+ + $orthogonalDirection->y * $size / 2
+ $direction->y * $size
),
),
diff --git a/src/renderer/3d.php b/src/renderer/3d.php
index d11dc9e..4bb9c7c 100644
--- a/src/renderer/3d.php
+++ b/src/renderer/3d.php
@@ -1862,13 +1862,11 @@ class ezcGraphRenderer3d extends ezcGraphRenderer
}
// Determine normalized direction
- $direction = new ezcGraphCoordinate(
+ $direction = new ezcGraphVector(
$start->x - $end->x,
$start->y - $end->y
);
- $length = sqrt( pow( $direction->x, 2) + pow( $direction->y, 2 ) );
- $direction->x /= $length;
- $direction->y /= $length;
+ $direction->unify();
$start->x += $boundings->x0;
$start->y += $boundings->y0;
OpenPOWER on IntegriCloud