comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: line drawing knowing angle and a point
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: line drawing knowing angle and a point [message #40123] Wed, 21 July 2004 13:13
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Francois Leduc wrote:

> Hello,
>
> I there a fast way to draw a line in an image knowing 1) the angle of the
> line (with the vertical direction) and 2) a point belonging to the line ?
>


Hello,

Assuming that you angle is acute, the following should work.

y = a + bx
p = point at x,y
theta = angle in radians


b = atan(!pi - theta)
a = py - b * px

theta = 0.4 & p = [11,3]
b = atan(!pi - theta) & a = p[1] - b * p[0]
x = findgen(40)-20 & y = a + b * x
plot, x,y
plots, p[0], p[1],/data, psym = 5

Ben
[Message index]
 
Read Message
Previous Topic: line drawing knowing angle and a point
Next Topic: Error handling and tracebacks

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 15:02:16 PDT 2025

Total time taken to generate the page: 0.72386 seconds