comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Displaying 3-D vector fields
items: Re: Displaying 3-D vector fields

Displaying 3-D vector fields
type: item
description: Hi all, After playing with several pieces of code I've found in the archives, and not having any luck, I figured I'd ask someone here. I have X, Y, Z points in space with a,b,c vector component values. I'd like to plot these in 3-D space. The data points are in the form of a rectangular regularly spaced grid. Any help would be appreciated Jim Blackwell
creator: jim.blackwell
date: 2002-11-06T20:37:10-00:00

Re: Displaying 3-D vector fields
type: item
description: This sounds like a job for object graphics. Someone has to have written a vector object which consists of a few polylines that make up the body and head in a model. Use would be as simple as defining the location and magnitude. Once you have that, something as simple as this would work: ; Your vector locations - XYZ (empty array used as example) location=FLTARR(100,3) ; Your vector magnitudes - ABC (empty array used as example) magnitude=FLTARR(100,3) ; Create a model to put all of our vectors in model = OBJ_NEW('IDLgrModel') ; Fill it up with vector objects vectors = OBJARR(100) for n=0, 99 do $ vectors[n] = OBJ_NEW('vector', LOCATION=location[n,*], $ MAGNITUDE=magnitude[n,*]) ; Add the array of vectors to our model model -> Add, vectors ; Display the contents of the model using xobjview xobjview, model, /BLOCK ; Destroy the objects OBJ_DESTROY, model If you want to animate the vectors you'll have to do a little more work but it would be simple. The trick is finding the "vector" object. Someone on this list has to have written something similar. I was giving this a day hoping someone with such an object would step up... Try searching the usual code archives. I thought Mark Hadfield had something like this but his webpage isn't up anymore. If you want to try and write the vector object yourself left me know and I can help get you started. -Rick "Jim" <jim.blackwell@gsfc.nasa.gov> wrote in message news:95167173.0211061237.389f387a@posting.google.com... > Hi all, > > After playing with several pieces of code I've found in the archives, > and not having any luck, I figured I'd ask someone here. > > I have X, Y, Z points in space with a,b,c vector component values. > I'd like to plot these in 3-D space. The data points are in the form > of a rectangular regularly spaced grid. > > Any help would be appreciated > > Jim Blackwell
creator: Rick Towler
date: 2002-11-07T17:04:58-00:00

