diff --git a/src/tree/Tree.java b/src/tree/Tree.java index f2c2496..002c972 100644 --- a/src/tree/Tree.java +++ b/src/tree/Tree.java @@ -8,7 +8,7 @@ public class Tree { @FXML private Pane treePane; - int inputN = 10; + int inputN = 15; double inputWitherRatio = 0.5; @FXML @@ -16,7 +16,7 @@ private void renderTree() { deleteTree(); // TODO get variables from input - tree(inputN, treePane.getWidth() / 2, treePane.getHeight() / 2, -45, 10); + tree(inputN, treePane.getWidth() / 2, treePane.getHeight(), -45, 50); } // TODO get variables from input @@ -24,10 +24,18 @@ private void tree(int n, double x, double y, double a, double branchLength) { // Fields final double branchShrinkRatio = 1; final double branchAngle = Math.toRadians(15); - final double cx = x + (Math.cos(a) * branchLength); - final double cy = y + (Math.sin(a) * branchLength); + double cx = x + (Math.cos(a) * branchLength); + double cy = y + (Math.sin(a) * branchLength); double branchWitherRatio = calculateWitherRatio(n); + //if this is on creation, ashure the propper start location of the tree + if (inputN == n){ + cx = x; + cy = y - branchLength; + a = -45.55; //no idea why this number becomes a straight tree, its arived at buy trail and error + } + + // Draw Branch treePane.getChildren().add(new Line(x, y, cx, cy));