27.12.2012 Views

Wave Propagation in Linear Media | re-examined

Wave Propagation in Linear Media | re-examined

Wave Propagation in Linear Media | re-examined

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A.5 Utilities for display<strong>in</strong>g po<strong>in</strong>ts <strong>in</strong> 3D<br />

Disp3DList displays surfaces consist<strong>in</strong>g of th<strong>re</strong>e-dimensional po<strong>in</strong>ts by call<strong>in</strong>g the function<br />

ListSurfacePlot3D, which is part of the standard package Graphics`Graphics3D`.<br />

Disp3DContour generates a contour plot of the list of po<strong>in</strong>ts. In this case, the <strong>re</strong>gularity<br />

of the list is checked for the convenience of the user. The <strong>re</strong>ason is that the built-<strong>in</strong><br />

function ListContourPlot would simply not evaluate (without a warn<strong>in</strong>g) if the list<br />

passed to it was not <strong>re</strong>gular.<br />

Movie takes the surface and <strong>re</strong>turns cuts <strong>in</strong> parallel to the x-z plane by <strong>in</strong>c<strong>re</strong>as<strong>in</strong>g the<br />

y-coord<strong>in</strong>ate. If no special value for PlotRange is given, this option is set so as to cover<br />

the ext<strong>re</strong>ma, be<strong>in</strong>g <strong>in</strong>variant for all pictu<strong>re</strong>s. The user can override this default with<br />

another range. Note that <strong>in</strong> order to allow this, the user's options must be written<br />

befo<strong>re</strong> the default values <strong>in</strong> the call of the function ListPlot.<br />

(* Copyright: Copyright 1994, CAD-Div., IGEE, Vienna Univ. of Techn. *)<br />

(*:Version: Mathematica 2.2.1 *)<br />

(*:Title: 3DTools *)<br />

(*:Author: Thilo Sauter *)<br />

(*:Keywords: *)<br />

(*:Requi<strong>re</strong>ments: None. *)<br />

(*:Warn<strong>in</strong>gs: The Functions def<strong>in</strong>ed he<strong>re</strong><strong>in</strong> <strong>re</strong>qui<strong>re</strong> the 3D-Lists to<br />

lie on a <strong>re</strong>ctangular x/y grid *)<br />

(*:Summary: This package conta<strong>in</strong>s functions useful for manag<strong>in</strong>g and<br />

display<strong>in</strong>g lists of 3D po<strong>in</strong>ts. The <strong>re</strong>order<strong>in</strong>g function<br />

OrderGrid is based on the package ListToArray by Jason F.<br />

Harris.<br />

*)<br />

Beg<strong>in</strong>Package["Tools3D`","Graphics`Graphics3D`"]<br />

OrderGrid::usage =<br />

"Takes a list {{x1,y1,z1},{x2,y2,z2}...} and orders it to the<br />

two-dimensional form {{{x1,y11,z11},{x1,y12,z12},..},{{x2,y21,z21},..},..}<br />

of 3D-po<strong>in</strong>ts."<br />

ReSize::usage =<br />

"ReSize[list,n] keeps only every nth row and column of a two-dimensional<br />

list. ReSize[list,{m,n}] takes every mth row and nth column."<br />

L<strong>in</strong>k3DList::usage =<br />

"L<strong>in</strong>k3DList[Names,Output,(Path)] needs a list of filenames, a name for<br />

the output file and an optional path whe<strong>re</strong> to look for the files. The files<br />

must be a two-dimensional list of 3D-po<strong>in</strong>ts, the output file has the same<br />

form (generated by OrderGrid)."<br />

Disp3DList::usage =<br />

"Display a surface consist<strong>in</strong>g of po<strong>in</strong>ts {x,y,z} over a <strong>re</strong>ctangular<br />

x/y grid (two-dimensional list of 3D-po<strong>in</strong>ts)"<br />

Disp3DContour::usage =<br />

"Disp3DContour[list,(opts)] produces a contour plot of a list of po<strong>in</strong>ts {x,y,z}<br />

over a <strong>re</strong>ctangular and equidistant x/y grid (two-dimensional list of 3D-po<strong>in</strong>ts)"<br />

Movie::usage =<br />

"Movie[list,(opts)] produces an animation of a <strong>re</strong>ctangular list of po<strong>in</strong>ts<br />

{x,y,z} with {x,z}-Frames and <strong>in</strong>c<strong>re</strong>mented y-value"<br />

L<strong>in</strong>k3DList::fewlists = "At least two files needed";<br />

L<strong>in</strong>k3DList::<strong>re</strong>ggrid = "Warn<strong>in</strong>g: Grid not <strong>re</strong>gular!";<br />

Disp3DContour::<strong>re</strong>ggrid = "Grid not <strong>re</strong>gular!";<br />

Beg<strong>in</strong>["`Private`"]<br />

OrderGrid[a_List] := Module[{xvals,asort},<br />

asort = Sort[a];<br />

xvals = Union[Flatten[Cases[asort,{x_,y_,z_}->x]]];<br />

Map[Cases[asort,{#,y_,z_}]&, xvals]];<br />

TakeOther[l_List,n_] := Map[First[#]&,Partition[l,n]];<br />

ReSize[l_List,{n_,m_}] := TakeOther[Map[TakeOther[#,m]&,l],n];<br />

235

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!