Re: Displaying 3-D vector fields
type: item
description: jim.blackwell@gsfc.nasa.gov (Jim) wrote in message news:<95167173.0211061237.389f387a@posting.google.com>... > Hi all, > > After playing with several pieces of code I've found in the archives, > and not having any luck, I figured I'd ask someone here. > > I have X, Y, Z points in space with a,b,c vector component values. > I'd like to plot these in 3-D space. The data points are in the form > of a rectangular regularly spaced grid. > > Any help would be appreciated > > Jim Blackwell This plots an arrow in a 3d plot, at any Z value, however the arrow is 'parallel' to the XY plane... pro arrow_3d,xcen,ycen,z,a,arrowsize,thick=thick,color=color ; plots an arrow on a 3d plot ; arrowhead is in the horizontal, xy plane ; ; INPUT PARAMETERS: ; xcen, ycen = starting point of arrow in data coordinates ; z = height of arrow above xy plane in data coordinates ; a = angle, degrees c/clockwise from +X direction, in xy plane ; ; OPTIONAL INPUT PARAMETERS: ; thick = usual IDL meaning, default = 2.0 ; color = usual IDL meaning, default = !P.COLOR ; ; MODIFICATION HISTORY: ; merged from one_arrow.pro and one_ray.pro, 15 Aug 2002 dtr=!pi/180. if N_params() LT 5 then begin print,'Err: arrow_3d,xcen,ycen,z,angle,arrowsize,[,thick=,color=]' return endif if not keyword_set(thick) then thick = 2.0 if not keyword_set(color) then color = !P.COLOR ; forward half of arrow stalk plots,[xcen,xcen+arrowsize*cos(a*dtr)/2.],$ [ycen,ycen+arrowsize*sin(a*dtr)/2.],$ [z,z], color=color, thick=thick, /t3d ; backward half of arrow stalk plots,[xcen,xcen-arrowsize*cos(a*dtr)/2.],$ [ycen,ycen-arrowsize*sin(a*dtr)/2.],$ [z,z], color=color, thick=thick, /t3d ; move to arrow head xcen=xcen+arrowsize*cos(a*dtr)/2. ycen=ycen+arrowsize*sin(a*dtr)/2. ; plot arrow head ; it's 1/3 the length of stalk, at angle 35 degrees - plots,[xcen,xcen+arrowsize*cos((180.+a+35.)*dtr)/3.],$ [ycen,ycen+arrowsize*sin((180.+a+35.)*dtr)/3.],$ [z,z], color=color, thick=thick, /t3d plots,[xcen,xcen+arrowsize*cos((180.+a-35.)*dtr)/3.]…
creator: rmw092001
date: 2002-11-08T07:38:16-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqe77h$1juo$1@nntp6.u.washington.edu>... > This sounds like a job for object graphics. > > Someone has to have written a vector object which consists of a few > polylines that make up the body and head in a model. Use would be as simple > as defining the location and magnitude. > > Once you have that, something as simple as this would work: > > ; Your vector locations - XYZ (empty array used as example) > location=FLTARR(100,3) > > ; Your vector magnitudes - ABC (empty array used as example) > magnitude=FLTARR(100,3) > > ; Create a model to put all of our vectors in > model = OBJ_NEW('IDLgrModel') > > ; Fill it up with vector objects > vectors = OBJARR(100) > for n=0, 99 do $ > vectors[n] = OBJ_NEW('vector', LOCATION=location[n,*], $ > MAGNITUDE=magnitude[n,*]) > > ; Add the array of vectors to our model > model -> Add, vectors > > ; Display the contents of the model using xobjview > xobjview, model, /BLOCK > > ; Destroy the objects > OBJ_DESTROY, model > > > If you want to animate the vectors you'll have to do a little more work but > it would be simple. > > > The trick is finding the "vector" object. Someone on this list has to have > written something similar. I was giving this a day hoping someone with such > an object would step up... Try searching the usual code archives. I > thought Mark Hadfield had something like this but his webpage isn't up > anymore. > > If you want to try and write the vector object yourself left me know and I > can help get you started. > > -Rick Rick, Thanks for the advice. As far as a vector object, I presume one could take the program offered in another reply to this posting and make it an object ? Not being familiar with Object Graphics other than for some examples I've tried to figure out, I need some help here. Jim Blackwell
creator: jim.blackwell
date: 2002-11-08T14:44:34-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqe77h$1juo$1@nntp6.u.washington.edu>... > This sounds like a job for object graphics. > > Someone has to have written a vector object which consists of a few > polylines that make up the body and head in a model. Use would be as simple > as defining the location and magnitude. > > Once you have that, something as simple as this would work: > > ; Your vector locations - XYZ (empty array used as example) > location=FLTARR(100,3) > > ; Your vector magnitudes - ABC (empty array used as example) > magnitude=FLTARR(100,3) > > ; Create a model to put all of our vectors in > model = OBJ_NEW('IDLgrModel') > > ; Fill it up with vector objects > vectors = OBJARR(100) > for n=0, 99 do $ > vectors[n] = OBJ_NEW('vector', LOCATION=location[n,*], $ > MAGNITUDE=magnitude[n,*]) > > ; Add the array of vectors to our model > model -> Add, vectors > > ; Display the contents of the model using xobjview > xobjview, model, /BLOCK > > ; Destroy the objects > OBJ_DESTROY, model > > > If you want to animate the vectors you'll have to do a little more work but > it would be simple. > > > The trick is finding the "vector" object. Someone on this list has to have > written something similar. I was giving this a day hoping someone with such > an object would step up... Try searching the usual code archives. I > thought Mark Hadfield had something like this but his webpage isn't up > anymore. > > If you want to try and write the vector object yourself left me know and I > can help get you started. > > -Rick > > > > "Jim" <jim.blackwell@gsfc.nasa.gov> wrote in message > news:95167173.0211061237.389f387a@posting.google.com... >> Hi all, >> >> After playing with several pieces of code I've found in the archives, >> and not having any luck, I figured I'd ask someone here. >> >> I have X, Y, Z points in space with a,b,c vector component values. >> I'd like to plot these in 3-D space. The data points are in the form >> of a rectangular reg…
creator: jim.blackwell
date: 2002-11-08T15:35:15-00:00

