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

Home » Public Forums » archive » Surface movie problems: plot changes size
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: Surface movie problems: plot changes size [message #30848 is a reply to message #30812] Mon, 20 May 2002 13:28 Go to previous messageGo to previous message
Paul Sorenson is currently offline  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 =-----
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ICG Library
Next Topic: ActiveX

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

Current Time: Fri Oct 10 13:34:35 PDT 2025

Total time taken to generate the page: 0.16057 seconds