package Aufgabenzettel; import java.awt.Graphics; import javax.swing.JComponent; public class Bresenhamline extends JComponent { //Variablen initialisieren double ixa,iya,ixe,iye; //Übergabeargumente ixa = input x anfang; iye = input y ende int xstart,xende,ystart,yende,dx,dy,adx,sdx,ady,sdy; public Bresenhamline(double ixa, double iya, double ixe, double iye) { this.ixa = ixa; this.iya = iya; this.ixe = ixe; this.iye = iye; this.xstart = (int)Math.ceil(ixa+0.5); //Umwandlung in integer this.xende = (int)Math.ceil(ixe+0.5); this.ystart = (int)Math.ceil(iya+0.5); this.yende = (int)Math.ceil(iye+0.5); this.dx = xende - xstart; this.dy = ystart - yende; this.adx = Math.abs(dx); // Absolutbetraege von dx u dy this.ady = Math.abs(dy); if(dx < 0 ){ sdx = -1; } else { sdx = 1; } int sdy; if(dy < 0 ){ sdy = -1; } else { sdy = 1; } } }