Re: Displaying 3-D vector fields
type: item
description: Jim wrote: > > Hi all, > > After playing with several pieces of code I've found in the archives, > and not having any luck, I figured I'd ask someone here. > > I have X, Y, Z points in space with a,b,c vector component values. > I'd like to plot these in 3-D space. The data points are in the form > of a rectangular regularly spaced grid. > > Any help would be appreciated > > Jim Blackwell Would an approach using FLOW3 meet your needs? Even if this isn't quite what you need, flow3.pro might be a suitable starting point for a routine customized to your needs.
creator: James Kuyper
date: 2002-11-08T16:05:01-00:00

Re: Displaying 3-D vector fields
type: item
description: "Jim" <jim.blackwell@gsfc.nasa.gov> wrote > "Rick Towler" <rtowler@u.washington.edu> >> This sounds like a job for object graphics. >> >> Someone has to have written a vector object which consists of a few >> polylines that make up the body and head in a model. Use would be as simple >> as defining the location and magnitude. >> >> Once you have that, something as simple as this would work: >> >> ; Your vector locations - XYZ (empty array used as example) >> location=FLTARR(100,3) >> >> ; Your vector magnitudes - ABC (empty array used as example) >> magnitude=FLTARR(100,3) >> >> ; Create a model to put all of our vectors in >> model = OBJ_NEW('IDLgrModel') >> >> ; Fill it up with vector objects >> vectors = OBJARR(100) >> for n=0, 99 do $ >> vectors[n] = OBJ_NEW('vector', LOCATION=location[n,*], $ >> MAGNITUDE=magnitude[n,*]) >> >> ; Add the array of vectors to our model >> model -> Add, vectors >> >> ; Display the contents of the model using xobjview >> xobjview, model, /BLOCK >> >> ; Destroy the objects >> OBJ_DESTROY, model >> >> >> If you want to animate the vectors you'll have to do a little more work but >> it would be simple. >> >> >> The trick is finding the "vector" object. Someone on this list has to have >> written something similar. I was giving this a day hoping someone with such >> an object would step up... Try searching the usual code archives. I >> thought Mark Hadfield had something like this but his webpage isn't up >> anymore. >> >> If you want to try and write the vector object yourself left me know and I >> can help get you started. >> >> -Rick > > Thanks for the advice. As far as a vector object, I presume one could > take the program offered in another reply to this posting and make it > an object ? Not being familiar with Object Graphics other than for > some examples I've tried to figure out, I need some help here. Well let me introduce you to the wonderful world of Object graphics. :) Actually, let Ronn Kling do that with his book "Power G…
creator: Rick Towler
date: 2002-11-08T19:31:12-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqh3iq$20ts$1@nntp6.u.washington.edu>... > "Jim" <jim.blackwell@gsfc.nasa.gov> wrote >> "Rick Towler" <rtowler@u.washington.edu> >>> This sounds like a job for object graphics. >>> >>> Someone has to have written a vector object which consists of a few >>> polylines that make up the body and head in a model. Use would be as > simple >>> as defining the location and magnitude. >>> >>> Once you have that, something as simple as this would work: >>> >>> ; Your vector locations - XYZ (empty array used as example) >>> location=FLTARR(100,3) >>> >>> ; Your vector magnitudes - ABC (empty array used as example) >>> magnitude=FLTARR(100,3) >>> >>> ; Create a model to put all of our vectors in >>> model = OBJ_NEW('IDLgrModel') >>> >>> ; Fill it up with vector objects >>> vectors = OBJARR(100) >>> for n=0, 99 do $ >>> vectors[n] = OBJ_NEW('vector', LOCATION=location[n,*], $ >>> MAGNITUDE=magnitude[n,*]) >>> >>> ; Add the array of vectors to our model >>> model -> Add, vectors >>> >>> ; Display the contents of the model using xobjview >>> xobjview, model, /BLOCK >>> >>> ; Destroy the objects >>> OBJ_DESTROY, model >>> >>> >>> If you want to animate the vectors you'll have to do a little more work > but >>> it would be simple. >>> >>> >>> The trick is finding the "vector" object. Someone on this list has to > have >>> written something similar. I was giving this a day hoping someone with > such >>> an object would step up... Try searching the usual code archives. I >>> thought Mark Hadfield had something like this but his webpage isn't up >>> anymore. >>> >>> If you want to try and write the vector object yourself left me know and > I >>> can help get you started. >>> >>> -Rick >> > >> Thanks for the advice. As far as a vector object, I presume one could >> take the program offered in another reply to this posting and make it >> an object ? Not being familiar with Object Graphics other than for >> some examples I've…
creator: jim.blackwell
date: 2002-11-12T19:20:07-00:00

