|
|
void pythagoras (double c, double winkel, int tiefe) { double b= c* Math.cos(winkel*Math.PI/180); double a= c* Math.sin(winkel*Math.PI/180); Color f; if (tiefe==1) f=Color.RED; else f=Color.GREEN; t.stiftFarbe(f); if (tiefe>0){ t.drehe(winkel); t.vor(b); t.vor(a); t.drehe(-90); pythagoras(a, winkel, tiefe-1); t.stiftFarbe(f); t.vor(a); t.drehe(-90); t.vor(a); t.drehe(-90); t.vor(a); t.vor(b); t.drehe(90); t.vor(b); t.drehe(180); pythagoras (b, winkel, tiefe-1); t.stiftFarbe(f); t.drehe(180); t.drehe(90); t.vor(b); t.drehe(90-winkel); } }
|