summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@cs.ox.ac.uk>2012-05-24 12:39:49 +0100
committerAlex Merry <alex.merry@cs.ox.ac.uk>2012-05-24 12:39:49 +0100
commite363a25246d76f8e1b1c6f14c0700dedb96c82e9 (patch)
treec60a752eb59769efb724aafeae3d69e13be9371b
parent7edfc757be29bd29111b898dfc87fb1b258920a3 (diff)
Do not adjust the height of RegularPolyShape
It might look more natural like that, but it's not how TikZ does it.
-rw-r--r--tikzit/src/common/RegularPolyShape.m10
1 files changed, 1 insertions, 9 deletions
diff --git a/tikzit/src/common/RegularPolyShape.m b/tikzit/src/common/RegularPolyShape.m
index b500377..b9acdf3 100644
--- a/tikzit/src/common/RegularPolyShape.m
+++ b/tikzit/src/common/RegularPolyShape.m
@@ -42,24 +42,16 @@
float dtheta = (M_PI * 2.0f) / ((float)sides);
float theta = (dtheta/2.0f) - (M_PI / 2.0f);
theta += degreesToRadians(rotation);
- float maxY=0.0f, minY=0.0f;
- NSPoint p;
for (int i = 0; i < sides; ++i) {
+ NSPoint p;
p.x = radius * cos(theta);
p.y = radius * sin(theta);
- if (p.y<minY) minY = p.y;
- if (p.y>maxY) maxY = p.y;
[nodes addObject:[Node nodeWithPoint:p]];
theta += dtheta;
}
- float dy = (minY + maxY) / 2.0f;
-
for (int i = 0; i < sides; ++i) {
- p = [[nodes objectAtIndex:i] point];
- p.y -= dy;
- [[nodes objectAtIndex:i] setPoint:p];
[edges addObject:[Edge edgeWithSource:[nodes objectAtIndex:i]
andTarget:[nodes objectAtIndex:(i+1)%sides]]];
}