MathGroup Archive 2003

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

Search the Archive

RE: Coloring a surface

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39128] RE: [mg39083] Coloring a surface
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Thu, 30 Jan 2003 01:06:48 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

>-----Original Message-----
>From: Jean.Pellegri at wanadoo.fr [mailto:Jean.Pellegri at wanadoo.fr]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, January 29, 2003 9:35 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg39128] [mg39083] Coloring a surface
>
>
>I want plot and color a surface x=f(u,v), y=g(u,v), z=h(u,v) 
>
> How to create a color function colorfunc[x,y,z] (or colorfunc[u,v])
>that associate a color at each point of the surface ??
>
>Thanks 
>
>Scuse for my very bad english language !! 
>
>Jean P.
>

A few examples might help:

ParametricPlot3D[
  Evaluate[With[{r = Sqrt[Sin[u]], s = Hue[Mod[2 v/Pi, 1]]}, {u, r Cos[v], 
        r Sin[v], s}]], {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, 
  PlotPoints -> {25, 25}, Lighting -> False]

...coloring according to angle v


ParametricPlot3D[
  Evaluate[With[{r = Sqrt[Sin[u] + 1/2 Sin[3u]], s = Hue[u/Pi]}, {u, r
Cos[v],
         r Sin[v], {EdgeForm[], s}}]], {u, 0, Pi}, {v, 0, 2Pi}, 
  BoxRatios -> {1, 1, 1}, PlotPoints -> {50, 25}, Lighting -> False]

...coloring according to height u


ParametricPlot3D[
  Evaluate[With[{r = Sqrt[Sin[u] + 1/4 Sin[3u] + 1/3 Sin[7 u]]}, {u, r
Cos[v],
         r Sin[v], {EdgeForm[], Hue[1 - r]}}]], {u, 0, Pi}, {v, 0, 2Pi}, 
  BoxRatios -> {1, 1, 1}, PlotPoints -> {125, 50}, Lighting -> False, 
  ViewPoint -> {2., -2.4, 2.}]

...coloring according to radius


ParametricPlot3D[
  Evaluate[With[{r = Sqrt[Sin[u] + 1/4 Sin[3u]]}, {x = u, y = r Cos[v], 
        z = r Sin[v], {EdgeForm[], 
          Hue[{x, y, z}. (ViewPoint /. Options[Graphics3D, ViewPoint])]}}]],

        {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, 
  PlotPoints -> 100{2, 1}, Lighting -> False]

...coloring according to depth from viewpoint


ParametricPlot3D[
  Evaluate[With[{r = Sqrt[Sin[u] + 1/4 Sin[3u]]}, {x = u, y = r Cos[v], 
        z = r Sin[v], {EdgeForm[], 
          FaceForm[GrayLevel[0], GrayLevel[Mod[3 {x, y, z}. {0, 1, 2},
1]]]}}]], 
        {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, 
  PlotPoints -> 100{2, 1}, Lighting -> False]

...coloring according to some direction (takes for a while)

As you see, results are best if coloring is done as function of u or v
alone. So perhaps you might like to transform your parameter space first! 

--
Hartmut Wolf



  • Prev by Date: RE: Re: mathematica on a palmtop?
  • Next by Date: Re: domain for sum of geometric series
  • Previous by thread: Re: Coloring a surface
  • Next by thread: Re: Coloring a surface