Re: Plotting lines between two polygons [message #12612 is a reply to message #12517] |
Mon, 24 August 1998 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
<snip>
>
> Can anybody tell me how to retrieve/compute the new
> coordinates for the line after a rotation/translation
> of the polygon?
>
Marco:
I'm not sure exactly what you're after, but here is a general
method for computing the new coordinates for the lines after
rotation and translation, for R2:
xcoors = [x1,x2,x3,...,xN] ; Vector of X coordinates for vertices
ycoors = [y1,y2,y3,...,yN] ; Vector of Y coordinates
p = fltarr(N,4)
p[*,0] = xcoors[*]
p[*,1] = ycoors[*]
p[*,3] = 1.0
save_pt = !p.t ; Compute matrix for affine transformations
t3d, /reset
t3d, rotate = [0.0, yrot, 0.0] ; Apply rotations
t3d, rotate = [xrot, 0.0, 0.0]
t3d, translate = [dx, dy, 0.0] ; Apply translation
t3d, scale = [scalex, scaley, 1.0] ; Apply scaling
p_new = p[*,*] # !p.t[*,*] ; Compute new coordinates
!p.t = save_pt
Hope this helps.
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|