Re: Displaying 3-D vector fields
type: item
description: "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
creator: Rick Towler
date: 2002-11-12T20:47:10-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqrphc$26s0$1@nntp6.u.washington.edu>... > "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 Rick, forgive me for being such a doofus, but shouldn't the mag and loc arrays be 3-D ? Would it be as simple as just adding this code to the existing code set for creating the vector object ? Th…
creator: jim.blackwell
date: 2002-11-13T15:06:01-00:00

Re: Displaying 3-D vector fields
type: item
description: "Jim" <jim.blackwell@gsfc.nasa.gov> wrote > > forgive me for being such a doofus, but shouldn't the mag and loc > arrays be 3-D ? You tell me... Well I guess you just did. The 3rd dimension is time, I presume. That doesn't change anything except how you subscript your data. Say you have 100 samples from 100 data points. Your array will be in a form similar to [point,sample,values] or [100,100,3] where the last dimension is your x,y,z or u,v,w depending on if we're talking about your location array or magnitude array. Is that correct? In my example, I assumed 1 sample from 100 points [100,1,3] which I simplified to [100,3]. You can change the subscripts in the example to work with your data set. [n,*] would become something like [n,0,*] for your first sample, [n,1,*] for your second and so on. > Would it be as simple as just adding this code to the > existing code set for creating the vector object ? I don't understand what you are asking. But if you are asking if you should add this code to the vector object. No. Stick with my example. -Rick
creator: Rick Towler
date: 2002-11-13T17:20:47-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqu1qc$28se$1@nntp6.u.washington.edu>... > "Jim" <jim.blackwell@gsfc.nasa.gov> wrote >> >> forgive me for being such a doofus, but shouldn't the mag and loc >> arrays be 3-D ? > > You tell me... Well I guess you just did. The 3rd dimension is time, I > presume. That doesn't change anything except how you subscript your data. > > Say you have 100 samples from 100 data points. Your array will be in a form > similar to [point,sample,values] or [100,100,3] where the last dimension is > your x,y,z or u,v,w depending on if we're talking about your location array > or magnitude array. Is that correct? > > In my example, I assumed 1 sample from 100 points [100,1,3] which I > simplified to [100,3]. You can change the subscripts in the example to work > with your data set. [n,*] would become something like [n,0,*] for your > first sample, [n,1,*] for your second and so on. > > > >> Would it be as simple as just adding this code to the >> existing code set for creating the vector object ? > > I don't understand what you are asking. But if you are asking if you should > add this code to the vector object. No. Stick with my example. > > -Rick Rick, actually I have a data file containing the X, Y, Z positions of each vector along with the magnitudes in the three dimensions. There are then some (believe it or not) 18,000 individual vectors in the dataset ! When I asked about adding in the code, I merely meant I wasn't sure how to combine the vector code with the arrays to load the data. Basically, how do I make it all work together, do I call the vector object from the other code ? I'm really finding that I have trouble thinking in 3-D for some reason and I have a Master's in Physics !! :() Though it has been many years ago and we weren't programming such things then. Cheers, Jim Blackwell
creator: jim.blackwell
date: 2002-11-14T15:33:04-00:00

