0

Can i get the codes for Bresenham Line Algorithtm. I have searched for it on google and i get the codes but they do not attach the codes to call the class, and also the codes do not allow user input.
Am now learning java so adding comments would help me a lot.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by JamesCherrill
0

... i get the codes but they do not attach the codes to call the class, and also the codes do not allow user input...

That's normal. The code for the algorithm will be similar no matter how you use it, but how you get the input values etc will be completely different from one application to the next.
Your sample code will probably have a method that starts a bit like like this:
public void line(int x,int y,int x2, int y2, int color)
so you need to pass (in this example) four ints for the starting and ending points, and a fifth value for the color of the line.
How you get those values from the user is up to you. Eg: you could create Window with 4 or 5 input fields, or use Java's built-in GUI dialogs, or you could use the system console with a Scanner to prompt the user and parse his replies.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.