Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/29/04 20:19
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#80022 - RE: How to implement it with c51
Responding to: ???'s previous message
Hi Mr. Mohamed,

It sounds like you are trying to do vector graphics as opposed to bitmap graphics. I am not familiar with Keil, but first I would look to see which graphic functions are available.

That being said, it isn't difficult to calculate the pixels for your arbitrary line. You have said that you know (x1, y1) and (x2, y2), the endpoints of the line segment. The general equation for a line is

y = mx + c

You need to calculate m and c. From your known data, you can calculate

m = (y2 - y1)/(x2 - x1)
and
c = y1 - x1*m

Now the n points (pixels) along the line can be calculated as

y_i = m*x_i + c | i = {1, 2, 3, ..., n}

Good luck.

List of 14 messages in thread
TopicAuthorDate
How to draw line at any angle on GLCD            01/01/70 00:00      
   RE: How to draw line at any angle on GLCD            01/01/70 00:00      
      RE: How to draw line at any angle on GLCD            01/01/70 00:00      
         RE: How to draw line at any angle on GLC            01/01/70 00:00      
   RE: How to draw line at any angle on GLC            01/01/70 00:00      
   Look for Breshenham and Wu            01/01/70 00:00      
      RE: Look for Breshenham and Wu            01/01/70 00:00      
   How to implement it with c51            01/01/70 00:00      
      RE: How to implement it with c51            01/01/70 00:00      
      RE: How to implement it with c51            01/01/70 00:00      
         Correction, sort of            01/01/70 00:00      
            No            01/01/70 00:00      
   Resolution issues...            01/01/70 00:00      
   RE: How to draw line at any angle on GLC            01/01/70 00:00      

Back to Subject List