1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>6.5 A 3-D illuminated surface in black and white</TITLE>
<META NAME="description" CONTENT="6.5 A 3-D illuminated surface in black and white">
<META NAME="keywords" CONTENT="GMT_Docs">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="GMT_Docs.css">
<LINK REL="next" HREF="node79.html">
<LINK REL="previous" HREF="node77.html">
<LINK REL="up" HREF="node73.html">
<LINK REL="next" HREF="node79.html">
</HEAD>
<BODY bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html2122"
HREF="node79.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A>
<A NAME="tex2html2116"
HREF="node73.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A>
<A NAME="tex2html2110"
HREF="node77.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A>
<A NAME="tex2html2118"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A>
<A NAME="tex2html2120"
HREF="node149.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html2123"
HREF="node79.html">6.6 Plotting of histograms</A>
<B> Up:</B> <A NAME="tex2html2117"
HREF="node73.html">6. Cook-book</A>
<B> Previous:</B> <A NAME="tex2html2111"
HREF="node77.html">6.4 A 3-D perspective</A>
  <B> <A NAME="tex2html2119"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html2121"
HREF="node149.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION001450000000000000000"></A>
<A NAME="10527"></A>
<BR>
6.5 A 3-D illuminated surface in black and white
</H1>
<P>
Instead of a mesh plot we may choose to show 3-D surfaces using
artificial illumination. For this example we will use
<A NAME="tex2html388"
HREF="../grdmath.html"><I><B>grdmath</B></I></A><A NAME="10537"></A> to make a grdfile that contains the surface given
by the function <!-- MATH
$z(x, y) = \cos (2\pi r/8)\cdot e^{-r/10}$
-->
<IMG
WIDTH="183" HEIGHT="37" ALIGN="MIDDLE" BORDER="0"
SRC="img102.gif"
ALT="$z(x, y) = \cos (2\pi r/8)\cdot e^{-r/10}$">, where
<!-- MATH
$r^2 = (x^2 + y^2)$
-->
<IMG
WIDTH="94" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
SRC="img103.gif"
ALT="$r^2 = (x^2 + y^2)$">. The illumination is obtained by passing
two grdfiles to <A NAME="tex2html389"
HREF="../grdview.html"><I><B>grdview</B></I></A><A NAME="10546"></A>: One with the <I>z</I>-values
(the surface) and another with intensity values (which should
be in the <IMG
WIDTH="16" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
SRC="img53.gif"
ALT="$\pm$">1 range). We use <A NAME="tex2html390"
HREF="../grdgradient.html"><I><B>grdgradient</B></I></A><A NAME="10555"></A> to compute
the horizontal gradients in the direction of the artificial
light source. The <U>gray.cpt</U> file only has one line that states
that all <I>z</I> values should have the gray level 128. Thus,
variations in shade are entirely due to variations in gradients,
or illuminations. We choose to illuminate from the SW and view
the surface from SE:
<P>
<P>
<BR>
<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>
grdmath -R-15/15/-15/15 -I0.3 X Y HYPOT DUP 2 MUL PI MUL 8 DIV COS EXCH NEG 10 DIV EXP MUL \
= sombrero.grd
echo '-5 128 5 128' >! gray.cpt
grdgradient sombrero.grd -A225 -Gintensity.grd -Nt0.75
grdview sombrero.grd -JX6i -JZ2i -B5/5/0.5SEwnZ -N-1/255/255/255 -Qs -Iintensity.grd -X1.5i -K \
-Cgray.cpt -R-15/15/-15/15/-1/1 -E120/30 -U/-1.25i/-0.75i/"Example 5 in Cookbook" >! example_05.ps
echo "4.1 5.5 50 0 33 2 z(r) = cos (2@~p@~r/8) * e@+-r/10@+" | pstext -R0/11/0/8.5 -Jx1i -O \
>> example_05.ps
\rm -f gray.cpt sombrero.grd intensity.grd .gmtcommands
</PRE>
<P>
<BR>
<BR>
<P>
<BR CLEAR="ALL">
<HR>
<P>
The variations in intensity could be made more dramatic by
using <A NAME="tex2html391"
HREF="../grdmath.html"><I><B>grdmath</B></I></A><A NAME="10617"></A> to scale the intensity file before
running <A NAME="tex2html392"
HREF="../grdview.html"><I><B>grdview</B></I></A><A NAME="10626"></A>. For very rough data sets one may
improve the smoothness of the intensities by passing the
output of <A NAME="tex2html393"
HREF="../grdgradient.html"><I><B>grdgradient</B></I></A><A NAME="10635"></A> to <A NAME="tex2html394"
HREF="../grdhisteq.html"><I><B>grdhisteq</B></I></A><A NAME="10644"></A>. The
shell-script above will result in a plot like the one in
Figure <A HREF="node78.html#fig:GMT_example_05">6.5</A>.
<P></P>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_05"></A><A NAME="10653"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 6.5:</STRONG>
3-D illuminated surface</CAPTION>
<TR><TD><IMG
WIDTH="500" HEIGHT="358" BORDER="0"
SRC="img104.gif"
ALT="\begin{figure}\centering\epsfig{figure=eps/GMT_example_05.eps}\end{figure}"></TD></TR>
</TABLE>
</DIV><P></P>
<P>
<A NAME="10606"></A>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html2122"
HREF="node79.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A>
<A NAME="tex2html2116"
HREF="node73.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A>
<A NAME="tex2html2110"
HREF="node77.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A>
<A NAME="tex2html2118"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A>
<A NAME="tex2html2120"
HREF="node149.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html2123"
HREF="node79.html">6.6 Plotting of histograms</A>
<B> Up:</B> <A NAME="tex2html2117"
HREF="node73.html">6. Cook-book</A>
<B> Previous:</B> <A NAME="tex2html2111"
HREF="node77.html">6.4 A 3-D perspective</A>
  <B> <A NAME="tex2html2119"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html2121"
HREF="node149.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2001-04-18
</ADDRESS>
</BODY>
</HTML>
|