Re: Displaying 3-D vector fields
type: item
description: Jim (jim.blackwell@gsfc.nasa.gov) writes: > I'm really finding that I have trouble > thinking in 3-D for some reason and I have a Master's in Physics !! I used to think getting a degree in Physics was the best thing that ever happened to me. I've even argued with my three sons that they would profit greatly my majoring in Physics in college. (To blank stares, mostly.) But lately I've been seeing more and more parallels to Catholicism and the great quantities of guilt that having a degree in Physics generates. Solving physics problems makes you think you can do anything. So, of course, when the toilet leaks, or the car won't start, or the bicycle gears won't change, you think "Oh, well, I can probably fix that." Only to find (at least in my case) that a degree in Physics doesn't help all that much. :-( I spend all my time worrying about what I "should" be able to do instead of just calling the damn plumber. :-( Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. 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
creator: David Fanning
date: 2002-11-14T15:52:18-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqu1qc$28se$1@nntp6.u.washington.edu>... > "Jim" <jim.blackwell@gsfc.nasa.gov> wrote >> >> forgive me for being such a doofus, but shouldn't the mag and loc >> arrays be 3-D ? > > You tell me... Well I guess you just did. The 3rd dimension is time, I > presume. That doesn't change anything except how you subscript your data. > > Say you have 100 samples from 100 data points. Your array will be in a form > similar to [point,sample,values] or [100,100,3] where the last dimension is > your x,y,z or u,v,w depending on if we're talking about your location array > or magnitude array. Is that correct? > > In my example, I assumed 1 sample from 100 points [100,1,3] which I > simplified to [100,3]. You can change the subscripts in the example to work > with your data set. [n,*] would become something like [n,0,*] for your > first sample, [n,1,*] for your second and so on. > > > >> Would it be as simple as just adding this code to the >> existing code set for creating the vector object ? > > I don't understand what you are asking. But if you are asking if you should > add this code to the vector object. No. Stick with my example. > > -Rick Rick, Okay I get it now Thank God ! I seem to be running into a memory problem in trying to display 18K vectors at a time though ? I don't get any indication of this, but it bombs after some number less than that number of vectors Jim
creator: jim.blackwell
date: 2002-11-14T17:03:21-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:<aqu1qc$28se$1@nntp6.u.washington.edu>... > "Jim" <jim.blackwell@gsfc.nasa.gov> wrote >> >> forgive me for being such a doofus, but shouldn't the mag and loc >> arrays be 3-D ? > > You tell me... Well I guess you just did. The 3rd dimension is time, I > presume. That doesn't change anything except how you subscript your data. > > Say you have 100 samples from 100 data points. Your array will be in a form > similar to [point,sample,values] or [100,100,3] where the last dimension is > your x,y,z or u,v,w depending on if we're talking about your location array > or magnitude array. Is that correct? > > In my example, I assumed 1 sample from 100 points [100,1,3] which I > simplified to [100,3]. You can change the subscripts in the example to work > with your data set. [n,*] would become something like [n,0,*] for your > first sample, [n,1,*] for your second and so on. > > > >> Would it be as simple as just adding this code to the >> existing code set for creating the vector object ? > > I don't understand what you are asking. But if you are asking if you should > add this code to the vector object. No. Stick with my example. > > -Rick Rick, what scales the size of the arrow (the length of the arrow relative to the shaft) ? Is the default vector that is drawn of unit length ? Jim
creator: jim.blackwell
date: 2002-11-14T18:11:42-00:00

Re: Displaying 3-D vector fields
type: item
description: > Okay I get it now Thank God ! I seem to be running into a memory > problem in trying to display 18K vectors at a time though ? I don't > get any indication of this, but it bombs after some number less than > that number of vectors 18K... That's a lot, but hopefully not too many. You do realize that you will not be viewing these in real time. What are your system spex? I used the test program below to generate an array of 20K vector objects. The array of objects and *one sample* of location and magnitude data required about 31MB. Displaying this dataset using XOBJVIEW required about 50MB. IDLDE required around 70MB total as reported by windows task manager. So it seems like you should be able to do this on a relatively new PC given you manage your data. You probably can't just read in all of your data at once. I would read in a single sample (or time step or whatever you want to call it) at a time, plot it, then read in the next and plot, and so on. Something like: nvectors=18000 nsamples=1000 ; create our data arrays magnitudes=FLTARR(3,nvectors) locations=FLTARR(3,nvectors) ; create the vector objects vectors = OBJARR(nvectors) for n=0, nvectors-1 do vectors[n] = OBJ_NEW('vector', color=[255,0,0]) for n=0, nsamples-1 do begin ; read in this samples data readf, 1, magnitudes readf, 2, locations ; update the vectors for n=0, nvectors-1 do vectors[n] -> SetProperty, $ MAGNITUDE=magnitudes[*,n], LOCATION=locations[*,n] ; draw the scene oWindow -> Draw, oView ; Grab the image in the window and write to file endfor ; clean up obj_destroy, vectors This is just a start. I have left a lot of detail out and the readf statements are wrong I'm sure but the general form is there. This does bring up the question as to how you are going to 'view' this visualization. with 18k vectors you are not going to be able to view the entire scene and make anything out I don't think. And since you will not be able to view this in real time you won't be able to "fly around" in the vector fi…
creator: Rick Towler
date: 2002-11-14T19:52:25-00:00

Re: Displaying 3-D vector fields
type: item
description: "Jim" <jim.blackwell@gsfc.nasa.gov> wrote > what scales the size of the arrow (the length of the arrow relative to > the shaft)? The vector is scaled according to the sqrt() of the sum of the squares of the components of the magnitude. The *entire* vector is scaled, head and all since I am using the model's transformation matrix to do the work for me. The vector is not drawn if the magnitude is 0. > Is the default vector that is drawn of unit length ? Yes, the default vector is 1 unit long. It's default magnitude is [0,0,-1] which makes it parallel to the z axis pointing away from the viewer. It's default location is [0,0,0]. -Rick
creator: Rick Towler
date: 2002-11-14T20:13:42-00:00

