Re: Draped Contours? [message #68970] |
Thu, 10 December 2009 10:23  |
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 #68973 is a reply to message #68972] |
Thu, 10 December 2009 09:48   |
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   |
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   |
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 #69332 is a reply to message #68973] |
Tue, 05 January 2010 15:06  |
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?
|
|
|