All pastes #490096 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-05-15 21:01 UTC
rendered paste body
import java.applet.Applet;import java.awt.*;public class Farn extends Applet {    public void init(){        setBackground(Color.BLACK);    }        public void paint(Graphics g) {        setForeground(Color.WHITE);                zeichneFarn(g, 150, 50, 250, 150);    }        public void zeichneFarn(Graphics g, int x0, int y0, int x1, int y1) {        double x = x1 - x0;        double y = y1 - y0;        double laenge = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));                //System.out.println(laenge);                if (laenge <= 1) {            return;        }                g.drawLine(x0, y0, x1, y1);                double winkel = Math.atan2(y,x);                double winkel10 = winkel - Math.PI / 18;        double winkel50 = winkel + 5 * Math.PI / 18;        double winkel60 = winkel - Math.PI / 3;                int x2 = x1 + (int) (0.5*laenge*Math.cos(winkel50));        int x3 = x1 + (int) (0.8*laenge*Math.cos(winkel10));        int x4 = x1 + (int) (0.5*laenge*Math.cos(winkel60));                int y2 = y1 + (int) (0.5*laenge*Math.sin(winkel50));        int y3 = y1 + (int) (0.8*laenge*Math.sin(winkel10));        int y4 = y1 + (int) (0.5*laenge*Math.sin(winkel60));        zeichneFarn(g, x1, y1, x2, y2);        zeichneFarn(g, x1, y1, x3, y3);        zeichneFarn(g, x1, y1, x4, y4);    }    }