This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. 68k Calculator Basic => TI-BASIC
Author Message
madmax0002


Newbie


Joined: 16 Feb 2004
Posts: 1

Posted: 16 Feb 2004 05:17:43 pm    Post subject:

I want to make a program called SmrtLine() for the TI-89 that will display as much as a line as possible on the screen. Normally pxlLine has an error when one of the co-ordinates is offscreen. My program is supposed to draw as much of the line as possible, up to the edge of the screen.

So far I've figured out that I will have to find which of the screen limits the line will intersect and the intersection points, and make a new line using those points as endpoints, but I'm getting really confused. Confused

Any suggestions?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 16 Feb 2004 05:34:30 pm    Post subject:

None, except that you might want to change the name to smrtline(x1,x2,y1,y2). Why would you want to draw a line if the coordinates are outside the screen anyway?
Back to top
Toksyuryel
Crimson Dragon Software


Elite


Joined: 14 Jun 2003
Posts: 880

Posted: 16 Feb 2004 05:36:18 pm    Post subject:

I don't know what the commands are on the 89, but you may want to find the equivilent(sp?) of this 83 statement: Line(Xmin,Some Y Coord,Xmax,Some Y Coord). Or if you need the other one: Line(Some X Coord,Ymin,Some X Coord,Ymax) Of course the other option would be to simply find the Horizontal Some Y Coord and/or the Vertical Some X Coord command(s). Those would work too.

Last edited by Guest on 16 Feb 2004 05:37:06 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 16 Feb 2004 05:48:21 pm    Post subject:

The equivalent is ptLine( which works in points. He wants the equivalent of pxlLine( which works in pixels.

Try this:


Code:
smrtline(r1,c1,r2,c2)
Prgm
ptLine xmin + c1 (xmax-xmin)/159, ymin + r1 (ymax-ymin)/77, xmin + c2 (xmax-xmin)/159, ymin + r2 (ymax-ymin)/77
EndPrgm


Voila!
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 16 Feb 2004 07:35:15 pm    Post subject:

What purpose will this smartline program serve?
Back to top
Ray Kremer


Member


Joined: 16 Feb 2004
Posts: 237

Posted: 17 Feb 2004 02:42:32 pm    Post subject:

Just some simple algebra.

From the given two points, find the y=mx+b equation for the line. Then take xMin and xMax (the boundaries of the screen) and plug them into the equation. That gives you your two new points that you can feed to the line() command.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement