Re: impossible?: overlaying lineplots on surface-plots [message #23372 is a reply to message #23371] |
Sun, 14 January 2001 08:45  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Harald von der Osten-Woldenburg (hvdosten@lb.netic.de) writes:
>
> with oplot I tried to sketch some paths where only (x,y) coordinates are
> available on a digtal elevation plot (based on the same (x,y)
> coordinates) created by shade_surf. The results are not satisfying:
> first of all, the stretching factors in x and y are obviously different
> from the factors used by shade_surf (there is only one create_view in
> the program, I thought this should fit to all lines following?). But I
> am wondering if it would be possible to sketch the lines directly on the
> surface plot, as it is possible with SURFER from Golden Software, for
> example?
>
> Thank you for each tip also for those like: "crazy man, you try to make
> impossiblilities possible".... ;-)
Well, this one is definitely not impossible. But not
especially easy either. :-)
I've never used Create_View to set up the 3D transformation
matrix. I usually use SCALE3 or the SURFACE command itself.
But in any case, the character sizes used for the SURFACE
command and for the OPLOT command inside the Z-buffer
(where you are going to do this) are not quite the same.
(At least they didn't used to be. I haven't checked this
in IDL 5.4.) This means that if you allow IDL to
choose the margins of the plot, you can have problems aligning
your OPLOT coordinates with your surface plot. To get around
this problem I set the CHARSIZE keyword on *every* graphics
command.
So, here is how I would do something like this.
(1) Do it in the Z-buffer. This takes care of hidden
line and surface removal for you automatically. This is
almost always want you want, but you have to be a bit
careful. If your line and the surface are co-incident,
then your line will look "patchy". The problem is that
round-off in the Z-buffer will sometimes place
the surface in front of the line, and sometimes the
line in front of the surface. Usually, you have to
"fudge" the line a bit to get it slightly off the
surface, so it can be displayed properly. Don't worry,
you are doing "visualization" here, not science. :-)
(2) Use the SURFACE command to create the T3D matrix.
Use the SAVE keyword to save the matrix for the next
OPLOT command. Set CHARSIZE=1.0.
(3) Use the OPLOT command to draw the line. (To tell
you the truth, I've never used OPLOT in this case.
I always use PLOTS, but I can't think of a good reason
OPLOT wouldn't work. The SURFACE command should set
the proper system variables. But if it doesn't for
some reason, try PLOTS.) Be sure you set the T3D
keyword, and you might have to supply a Z value to
put the line where you want it. Set CHARSIZE=1.0.
(4) Take a snapshot of the Z-buffer and display the
result on your display. It should be perfect.
Well, probably after 10-12 iterations it should be
perfect. But you get the idea. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|