画图代码如下:
%Author: Marco Miani
%LuaLaTeX / pdfLaTeX
\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{verbatim}
%\usepackage[active,tightpage]{preview}
%\PreviewEnvironment{tikzpicture}
%\setlength\PreviewBorder{5pt}
\usepackage{amsmath}
\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage{pgfplots}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}
\usetikzlibrary{positioning}
\begin{comment}
:Title: Spherical and cartesian grids
Representation of spherical (red) and cartesian (black) computational grids used
by SWAN_. Latter gives an example of unstructured grids. Conversion from former
to latter involves a deformation factor which is acceptable within a given spatial limit.
The drawing is based on Tomas M. Trzeciak's
`Stereographic and cylindrical map projections example`__.
.. __: http://www.texample.net/tikz/examples/map-projections/
.. _SWAN: http://www.texample.net/tikz/examples/swan-wave-model/
\end{comment}
\newcommand\pgfmathsinandcos[3]{
\pgfmathsetmacro#1{sin(#3)}
\pgfmathsetmacro#2{cos(#3)}
}
\newcommand\LongitudePlane[3][current plane]{
\pgfmathsinandcos\sinEl\cosEl{#2}
\pgfmathsinandcos\sint\cost{#3}
\tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{
\pgfmathsinandcos\sinEl\cosEl{#2}
\pgfmathsinandcos\sint\cost{#3}
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}}
}
\newcommand\DrawLongitudeCircle[2][1]{
\LongitudePlane{\angEl}{#2}
\tikz