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

Home » Public Forums » archive » Re: a polygon version of polyline..
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: a polygon version of polyline.. [message #41111] Fri, 01 October 2004 08:56 Go to next message
george is currently offline  george
Messages: 22
Registered: August 1996
Junior Member
Wow, Rick,

What can I say. I just downloaded your object - it is brilliant -
exactly what I'm after. Many thanks - that is all actually way beyond
the call of duty....

I will implement it into my magnetic field progam and then give you an
update. If I do some decent tidying and optimizing then I can
resubmit my code (though it must be said, tidying and optimizing are
not my Forte).

Anyhow, fun I will have - thanks again...

George.


>
>
> Have fun.
>
>
> -Rick
Re: a polygon version of polyline.. [message #41117 is a reply to message #41111] Thu, 30 September 2004 16:22 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
George Millward wrote:

> Rick, Mark,
>
> Thanks for the help. It looks like I'm going to have to get down and
> dirty with this then.
> The image is from a simulation of the Earth's magnetic field - in the
> core. My needs are a little less extravagant. Mostly about 6 to 10
> lines plotted will be enough - so I think I have hardware that will
> cope ok. Not sure what sofware was used in that image - but it is
> just OpenGL polygons with a couple of light souces yeh - so I assume
> IDL could produce something essentially the same.
>
> Anyhow, I'll get back to this if i make any headway - but it could be
> some time ;o)

After writing documentation most of the day I thought I would hash out
the rest of this object. I needed a break!

Behold RHTgrTube. There are few comments and the code is a bit of a
mess but it should get you pretty far along your way. The only real
limitation I can see right now is that your polyline (input) vertices
must be sequentially ordered. Also, if two sequential polyline verts
are in the same place it will choke. The tube twists a bit when you go
around a corner. The normals shift and the lighting is a bit off
(noticeable in the first demo image). Feel free to fix that if you want :)

Compile it and run the "testtube" procedure for a demo.

You can pick it up here:

http://www.acoustics.washington.edu/~towler/programs/rhtgrtu be__define.pro


Have fun.


-Rick
Re: a polygon version of polyline.. [message #41126 is a reply to message #41117] Thu, 30 September 2004 09:15 Go to previous messageGo to next message
george is currently offline  george
Messages: 22
Registered: August 1996
Junior Member
>
> That is a slick image... Do you know what software package they used?

Rick, Mark,

Thanks for the help. It looks like I'm going to have to get down and
dirty with this then.
The image is from a simulation of the Earth's magnetic field - in the
core. My needs are a little less extravagant. Mostly about 6 to 10
lines plotted will be enough - so I think I have hardware that will
cope ok. Not sure what sofware was used in that image - but it is
just OpenGL polygons with a couple of light souces yeh - so I assume
IDL could produce something essentially the same.

Anyhow, I'll get back to this if i make any headway - but it could be
some time ;o)

Cheers,

George.
Re: a polygon version of polyline.. [message #41131 is a reply to message #41126] Wed, 29 September 2004 17:21 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
George Millward wrote:

> I have a 3D object program which plots magnetic field lines (in 3D
> space) as polylines. This is fine - but I would like to change it so
> that they are coloured 'tubes' - polylines with a certain circular
> cross section and a 'shiny' finish. The look I am after is the one
> you often see with magnetic field topologies (Solar magnetic fields
> models etc.)
>
>
> Simple question is: does anyone know how to do this - or could they
> point me to a ready-made procedure.

I don't know of a ready made procedure, but I did work up something
similar for someone a while back. I googled the group for "tube" and
found the post. That approach won't quite satisfy since the OPer simply
wanted to connect two points with a tube. You would have discontinuity
at the joints if you took this approach.

This would actually be pretty simple. I started playing around with
this but it isn't to a point where it is worth sharing and I would need
some encouragement to get it there. (I am pretty busy right now)

For each vertex v[n] of your polyline you'll need to calculate r
vertices which make up a circle about v[n] that lie on a plane oriented
orthogonal to v[n+1]-v[n-1]. The ends present special cases where your
plane will be orthogonal to v[n+1]-v[n] and v[n-1]-v[n].

Meshing these verts should be straight forward but I haven't thought it
thru. I find that on most PC hardware quad strips render the fastest
(vs tri strips). The IDL docs cover creating quad and tri strip meshes.

Speaking of hardware. Depending on the number of verts in your
polylines and the value you choose for r, you will most likely need some
decent hardware to manipulate this in real time. If you run into
problems render your field as a polyline to orient it as you like then
render it as your tube to create your output.

Hope this gets you started.

-Rick


> http://www.es.ucsc.edu/~glatz/field.html

That is a slick image... Do you know what software package they used?
Re: a polygon version of polyline.. [message #41134 is a reply to message #41131] Wed, 29 September 2004 16:54 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
George Millward wrote:
> Hi there,
>
> I have a 3D object program which plots magnetic field lines (in 3D
> space) as polylines. This is fine - but I would like to change it so
> that they are coloured 'tubes' - polylines with a certain circular
> cross section and a 'shiny' finish. The look I am after is the one
> you often see with magnetic field topologies (Solar magnetic fields
> models etc.)
>
> Simple question is: does anyone know how to do this - or could they
> point me to a ready-made procedure.

Cool! I'm afraid you might have to write your own. The MESH_OBJ routine
does "cylinders" and "extrusions", but only straight ones, I think. A
bendy tube will have the same connectivity as a straight one, but you're
going to have to warp those vertex positions--ouch! MESH_OBJ is written
in IDL so you may get some ideas from the source code.

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: a polygon version of polyline.. [message #41290 is a reply to message #41111] Sat, 02 October 2004 11:55 Go to previous messageGo to next message
Randall  Skelton is currently offline  Randall Skelton
Messages: 31
Registered: October 2004
Member
For those who want to see some other 'cool' plots, check out the
tecplot library.

http://www.tecplot.com/showcase/gallery/gallery_main.htm
Nice work on the tubes Rick!
Re: a polygon version of polyline.. [message #41333 is a reply to message #41290] Thu, 07 October 2004 20:50 Go to previous message
rdsheu is currently offline  rdsheu
Messages: 3
Registered: September 2004
Junior Member
Dear all,

I propose an alternative way(a little dirty..) for your information.
-_-||

Rendy
------------------------------------------------------------ ------
Pro tPipeline
; a test procedure for 3D pipeline (a dirty way)

NN = 20 ; color number
R = 0.50

thick0 = 5

t = findgen(361)*!DTOR*4.
x = R*cos(t)
y = R*sin(t)
z = -1 + findgen(361)/360.*2.

oLine1 = objarr(NN)

For i=0, NN-1 do $
oLine1[i] = obj_new('IDLgrPolyline', x, y, z, thick=1.+9./NN*i,
color=[255-I*10,20,20])

oLine2 = objarr(NN)
For i=0, NN-1 do $
oLine2[i] = obj_new('IDLgrPolyline', [0, 0], [0,0], [-1.5,1.5],
thick=1.+9./NN*i, color=[20,255-I*10,255-I*10])

oModel = obj_new('IDLgrModel')
oModel -> Add, oLine1
oModel -> Add, oLine2

xobjview, oModel

End
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Disable Virtual Machine
Next Topic: uniform expansion

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

Current Time: Wed Oct 08 19:43:41 PDT 2025

Total time taken to generate the page: 0.00399 seconds