Re: Displaying 3-D vector fields [message #32863 is a reply to message #32726] |
Tue, 12 November 2002 12:47   |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
"Jim" <jim.blackwell@gsfc.nasa.gov> wrote
> Hey this is almost what I need. How would one draw more than 1 vector
> at a time in the same window ? 3-D axes ?
By following the steps I laid out in my original post.
Say you want 100 vectors:
; create an object array to hold them
vectors = OBJARR(100)
; create a 100 instances of my vector object
for n=0, 99 do vectors[n] = OBJ_NEW('vector')
; Add our vectors to a model
vecModel = OBJ_NEW('IDLgrModel')
vecModel -> Add, vectors
; Now you have 100 vectors rooted at [0,0,0]
; with a magnitude of [0,0,1]. You probably want them
; to do something now...
; Use the SetProperty method to set each vectors
; magnitude and location. I assume you have 2
; arrays named "mag" and "loc" containing this
; data.
for n=0, 99 do vectors[n] -> Setproperty, MAGNITUDE=mag[n,*], $
LOCATION=loc[n,*]
; Now take a look at what we have.
xobjview, vecModel, /block
; we're done for now, clean up
OBJ_DESTROY, vecModel
If you wanted to animate the vectors you would set up a loop around the call
to the setproperty method where you would loop thru the time dimension of
your array (if the locations were fixed you wouldn't need to change that
property). The only problem with this is that you can't use XOBJVIEW to
view an animation. I would suggest working on some static views making sure
you understand what you are doing (using XOBJVIEW), then go over to David
Fanning's website (www.dfanning.com) and take one of his object graphics
programs and hack the vector animation stuff into it (I suggest FSC_SURFACE?
I think that might come with axes too).
-Rick
|
|
|