MathGroup Archive 1999

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

Search the Archive

Re: Surfacecoloring of a sphere


Here is a way to do it.

(* Define a color generator *)
Remove[rgbColors]
rgbColors[n_]:=Table[RGBColor[1-x,0,x],{x,1/n,1,1/n}]

(* Now a function to display a colored sphere *)
colorSphere[r_,n_,m_]:=Module[{l1,l2},
  l1=Sphere[r,n,m];
  l2=rgbColors[Length[l1]];
  Show[Graphics3D[Transpose[{l2,l1}]],->False];
  ]

(*Finally, do it *)
colorSphere[5,10,10]

A couple of things to notice: Sphere just generates a list of polygons;
similarly, rgbColors generates a list of colors.  By interleaving them
with the Transpose operation, you now can display each polygon with a
different color.

Lighting->False is necessary to turn off the default lighting which will
obscure your own colors.

Kevin

-----Original Message-----
From: Florian Stock <stock at badbit.math2.nat.tu-bs.de> To:
mathgroup at smc.vnet.net
Subject: [mg15759] [mg15747] Surfacecoloring of a sphere


>Hello,
>
>for visualization of an Satellite, i want to color the surface of a
>sphere (for the colors I have a function color[long,att] with long and
>att in a  range from 0 to 2 Pi).
>How can i coloring the sphere?
>I've tried with SphericalPlot3D and the ColorFunction option, with
>ParametricPlot3D, but I didn't found a way to color it.
>
>Greetings
>
>Florian
>
>
>--
>"Alles was von Bedeutung ist, ist in Mathematik gegruendet.",
> Robert A. Heinlein`s "Sternenkrieger"
>
>



  • Prev by Date: Re: FindRoot question (number of variables)
  • Next by Date: Re: Finding real part (newbie question)
  • Previous by thread: Re: Surfacecoloring of a sphere
  • Next by thread: Bug with Find in 3.0.2