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:
parent
494d13bba3
commit
254a02f89d
|
@ -30,6 +30,8 @@ public class PythagorasTree {
|
||||||
public static boolean drawNextTree(PythagorasTreeQueue queue) {
|
public static boolean drawNextTree(PythagorasTreeQueue queue) {
|
||||||
PythagorasTree tree = queue.remove();
|
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.turtle.setPenColor(drawColor(tree.momentaryDepth, tree.maximalDepth));
|
||||||
tree.turtleState.returnToState(tree.turtle);
|
tree.turtleState.returnToState(tree.turtle);
|
||||||
DrawingTools.drawSquare(tree.turtle, tree.size);
|
DrawingTools.drawSquare(tree.turtle, tree.size);
|
||||||
|
@ -45,7 +47,12 @@ public class PythagorasTree {
|
||||||
|
|
||||||
tree.turtle.popState();
|
tree.turtle.popState();
|
||||||
tree.turtle.left(tree.triangles.getRightAngle(tree.momentaryDepth));
|
tree.turtle.left(tree.triangles.getRightAngle(tree.momentaryDepth));
|
||||||
|
|
||||||
|
tree.turtle.penUp();
|
||||||
tree.turtle.forward(tree.size * tree.triangles.getRightSizeFactor(tree.momentaryDepth));
|
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);
|
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);
|
queue.add(tree.leftSubTree);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue