I have two coordinates like (x1,y1) and (x2,y2). now i want to draw a straight line between them and want to get all the pixels on it. how can i do it?? can anyone help me please...
Printable View
I have two coordinates like (x1,y1) and (x2,y2). now i want to draw a straight line between them and want to get all the pixels on it. how can i do it?? can anyone help me please...
Is this a Math question or Java question?
The equation for a straight line is
where m = gradientCode :y-y1 = m(x-x1)
Code :m = (y2-y1)/(x2-x1)
i want the java code to get the all pixel values of the straigt line....can you help me please...
No. You need to do something first, I'm not going to do everything just for you to turn around and go thats not what im after.
Java Graphics class
use the drawLine method.