AcidR4in
Ensign
- Registriert
- Juli 2005
- Beiträge
- 175
hi ich müsste den in Java programieren, hab aber leider keine ahung von java. Kann mir da einer helfen, brauch das bis Heute 23:40 da muss ich das abgeben ich brauch das teil nur für ne line wär toll wenn mir das bis heute eklären oder noch besser schreiben.
da ist das source wo ich das implemetieren soll
hier ist das framework zu finden
http://www.cg.tuwien.ac.at/courses/CG/LU/Angabe.zip
da ist das source wo ich das implemetieren soll
Code:
import java.awt.Color;
/**
* Representation of a simple 2-dimensional line.
*/
public class CG1Line
{
private int x1, y1, x2, y2;
private Color color;
/**
* Define a line.
*
* @param _x1 x coordinate of line start
* @param _y1 y coordinate of line start
* @param _x2 x coordinate of line end
* @param _y2 y coordinate of line end
* @param _color line color
*/
public CG1Line (int _x1, int _y1, int _x2, int _y2, Color _color)
{
x1 = _x1;
y1 = _y1;
x2 = _x2;
y2 = _y2;
color = _color;
}
/**
* Draw this line.
*
* @param canvas CG1Canvas to draw the line to
*/
public void draw (CG1Canvas canvas)
{
/**
* TODO 1:
* - Draw the line using Bresenham's algorithm.
* - Use canvas.setPixel() to draw a pixel.
*/
}
/**
* Debug output.
*/
public void print ()
{
System.out.println ("(" + x1 + "/" + y1 + ") - (" + x2 + "/" + y2 + ")");
}
}
hier ist das framework zu finden
http://www.cg.tuwien.ac.at/courses/CG/LU/Angabe.zip