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

Home » Public Forums » archive » Re: Draped Contours?
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: Draped Contours? [message #68970] Thu, 10 December 2009 10:23 Go to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Dec 10, 3:48 pm, mgalloy <mgal...@gmail.com> wrote:
> Like this?
>
> z = randomu(seed, 50, 50)
> for i = 0, 4 do z = smooth(z, 5, /edge_truncate)
>
> view = obj_new('IDLgrView')
>
> model = obj_new('IDLgrModel')
> view->add, model
>
> dem = obj_new('IDLgrSurface', z, style=2, color=[200, 200, 0],
> depth_offset=1)
> model->add, dem
>
> contours = obj_new('IDLgrContour', z, n_levels=15)
> model->add, contours
>
> lightModel = obj_new('IDLgrModel')
> view->add, lightModel
>
> light = obj_new('IDLgrLight', type=2, location=[-1, 1, 1])
> lightModel->add, light
>
> ambientLight = obj_new('IDLgrLight', type=0, intensity=0.4)
> lightModel->add, ambientLight
>
> dem->getProperty, xrange=xr, yrange=yr, zrange=zr
> xc = norm_coord(xr)
> xc[0] -= 0.5
> yc = norm_coord(yr)
> yc[0] -= 0.5
> zc = norm_coord(zr)
> zc[0] -= 0.5
> dem->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc
> contours->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc
>
> model->rotate, [1, 0, 0], -90
> model->rotate, [0, 1, 0], -30
> model->rotate, [1, 0, 0], 45
>
> clipboard = obj_new('IDLgrClipboard', dimensions=[400, 400])
> clipboard->draw, view, /postscript, /vector, filename='draped_surface.eps'
>
> win = obj_new('IDLgrWindow', dimensions=[400, 400], graphics_tree=view)
> win->draw
>
> end
>

A similar result could be obtained with

z = randomu(seed, 50, 50)
for i = 0, 4 do z = smooth(z, 5, /edge_truncate)
isurface,z
icontour,z,/over,planar=0,n_levels=15
isave,'draped_surface.eps'
Re: Draped Contours? [message #68972 is a reply to message #68970] Thu, 10 December 2009 09:59 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mike Galloy wites:

> Like this?

Humm. I don't have a PostScript printer, but my PostScript
viewer shows quite a bit of difference between what is
rendered there and what I see in the object graphics window.
Lots of contour lines appear to be dropped. Do you think
that is real? Or, I mean, a consequence of the object
graphics PostScript rendering? Do the lines reappear if
I actually print the file?

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: Draped Contours? [message #68973 is a reply to message #68972] Thu, 10 December 2009 09:48 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 12/10/09 10:06 AM, JD Smith wrote:
> On Dec 9, 5:40 pm, David Fanning<n...@dfanning.com> wrote:
>> JD Smith writes:
>>> I was playing with iSurface (shocking, I know), and found very useful
>>> the ability to "drape" contours interactively on top of the surface,
>>> similar to raised relief maps with contour lines. It occurs to me I
>>> have no idea how to do this; probably some object graphics thing.
>>> Does anyone have a short example of forming such a draped contour? I
>>> did consider using the SHADES keyword for shade_surf to color various
>>> levels black, but I prefer lighting-based shading, and (ideally)
>>> vector contours for output.
>>
>> Can you give us a picture of what you mean, or at least
>> describe what you did with iSurface? I have an example
>> of a contour plot cutting through a surface at any
>> level. I have a feeling that program can be easily
>> adapted if I had a better idea of what you had in mind.
>
> This PDF shows such an example, in Fig. 8:
>
> http://www.ittvis.com/portals/0/tutorials/idl/Contours_and_S urfaces.pdf
>
> Here's another example:
>
> http://tir.astro.utoledo.edu/idl/draped_contours.png
>
> I did notice that even when exporting to EPS, the contours are
> bitmaps, so my SHADES idea might be a reasonable analog. Creating
> contours and dropping each one individually to the appropriate height
> on top of the surface must be doable with object graphics, but it's
> not immediately obvious to me.
>
> Thanks.
>
>
> P.S. Any OSX/XQuartz users recognize this error?
>
> IDLITWINDOW::DOHITTEST: Failure to acquire window rendering context.
> error: xp_attach_gl_context returned: 2
>
> I get it off and on with iTools and must restart IDL.
>

Like this?

z = randomu(seed, 50, 50)
for i = 0, 4 do z = smooth(z, 5, /edge_truncate)

view = obj_new('IDLgrView')

model = obj_new('IDLgrModel')
view->add, model

dem = obj_new('IDLgrSurface', z, style=2, color=[200, 200, 0],
depth_offset=1)
model->add, dem

contours = obj_new('IDLgrContour', z, n_levels=15)
model->add, contours

lightModel = obj_new('IDLgrModel')
view->add, lightModel

light = obj_new('IDLgrLight', type=2, location=[-1, 1, 1])
lightModel->add, light

ambientLight = obj_new('IDLgrLight', type=0, intensity=0.4)
lightModel->add, ambientLight

dem->getProperty, xrange=xr, yrange=yr, zrange=zr
xc = norm_coord(xr)
xc[0] -= 0.5
yc = norm_coord(yr)
yc[0] -= 0.5
zc = norm_coord(zr)
zc[0] -= 0.5
dem->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc
contours->setProperty, xcoord_conv=xc, ycoord_conv=yc, zcoord_conv=zc

model->rotate, [1, 0, 0], -90
model->rotate, [0, 1, 0], -30
model->rotate, [1, 0, 0], 45

clipboard = obj_new('IDLgrClipboard', dimensions=[400, 400])
clipboard->draw, view, /postscript, /vector, filename='draped_surface.eps'

win = obj_new('IDLgrWindow', dimensions=[400, 400], graphics_tree=view)
win->draw

end

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
Re: Draped Contours? [message #68974 is a reply to message #68973] Thu, 10 December 2009 09:06 Go to previous messageGo to next message
JDS is currently offline  JDS
Messages: 94
Registered: March 2009
Member
On Dec 9, 5:40 pm, David Fanning <n...@dfanning.com> wrote:
> JD Smith writes:
>> I was playing with iSurface (shocking, I know), and found very useful
>> the ability to "drape" contours interactively on top of the surface,
>> similar to raised relief maps with contour lines.  It occurs to me I
>> have no idea how to do this; probably some object graphics thing.
>> Does anyone have a short example of forming such a draped contour?  I
>> did consider using the SHADES keyword for shade_surf to color various
>> levels black, but I prefer lighting-based shading, and (ideally)
>> vector contours for output.
>
> Can you give us a picture of what you mean, or at least
> describe what you did with iSurface? I have an example
> of a contour plot cutting through a surface at any
> level. I have a feeling that program can be easily
> adapted if I had a better idea of what you had in mind.

This PDF shows such an example, in Fig. 8:

http://www.ittvis.com/portals/0/tutorials/idl/Contours_and_S urfaces.pdf

Here's another example:

http://tir.astro.utoledo.edu/idl/draped_contours.png

I did notice that even when exporting to EPS, the contours are
bitmaps, so my SHADES idea might be a reasonable analog. Creating
contours and dropping each one individually to the appropriate height
on top of the surface must be doable with object graphics, but it's
not immediately obvious to me.

Thanks.


P.S. Any OSX/XQuartz users recognize this error?

IDLITWINDOW::DOHITTEST: Failure to acquire window rendering context.
error: xp_attach_gl_context returned: 2

I get it off and on with iTools and must restart IDL.
Re: Draped Contours? [message #68995 is a reply to message #68974] Wed, 09 December 2009 14:40 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
JD Smith writes:

> I was playing with iSurface (shocking, I know), and found very useful
> the ability to "drape" contours interactively on top of the surface,
> similar to raised relief maps with contour lines. It occurs to me I
> have no idea how to do this; probably some object graphics thing.
> Does anyone have a short example of forming such a draped contour? I
> did consider using the SHADES keyword for shade_surf to color various
> levels black, but I prefer lighting-based shading, and (ideally)
> vector contours for output.

Can you give us a picture of what you mean, or at least
describe what you did with iSurface? I have an example
of a contour plot cutting through a surface at any
level. I have a feeling that program can be easily
adapted if I had a better idea of what you had in mind.

http://www.dfanning.com/misc/surf_contour.pro

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Draped Contours? [message #69167 is a reply to message #68972] Thu, 10 December 2009 10:43 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 12/10/09 10:59 AM, David Fanning wrote:
> Humm. I don't have a PostScript printer, but my PostScript
> viewer shows quite a bit of difference between what is
> rendered there and what I see in the object graphics window.
> Lots of contour lines appear to be dropped. Do you think
> that is real? Or, I mean, a consequence of the object
> graphics PostScript rendering? Do the lines reappear if
> I actually print the file?

I think the DEPTH_OFFSET keyword I used to get rid of stitching effects
when rendered in the graphics window is not working quite right in the
PostScript output. I don't see anything in the online help warning about
this.

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
Re: Draped Contours? [message #69168 is a reply to message #68972] Thu, 10 December 2009 10:34 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Dec 10, 3:59 pm, David Fanning <n...@dfanning.com> wrote:
> Humm. I don't have a PostScript printer, but my PostScript
> viewer shows quite a bit of difference between what is
> rendered there and what I see in the object graphics window.
> Lots of contour lines appear to be dropped. Do you think
> that is real? Or, I mean, a consequence of the object
> graphics PostScript rendering? Do the lines reappear if
> I actually print the file?
>

That looks like the same bug on the ps driver I reported a year and a
half ago, that got the CR ID 51003. Sometimes when a vector eps is
made, some elements appear in the wrong orders, and get hidden by
others that should be behind them. Which is particularly annoying for
3D plots.
Re: Draped Contours? [message #69332 is a reply to message #68973] Tue, 05 January 2010 15:06 Go to previous message
JDS is currently offline  JDS
Messages: 94
Registered: March 2009
Member
Thanks, Mike, that looks like it. The postscript output is a bit
wonky, as others noted. Is the problem that the contours are at
precisely the same altitude as the shaded surface, so it can't decide
which is on top?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Reducing a set of curves to a mean curve
Next Topic: ITT VIS at the 90th AMS Annual Meeting

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

Current Time: Wed Oct 08 15:52:26 PDT 2025

Total time taken to generate the page: 0.00673 seconds