Implementation of "KilianEhrmanPythagorasTree"
The first Implementation of the "KilianEhrmanPythagorasTree". this tree is just a crap... look at the code for calculating the angles yourself. looks nice though
This commit is contained in:
parent
fb7739f968
commit
dfad27a51c
|
@ -122,6 +122,8 @@ public class Main {
|
|||
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeFour;
|
||||
} else if (input.equalsIgnoreCase("PisanoPythagorasTreeFive")) {
|
||||
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeFive;
|
||||
} else if (input.equalsIgnoreCase("KilianEhrmannPythagorasTree")) {
|
||||
variant = PythagorasTree.PythagorasTreeVariant.KilianEhrmannPythagorasTree;
|
||||
} else variant = PythagorasTree.PythagorasTreeVariant.unselected;
|
||||
return variant;
|
||||
}
|
||||
|
@ -145,6 +147,8 @@ public class Main {
|
|||
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeFour;
|
||||
} else if (input.equalsIgnoreCase("45")) {
|
||||
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeFive;
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
variant = PythagorasTree.PythagorasTreeVariant.KilianEhrmannPythagorasTree;
|
||||
} else variant = PythagorasTree.PythagorasTreeVariant.unselected;
|
||||
return variant;
|
||||
}
|
||||
|
@ -264,5 +268,28 @@ public class Main {
|
|||
System.out.println("");
|
||||
System.out.println("");
|
||||
System.out.println("");
|
||||
|
||||
System.out.println("KilianEhrmannPythagorasTree:");
|
||||
System.out.println("");
|
||||
System.out.println("The angles of this variant calculated like this: ");
|
||||
System.out.println("(Don't ask why, just one of my classmates having fun...) ");
|
||||
System.out.println("double result_1;\n" +
|
||||
" double result_2;\n" +
|
||||
" result_1 = 100000000*Math.pow(index,(1/13));\n" +
|
||||
" result_2 = 70000%index;\n" +
|
||||
" result_2 = Math.cos(Math.tan(result_2));\n" +
|
||||
" result_2 = index - result_2;\n" +
|
||||
" result_2 *= index + (1 / ( Math.pow(index, (1/17.3))));\n" +
|
||||
" result_2 = Math.pow(result_2, (1/index));\n" +
|
||||
" result_1 /= result_2;\n" +
|
||||
" result_1 = result_1 % index;\n" +
|
||||
" result_1 = result_1 % 30;\n" +
|
||||
" result_1 += 30;\n" +
|
||||
" return result_1;");
|
||||
System.out.println("");
|
||||
System.out.println("");
|
||||
System.out.println("");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public class PythagorasTree {
|
|||
public enum PythagorasTreeVariant {
|
||||
SymetricPythagorasTree, AsymetricPythagorasTree, RegularRandomPythagorasTree,
|
||||
PisanoPythagorasTreeOne, PisanoPythagorasTreeTwo, PisanoPythagorasTreeThree, PisanoPythagorasTreeFour, PisanoPythagorasTreeFive,
|
||||
KilianEhrmannPythagorasTree,
|
||||
unselected,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ public class PythagorasTriangle {
|
|||
leftAngle = (fibonacci.calcFibonacci(momentaryDepth) % 9) * 4 + 29;
|
||||
break;
|
||||
|
||||
case KilianEhrmannPythagorasTree:
|
||||
leftAngle = kilianEhrmannAngle(momentaryDepth);
|
||||
break;
|
||||
default:
|
||||
leftAngle = 45;
|
||||
break;
|
||||
|
@ -61,6 +64,27 @@ public class PythagorasTriangle {
|
|||
leftSizeFactor = Math.sin(Math.toRadians(leftAngle));
|
||||
rightSizeFactor = Math.sin(Math.toRadians(rightAngle));
|
||||
}
|
||||
|
||||
private double kilianEhrmannAngle(int index) {
|
||||
if (index == 0) return 30;
|
||||
double result_1;
|
||||
double result_2;
|
||||
result_1 = 100000000*Math.pow(index,(1/13));
|
||||
result_2 = 70000%index;
|
||||
result_2 = Math.cos(Math.tan(result_2));
|
||||
result_2 = index - Math.pow(result_2, 3);
|
||||
result_2 *= index + (1 / ( Math.pow(index, (1/17.3))));
|
||||
result_2 = Math.pow(result_2, (1/index));
|
||||
if (result_2 != 0) {
|
||||
result_1 /= result_2;
|
||||
result_1 = result_1 % index;
|
||||
}
|
||||
result_1 = result_1 % 30;
|
||||
result_1 += 30;
|
||||
System.out.println("Calculationdepth: " + index);
|
||||
return result_1;
|
||||
}
|
||||
|
||||
public double getLeftSizeFactor() {
|
||||
return leftSizeFactor;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue