Surface movie problems: plot changes size [message #30812] |
Thu, 16 May 2002 09:26  |
uk2
Messages: 8 Registered: June 1994
|
Junior Member |
|
|
Hi,
I've made a movie of a sequence of jpegs by grabbing a 3-D plot which
is rotated by small angles. The 3-D space is set up by calling surface
with x, y, and z ranges set, but no data plotted. Then PLOTS procedure
is then called with the individual points that I want to plot. The
movie looks great, but because IDL changes the size of the surface
plot to fit in the window, the movie plot grows and shrinks. Can
anyone suggest a way of forcing IDL to use a specific region of the
display so that the 'object' retains it size. I would rather not do
this in object graphics as there are a number of other components to
this that I would also have to replicate in OG.
Thanks in advance, Pete Riley
|
|
|
|
Re: Surface movie problems: plot changes size [message #30845 is a reply to message #30812] |
Mon, 20 May 2002 14:20   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul Sorenson (aardvark62@msn.com) writes:
> I suppose CREATE_VIEW is a little bit hard to use. To make it easier, I
> wrote myself a wrapper for it several years back. FWIW, I'll include the
> wrapper at the end of this message. I see that there is a SCALE3 command
> that is more friendly for surfaces. I should have recommended that.
>
> !p.t3d=1
> data=dist(20)
> for i=0,360 do begin
> scale3, az=i
> surface, data
> end
Now, Paul. *Where* in the world did that !P.T3D trick
come from!? This is the holy grail we have been searching
for on this newsgroup, lo these many years! You are in
our debt, sir.
Cheers,
David
P.S. Let's just say that this is one of those occasions
when you can read the documentation 10 times, set the
Imagination Meter to "high", and still not come up
with anything like the connection between that system
variable and what you are trying to do. :-(
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Surface movie problems: plot changes size [message #30848 is a reply to message #30812] |
Mon, 20 May 2002 13:28   |
Paul Sorenson
Messages: 48 Registered: May 2002
|
Member |
|
|
I suppose CREATE_VIEW is a little bit hard to use. To make it easier, I
wrote myself a wrapper for it several years back. FWIW, I'll include the
wrapper at the end of this message. I see that there is a SCALE3 command
that is more friendly for surfaces. I should have recommended that.
!p.t3d=1
data=dist(20)
for i=0,360 do begin
scale3, az=i
surface, data
end
In case anyone is interested, here is my wrapper to CREATE_VIEW:
pro cntr_view,arr,xr=xr,yr=yr,zr=zr,undo=undo,$
ax=ax, az=az, winx=winx, winy=winy, zoom=zoom, _extra=e
;
; Procedure cntr_view. Establish a 3d view. This is a wrapper
; for Create_View. Cntr_view works just like create view, except:
;
; 1. Takes range keywords XR, YR and ZR as optional alternatives
; to xmin, xmax etc. keywords. Given an xr array,
; for example, cntr_view will "do the work you",
; finding the min and max in the xr array, and then
; feeding those values to create_view via
; create_view's "xmin" and "xmax" keywords.
;
; IDL> x=[.7, -8, 6, 9]
; IDL> y=[-.5, 2, -6,3]
; IDL> z=[1, 1, 5, 5]
; IDL> erase
; IDL> cntr_view, xr=x, yr=y, zr=z
; IDL> plots, x, y, z
; IDL> surface, bytarr(2,2), /nodata, /noerase
;
; 2. Takes an optional 3d array argument. If cntr_view
; is passed one 3d array, the sizes of the
; array are used to determine xmax, ymax, and
; zmax, and xmin, ymin and zmin will be set to
; zero. If Keywords such as XMIN, XMAX, XR, etc. are
; passed with this argument, they override the
; ranges implied by this argument.
;
; 3. Provides an UNDO keyword to return all relevant
; system variables to their defaults.
;
; 4. Uses size of current window (!d.x_size and !d.y_size)
; as defaults for "winx" and "winy" keywords.
; (I have not tested this last feature for use
; with non-windowing (hardcopy) devices.)
;
; Paul C. Sorenson
; Septemberh 1995
;
on_error, 2
if keyword_set(undo) then begin
!P.T3D=0
!P.Position=0
!P.Clip=0
!P.Region=0
!X.S=0
!X.Style=0
!X.Range=0
!X.Margin=[10,3]
!Y.S=0
!Y.Style=0
!Y.Range=0
!Y.Margin=[4,2]
!Z.S=0
!Z.Style=0
!Z.Range=0
!Z.Margin=0
return
end
xmin=0
xmax=1
ymin=0
ymax=1
zmin=0
zmax=1
if n_params() gt 0 then begin
s = size(arr)
if s(0) ne 3 then begin
message, 'argument must be 3D array.'
end
xmax=s(1)-1
ymax=s(2)-1
zmax=s(3)-1
end
if (n_elements(xr) gt 0) then begin
if (n_elements(xr) lt 2) then begin
message, 'keyword XR takes an array of at least 2 elements.'
end
xmin = min(xr)
xmax = max(xr)
end
if (n_elements(yr) gt 0) then begin
if (n_elements(yr) lt 2) then begin
message, 'keyword YR takes an array of at least 2 elements.'
end
ymin = min(yr)
ymax = max(yr)
end
if (n_elements(zr) gt 0) then begin
if (n_elements(zr) lt 2) then begin
message, 'keyword ZR takes an array of at least 2 elements.'
end
zmin = min(zr)
zmax = max(zr)
end
if xmin eq xmax then begin
message, 'specified x-range is infintesimal.'
end
if ymin eq ymax then begin
message, 'specified y-range is infintesimal.'
end
if zmin eq zmax then begin
message, 'specified z-range is infintesimal.'
end
if (n_elements(winx) eq 0) then begin
winx = !d.x_size
end
if (n_elements(winy) eq 0) then begin
winy = !d.y_size
end
if (n_elements(ax) eq 0) then ax = -60
if (n_elements(az) eq 0) then az = 30
if (n_elements(zoom) eq 0) then zoom = 1/sqrt(3)
create_view, xmin=xmin, ymin=ymin, zmin=zmin, $
xmax=xmax, ymax=ymax, zmax=zmax, $
winx=winx, winy=winy, ax=ax, az=az, $
zoom=zoom, _extra=e
end
-Paul Sorenson
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.175169f8ed748e4c9898e4@news.frii.com...
> Paul Sorenson (aardvark62@msn.com) writes:
>
>> Use CREATE_VIEW.
>
> Uh, right. How is that done?
>
> It seems to me you have to do several rotations in
> a particular sequence to get anything like the normal
> "surface" rotation. I can get CREATE_VIEW to rotate
> the surface (although not without an "illegal 3D transformation"
> error), but I can't get it to give me anything like
> the normal surface look. :-(
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
-----------== Posted via Newsgroups.Com - Uncensored Usenet News ==----------
http://www.newsgroups.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
|
|
|
|
|
Re: Surface movie problems: plot changes size [message #30907 is a reply to message #30812] |
Wed, 22 May 2002 11:21  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul Sorenson (aardvark62@msn.com) writes:
> In response to Dave's question, !P.T3D is mentioned in the documentation for
> the T3D command, but I'm not sure where I originally picked up that trick.
Ah, *now* I remember! I used to solve the
problem like this:
PRO ROTATE_SURFACE
data = Dist(30)
window, xs=400, ys=400
FOR j=0,36 DO BEGIN
Scale3, AZ=(j*10), xrange=[0,30], $
yrange=[0,30], zrange=[0 < min(data), max(data)]
Surface, data, /t3d
Wait, 0.1
ENDFOR
END
But I see I was forgetting to set the T3D keyword
on the Surface command the other day when I was trying
to get this to work.
Do you see why I maintain a web page? I've only
solved this particular problem 20 times, and I
*still* can't remember how to do it on the fly. :-(
Off to the web page with you!
Cheers,
David
P.S. Let's just say I hope I can remember I saved it
over *there* next time. :-(
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Surface movie problems: plot changes size [message #30910 is a reply to message #30838] |
Wed, 22 May 2002 10:57  |
Paul Sorenson
Messages: 48 Registered: May 2002
|
Member |
|
|
Heh heh :-)
In response to Dave's question, !P.T3D is mentioned in the documentation for
the T3D command, but I'm not sure where I originally picked up that trick.
-Paul Sorenson
"Kenneth P. Bowman" <kpb@null.com> wrote in message
news:kpb-EE6D58.20542020052002@corp.supernews.com...
> In article <MPG.1753167daa2e0b9b9898ea@news.frii.com>,
> David Fanning <david@dfanning.com> wrote:
>
>> Now, Paul. *Where* in the world did that !P.T3D trick
>> come from!? This is the holy grail we have been searching
>> for on this newsgroup, lo these many years! You are in
>> our debt, sir.
>
> You see, Paul. Every time you do something nice for David, you get
> deeper into debt to him! ;-)
>
> Ken
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
|
|
|