       Re: Combining different colored 3-D Plots

• To: mathgroup at smc.vnet.net
• Subject: [mg51639] Re: [mg51606] Combining different colored 3-D Plots
• From: "David Park" <djmp at earthlink.net>
• Date: Wed, 27 Oct 2004 23:42:46 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Charlie,

This is the type of graphics problem that the DrawGraphics package at my web
site below can be useful.

The following is an example of fitting two surfaces together and plotting
them in different colors. You have to use the SurfaceColor directive to
specify the color of each surface. (I often also use the EdgeForm directive
with a slightly darker shade of the color to give a subdued "mesh".) Since
DrawGraphics deals directly with the graphics primitives it is easy to
combind many directives and surfaces all in one plot statement.

One problem with the regular Mathematica lighting is that the lights are
very saturated and tend to overwhelm any nice colors used for the surfaces.
DrawGraphics has the NeutralLighting command that allows you to specify the
saturation, brightness and ambient lighting and also to rotate the lights if
desired. (It inserts a series of lighting options.) With this you can use
more pastel colors. This gives shaded surfaces. If you turn the Lighting off
and then just specify colors you lose the shading.

Here is a sample plot statement that fits two surfaces with different
colors.

Draw3DItems[
ParametricDraw3D[{Sin[2*\[Theta]], 2*Sin[\[Theta]]^2, 4*w*Sin[\[Theta]]^2},
{w, 0, 1}, {\[Theta], 0, Pi}, PlotPoints -> {9, 31}],

SurfaceColor[Goldenrod],
ParametricDraw3D[{w*Sin[2*\[Theta]], 2*w*Sin[\[Theta]]^2,
4*w^2*Sin[\[Theta]]^2}, {w, 0, 1}, {\[Theta], 0, Pi},
PlotPoints -> {15, 31}]},

NeutralLighting[0.3, 0.7, 0.],
PlotRange -> {{-1, 1}, {0, 2}, {0, 4}},
Background -> Wheat,
ViewPoint -> {3, -2, 3},
ImageSize -> {300, 500}*0.7];

The DrawGraphics Help has numerous examples of drawing 3D surfaces. The
IteraterSubstitution command also allows you to fit surfaces with curved
edges together. It effectively allows the second iterator limits to depend
upon the value of the first iterator.

David Park

From: charlie rosenthal [mailto:c.e.rosenthal at cox.net]
To: mathgroup at smc.vnet.net

Greetings,

I have been using Mathematica to render a 3-D model which is made up of
several different shapes plotted individulally and then combined. I
would like to have each piece displayed in the combined plot with its
own color. This should be straight forward ... any ideas on how this
might be done.

Thanks,
Charlie

```

• Prev by Date: Re: Fitting question
• Next by Date: orthogonal 4d rotational matrices in Mathematica
• Previous by thread: Re: Combining different colored 3-D Plots
• Next by thread: Creating a Moving Average Function