PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

line clipping

"drawline" seem doesn't check the situation when it draw a line which endpoints were outside screen window. In another word, "DrawLine" doesn't make line clipping with the screen window rectangle. It doesn't work when i draw a line over the boundary of screen window. Is it true? how should i deal with this problem? could someone help me?
From what I have seen this is true. If the line extends past the edge of the screen it doesn't draw. I built a simple clipper that clips my lines by adjusting the endpoints. The edges of the screen are horizontal and vertical lines so its a really quick calculation to find out if the line you are going to draw is off the edge of the screen. Then its just a matter of finding the new endpoint with x or y at the screen edge and swapping out that end. Once you have this written you can clip against the edge of the screen or you could define your own rectangle and clip against that.
John Gillespie · 04 Jun 2002, 20:30 UTC — Line clipping algorithm
promethus · 05 Jun 2002, 02:49 UTC — thanks for help
thanks for response to tell me the web site. i'll try to understand what the document words in the web. thanks a lot.