Re: Displaying 3-D vector fields
type: item
description: "Jim" <jim.blackwell@gsfc.nasa.gov> wrote in message news:95167173.0211140903.5db20620@posting.google.com... > Okay I get it now Thank God ! I seem to be running into a memory > problem in trying to display 18K vectors at a time though ? I don't > get any indication of this, but it bombs after some number less than > that number of vectors As I understand this thread to date, you are displaying 18K vectors with an array of 18K vector objects. No?? If so, I'm not surprised you are running into memory problems. (If not, *I* am running into memory problems.) That approach won't work beyond 1000 or so, in my experience. One the other hand, representing 18K vectors with 18K line segments in an IDLgrPolyline is no big deal. (Though I must say viewing them on the screen might be!) Creating an IDLgrPolyline object to display these vectors isn't all that hard, you just have to load an array specifying positions corresponding to the ends of each vector (the DATA property) and the connectivity array which tells the polyline which ones to connect (the POLYLINES property). As Rick (I think) commented earlier, my IDL code library contains an object class (MGHgrBarbPlot) that does exactly this & hides the details. You just have to give it arrays defining the origin and displacement of each vector in 3D space. Unfortunately my library is off the air at the moment. (I really must do something about this.) Jim, why don't you email me & I can send you the code for the barb-plot object plus some examples. -- Mark Hadfield "Ka puwaha te tai nei, Hoea tatou" m.hadfield@niwa.co.nz National Institute for Water and Atmospheric Research (NIWA)
creator: Mark Hadfield
date: 2002-11-14T20:52:51-00:00

Re: Displaying 3-D vector fields
type: item
description: "Mark Hadfield" <m.hadfield@niwa.co.nz> wrote Now you speak up! I was hoping someone would come up with a solution for Jim but since nobody did, I wrote the vector object. At the time I had no idea he was going to display 18K vectors so the single vector design seemed sound and making it a subclass of IDLgrModel made dealing with the geometry of the head easy. > I'm not surprised you are running into memory problems. (If not, *I* > am running into memory problems.) That approach won't work beyond 1000 or > so, in my experience. One the other hand, representing 18K vectors with 18K > line segments in an IDLgrPolyline is no big deal. (Though I must say viewing > them on the screen might be!) I can easily create 20k individual vector objects so I don't know what you have run into in the past. This approach will cost him an extra 8MB or so with the IDLgrModel overhead but what the heck, memory is cheap! > Creating an IDLgrPolyline object to display these vectors isn't all that > hard, you just have to load an array specifying positions corresponding to > the ends of each vector (the DATA property) and the connectivity array which > tells the polyline which ones to connect (the POLYLINES property). True, but dealing with the vector head using this approach is an, um, headache. > Unfortunately my library is off the air at the moment. (I > really must do something about this.) Please do! -Rick
creator: Rick Towler
date: 2002-11-14T21:39:43-00:00

Re: Displaying 3-D vector fields
type: item
description: "Rick Towler" <rtowler@u.washington.edu> wrote in message news:ar15bu$uku$1@nntp6.u.washington.edu... > Now you speak up! My apologies. I did submit a message to this thread earlier but somehow it never showed up. > I can easily create 20k individual vector objects so I don't know > what you have run into in the past. This approach will cost him an > extra 8MB or so with the IDLgrModel overhead but what the heck, > memory is cheap! OK, it's not memory that kills you when you have a large number of objects, it's redraw speed. (Another apology, this time for looseness.) I based this assertion on experience with scatter plots, discussed on the group several times in the past: when you're dealing with > 1000 geometric entities, combining them into one object gives much faster redraws than having a separate object for each one. I thought I should check that this principle out for the current case, so I just compared a barb plot with 1000 line segments in one IDlgrPolyline vs a barb plot with a 1000 IDLgrPolylines. Sure enough, the single-object version is redrawn very snappily, the multi-object version takes 0.5 s or so per redraw. So, on my machine at least, 18 K objects would be pretty slow. > True, but dealing with the vector head using this approach is an, > um, headache. Oh right, I hadn't thought about this much. I have given up on trying to draw heads on my barbs (can't be bothered with all the geometry) but my MGHgrBarbPlot object can draw a symbol at the base of each barb. I find I prefer the look of this anyway. >> Unfortunately my library is off the air at the moment. (I really >> must do something about this.) > > Please do! Yes, I really really will. I promise. -- Mark Hadfield "Ka puwaha te tai nei, Hoea tatou" m.hadfield@niwa.co.nz National Institute for Water and Atmospheric Research (NIWA)
creator: Mark Hadfield
date: 2002-11-14T23:47:06-00:00