From help-request at octave dot org Sat May 15 12:00:46 2004 Subject: RE: Draw a line through 2 points From: (Ted Harding) To: Sue Stones Cc: help at octave dot org Date: Sat, 15 May 2004 15:57:30 +0100 (BST) On 15-May-04 Sue Stones wrote: > How do I draw a line through 2 points. Not just between the points > but going off the graph on either side? > > sue You can do it by specifying two other points to define a line which includes the two given points. e.g. (adjust t1, t2 to your taste; the values below extend the line between p1 and p2 to either side by 10 times the distance between p1 and p2): p1=[x1;y1]; p2=[x2;y2]; t1=(-10); t2=(+10); P1=p1 + t1*(p2-p1) ; P2=p2 + t2*(p2-p1); Now draw a line from P1 to P2 (when t1=0 and t2=0 you get the original points p1 and p2). Hope this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) Fax-to-email: +44 (0)870 167 1972 Date: 15-May-04 Time: 15:57:30 ------------------------------ XFMail ------------------------------ ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------