MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: 3D Electric Field Approximation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38176] RE: [mg38145] 3D Electric Field Approximation
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 4 Dec 2002 03:25:38 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Leonardo,

Here I make a sample function to show how you might do it.

f[x_, y_, z_] := Abs[Sin[x]Cos[y]Sin[z]];

The following creates a sample set of data.

data = Flatten[Table[{f[x, y, z], {x, y, z}}, {x, 0, Pi/2, Pi/20},
     {y, 0, Pi/2, Pi/20}, {z, 0, Pi/2, Pi/20}], 2];

Now we create a set of plotting points by transforming each data point.

plotpoints = data /. {f_, pos : {_, _, _}} -> {Hue[f/1.5], Point[pos]};

In our data, f goes from 0 to 1. I made the Hue go to less than 1 because 1
looks almost like 0 and doesn't distinguish. For your actual function you
would have to design a more sophisticated color function. Here is a sample
plot point...

Part[plotpoints, 654]
{Hue[0.2241661706546524], Point[{Pi/4, Pi/5, Pi/5}]}

Now, the plot is easy...

plot1 =
  Show[Graphics3D[
      {plotpoints}],
    BoxStyle -> GrayLevel[0.7],
    ImageSize -> 500]

You can get a better picture by spinning it around

Needs["Graphics`Animation`"]

SpinShow[plot1]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.01];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime ->
0.25,
      AnimationDirection -> Forward]}]

The whole thing looks perfectly awful!! It is very difficult to make a good
3D density plot. The problem is that the points get in each other's way.
Another effect makes things even worse. The ordered points create various
patterns, depending upon the particular viewpoint. These patterns have
nothing to do with the function or data that you are trying to show, but
only with the arrangement of data points. Even if the points are randomly
placed, you will still obtain various spatial patterns. It is what Edward
Tufte calls the 1+1=3 effect in graphics. The various elements combine to
produce unintended visual elements that grab the viewers attention at the
expense of the real information.

So, is there a better approach? A lot depends upon the nature of your
function or data, and also on what aspect of the function you are trying to
emphasize. You could, for example, do 2D contour plots for various slices of
the room. You could also try cut-a-way plots of various level surfaces in
3D. A multiple combination of images may best show whatever it is you are
trying to show.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Leonardo [mailto:cmarj at rla01.pucpr.br]
To: mathgroup at smc.vnet.net

I have measured the absolute value of the electric field in several
points of a room.

I would like to make a 3D plot of the room, showing each one of the
points measured. Each point should be accompanied by its electric
field value or, preferably, by a color associated with the value.

After that, I wanted to make a 3D interpolation of those points to
obtain a colorful plot that showed how the electric field varies along
that room (a 3D density plot).

Any ideas are welcome, even if you don't know how to solve the whole
problem!

Thank you!



  • Prev by Date: Re: Efficient Sorting Algorithm
  • Next by Date: Levemberg
  • Previous by thread: Re: 3D Electric Field Approximation
  • Next by thread: Numerical Integration in Two Dimensions