An object graphics problem [message #36023] |
Mon, 11 August 2003 03:53  |
grl
Messages: 5 Registered: August 2003
|
Junior Member |
|
|
Hi IDL Experts
I'm new to IDL programming and am stuck. My problem is this:
I have a (360, 18) array of numbers which I can wrap around a sphere
to display them with 360 cells of longitude and 18 cells of latitude.
I do this by using a spherical mesh_grid and wrap that around an
IDLgrPolygon object using the original array as vert_colors having
converted it to bytscl. This works fine. Then I draw a vector that
starts at the sphere's centre and exits the sphere through one of the
mesh_grid cells. I do this using IDLgrPolyline centered on [0,0,0] and
make it long enough to come through the sphere. This also works fine.
Now I want to cut the sphere with a plane that is perpendicular to the
vector and goes through the spheres centre and then be able to look
down the vector and see the data around the edge of the newly cut
sphere. Eventually there will be other spheres within the original, 60
of them in fact, so that eventually, I will be able to see 60
concentric circles about the vector that are colored according to the
original array. Any ideas?
Thanks, Gethyn Lewis
|
|
|
Re: An object graphics problem [message #36181 is a reply to message #36023] |
Wed, 13 August 2003 09:24  |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
"Gethyn Lewis" <grl@mssl.ucl.ac.uk> wrote in message
news:b2007222.0308130352.25f9283e@posting.google.com...
> Thanks for these tips. I've tried the mesh_clip method and that seems
> to do exactly what I want, but I can't find any reference to the
> clip_planes keyword/function. I'm running IDL 5.5, is this a new part
> of IDL 5.6 ?
Exactly. Sorry, the code in my other posting won't work for you! :-(
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|
|
|
Re: An object graphics problem [message #36183 is a reply to message #36023] |
Wed, 13 August 2003 04:52  |
grl
Messages: 5 Registered: August 2003
|
Junior Member |
|
|
Thanks for these tips. I've tried the mesh_clip method and that seems
to do exactly what I want, but I can't find any reference to the
clip_planes keyword/function. I'm running IDL 5.5, is this a new part
of IDL 5.6 ?
Gethyn
|
|
|
Re: An object graphics problem [message #36208 is a reply to message #36023] |
Mon, 11 August 2003 12:50  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"Rick Towler" <rtowler@u.washington.edu> wrote in message
news:bh8n7n$1doo$1@nntp6.u.washington.edu...
>
> "Karl Schultz" wrote in message...
>>
>> "Gethyn Lewis" wrote in message...
>
>>> Now I want to cut the sphere with a plane that is perpendicular
>>> to the vector and goes through the spheres centre and then
>>> be able to look down the vector and see the data around the
>>> edge of the newly cut sphere. Any ideas?
>>
>> You may want to take a look at the CLIP_PLANES property.
>> It will be very easy to position a clipping plane at your
>> origin and orient it as you describe. You can use this
>> plane to clip the "front" half of the spheres and then you'll
>> see the concentric half-spheres nested behind the clip plane.
>> This might give you what you want if you want filled rings or
>> bands. If you want really narrow rings, then maybe a second
>> clip plane located a bit behind the front plane that clips
>> almost the entire back half of the spheres might work.
>
> If you are not going to be changing your clipping plane regularly you can
> also use MESH_CLIP() on your spheres in a manner similar to Karl's
> CLIP_PLANES method.
>
> It will be a bit of a toss up. The MESH_CLIP approach will take a bit
> longer to build the objects to display but will probably draw faster than
> the CLIP_PLANES method. If you are going to be changing your clipping
plane
> while you interact with the objects then the CLIP_PLANES method would be
> better since you wouldn't need to manage the vertex and connectivity data
at
> all.
More on the differences between the two approaches:
CLIP_PLANES clips the graphics as they are drawn to the display, while
MESH_CLIP gives you a new set of vertices and connectivity that you then
place in a graphic object. As Rick points out, you'll have to decide if you
want to do the extra work of creating clipped geometry and sticking it into
an object.
With MESH_CLIP, be sure to include your vertex colors with the AUXDATA
keywords. The clipping operation will generate new vertices and they'll
need colors too. MESH_CLIP will interpolate the vertex colors on either
side of the clipping plane to determine the colors of the new vertices.
This will work fine for RGB vertex colors. If you are using indexed vertex
colors, then this will work only as long a your palette is "smooth". If you
have discrete colors such that a color index "somewhere in between" two
color indices won't give you a reasonable color, then it won't work.
Using CLIP_PLANES will be easier to program, but may not draw as quickly, as
Rick said. It will depend a lot on how many spheres you have and how fast
your machine and graphics card are.
Karl
|
|
|
Re: An object graphics problem [message #36211 is a reply to message #36023] |
Mon, 11 August 2003 11:27  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
"Karl Schultz" wrote in message...
>
> "Gethyn Lewis" wrote in message...
>> Now I want to cut the sphere with a plane that is perpendicular
>> to the vector and goes through the spheres centre and then
>> be able to look down the vector and see the data around the
>> edge of the newly cut sphere. Any ideas?
>
> You may want to take a look at the CLIP_PLANES property.
> It will be very easy to position a clipping plane at your
> origin and orient it as you describe. You can use this
> plane to clip the "front" half of the spheres and then you'll
> see the concentric half-spheres nested behind the clip plane.
> This might give you what you want if you want filled rings or
> bands. If you want really narrow rings, then maybe a second
> clip plane located a bit behind the front plane that clips
> almost the entire back half of the spheres might work.
If you are not going to be changing your clipping plane regularly you can
also use MESH_CLIP() on your spheres in a manner similar to Karl's
CLIP_PLANES method.
It will be a bit of a toss up. The MESH_CLIP approach will take a bit
longer to build the objects to display but will probably draw faster than
the CLIP_PLANES method. If you are going to be changing your clipping plane
while you interact with the objects then the CLIP_PLANES method would be
better since you wouldn't need to manage the vertex and connectivity data at
all.
-Rick
|
|
|
Re: An object graphics problem [message #36213 is a reply to message #36023] |
Mon, 11 August 2003 10:49  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"Gethyn Lewis" <grl@mssl.ucl.ac.uk> wrote in message
news:b2007222.0308110253.46f57d7d@posting.google.com...
> Hi IDL Experts
> I'm new to IDL programming and am stuck. My problem is this:
> I have a (360, 18) array of numbers which I can wrap around a sphere
> to display them with 360 cells of longitude and 18 cells of latitude.
> I do this by using a spherical mesh_grid and wrap that around an
> IDLgrPolygon object using the original array as vert_colors having
> converted it to bytscl. This works fine. Then I draw a vector that
> starts at the sphere's centre and exits the sphere through one of the
> mesh_grid cells. I do this using IDLgrPolyline centered on [0,0,0] and
> make it long enough to come through the sphere. This also works fine.
> Now I want to cut the sphere with a plane that is perpendicular to the
> vector and goes through the spheres centre and then be able to look
> down the vector and see the data around the edge of the newly cut
> sphere. Eventually there will be other spheres within the original, 60
> of them in fact, so that eventually, I will be able to see 60
> concentric circles about the vector that are colored according to the
> original array. Any ideas?
You may want to take a look at the CLIP_PLANES property. It will be very
easy to position a clipping plane at your origin and orient it as you
describe. You can use this plane to clip the "front" half of the spheres
and then you'll see the concentric half-spheres nested behind the clip
plane. This might give you what you want if you want filled rings or bands.
If you want really narrow rings, then maybe a second clip plane located a
bit behind the front plane that clips almost the entire back half of the
spheres might work.
|
|
|