1
0
Fork 0

Bugfix and Additional Information

The window header now includes which level the tree has at the moment
and which is the target depth.

also fixed the bug causing one additional line at the end of each
square. this line wold be part of the next square, but when the tree is
finished, the final squares should not have little additional lines
coming out of them
This commit is contained in:
Jan Christian Grünhage 2015-02-11 21:16:59 +01:00
parent 494d13bba3
commit 254a02f89d
1 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,8 @@ public class PythagorasTree {
public static boolean drawNextTree(PythagorasTreeQueue queue) {
PythagorasTree tree = queue.remove();
tree.turtle.getFrame().setTitle("Pythagoras Tree - Depth: " + tree.momentaryDepth + " - Target Depth: " + tree.maximalDepth);
tree.turtle.setPenColor(drawColor(tree.momentaryDepth, tree.maximalDepth));
tree.turtleState.returnToState(tree.turtle);
DrawingTools.drawSquare(tree.turtle, tree.size);
@ -45,7 +47,12 @@ public class PythagorasTree {
tree.turtle.popState();
tree.turtle.left(tree.triangles.getRightAngle(tree.momentaryDepth));
tree.turtle.penUp();
tree.turtle.forward(tree.size * tree.triangles.getRightSizeFactor(tree.momentaryDepth));
tree.turtle.penDown();
tree.leftSubTree = new PythagorasTree(tree.variant, tree.triangles, tree.turtle, tree.size * tree.triangles.getLeftSizeFactor(tree.momentaryDepth), tree.momentaryDepth + 1, tree.maximalDepth);
queue.add(tree.leftSubTree);
return true;