MathGroup Archive 2005

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

Search the Archive

Re: Light and surface colors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58717] Re: Light and surface colors
  • From: Daniele Lupo <danwolf_no_spam_please_ at libero.it>
  • Date: Fri, 15 Jul 2005 14:13:59 -0400 (EDT)
  • References: <db7nrj$ms5$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Il Fri, 15 Jul 2005 07:16:03 +0000 (UTC), David Park ha scritto:

> I tried to send you a Mathematica notebook with the code for this but your
> server rejected it because of a full mailbox.

This is because you must toggle _no_spam_please_...

> 
> To make a shaded plot with regular Mathematica graphics we could use
> ParametricPlot3D with the 4th argument in the parametrization. The 4th
> argument gives graphics directives for plotting the surface. We don't have
> to turn the Lighting off if we give SurfaceColor instead of a raw color.
> 
> We redefine the pressure for the parameters of the ellipsoid.
> 
> ellipsoid[a_, b_, c_][u_, v_] := {a Cos[v]Cos[u], b Cos[v]Sin[u], c Sin[v]}
> pressure[x_, y_, z_] := x^2 + y^2 + Sin[4z];
> pressure[u_, v_] =
>   pressure[x, y, z] /. Thread[{x, y, z} -> ellipsoid[7, 5, 4][u, v]]
> 49*Cos[u]^2*Cos[v]^2 + 25*Cos[v]^2*Sin[u]^2 + Sin[16*Sin[v]]
> 
> Then define the parametrization for the ellipsoid with the function on it.
> 
> ellipsoidfunction[a_, b_, c_][u_, v_] := {a Cos[v]Cos[u], b Cos[v]Sin[u],
>     c Sin[v], {EdgeForm[], SurfaceColor[Hue[pressure[u, v]/50]]}}

.... I must study better this code...

So, if I understood, you've created the color function with a
parametrization, using u, v instead of x, y, z, creating in this way
pressure[u_,v_], but I can't understand if this line

49*Cos[u]^2*Cos[v]^2 + 25*Cos[v]^2*Sin[u]^2 + Sin[16*Sin[v]]

is in the definition or if it's an Output. I think the sendond, right?
Because I can't understand why you use it in the definition of that
function...

And I did not know that I'm able to specify colors directives directly in
the ellipsoid function: I've used them always as graphic command options...
I think that this is the solution key for my problem, right? In this case,
I can specify colors in the function, instead that in the ParametricPlot3D
command, resolving the conflich between Ligthing and surface color in my
original problem

> 
> Then we can plot.
> 
> ParametricPlot3D[ellipsoidfunction[7, 5, 4][u, v], {u, 0, 2*Pi},
>    {v, -Pi/2, Pi/2},
>    PlotPoints -> 100,
>    ImageSize -> 450];

I think to understand your work. Thanks for you effort!!!

> 
> There are three problems with this plot. 1) The regular Mathematica lighting
> tends to interfer with the colors on the surface.
I think that creating light with GrayLevel can resolve this problem

> 2) The Hue color function
> is not easy to interpret. What is high pressure and what is low pressure? 

Yes, I know it, but this color was only a try. I'll find a better color
function....

> 3)
> It doesn't give a very accurate indication of what the shape of the contours
> are. They are not quite as regular as one might expect.

I know, but I am not be able to draw contour lines in the surface...

> 
> My second solution uses DrawGraphics (from my web site below). It trims a
> grid of polygons in the uv-plane to the contour regions and then maps the
> resulting grids to the ellipsoidal surface. It uses the TwoColorScale
> function to give a color scale that gives shades of blue for values below 25
> and shades of red for colors above 25. It is much easier to interpret
> two-color plots - they are similar to cartographic maps. The NeutralLighting
> option is used to turn down the color saturation of the regular lighting so
> it doesn't interfer with the surface colors.

I'll try it...

> 
> Needs["DrawGraphics`DrawingMaster`"]
> 
> colorfun =
>     TwoColorScale[{-0.29, 25, 49.7}, {ColorMix[RoyalBlue, Black][0.5],
>         RoyalBlue, ColorMix[RoyalBlue, White][0.8], ColorMix[Red,
> White][0.8],
>          Red, ColorMix[Red, Black][0.5]}];
>   
>   CUT
>
>    Background -> Linen,
>    ImageSize -> 450];

This seems good... Unfortunately, in these days I've two tests at
university, but I'll study your package when I can.

Thanks again


Daniele


  • Prev by Date: Re: Comparison of Mathematica on Various Computers
  • Next by Date: refining expression in terms of real numbers
  • Previous by thread: Re: Light and surface colors
  • Next by thread: Re: Light and surface colors