MathGroup Archive 2005

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

Search the Archive

Re: ContourPlot3D and mapping


homh at momentum.chem.queensu.ca wrote:
> I have a surface that is described by a function f[x,y,x] = C. I need to
> map the values of another function g[x,y,z] on this surface, probably by
> some kind of color scheme. It is something like giving "texture" to
> an isovalue surface.

Consider the 3D contour plot generated by:

graph = ContourPlot3D[x^2 + y^2 + z^2 - 1, {x, -2, 2}, {y, -2, 2}, {z, -2,
2}, PlotPoints -> 6];

The following function replaces all polygons in "g" with colored polygons
using a color "f":

ReColor[f_, g_] := 
  g[[1]] /. 
    Polygon[p_] :> Block[{r = Mean[p]}, {f[r], Polygon[p]}]

This example coloring function "f" can be applied to our example contour
plot:

f[{x_, y_, z_}] := RGBColor[(x + 1)/2, (y + 1)/2, (z + 1)/2]

The result can be rendered using:

Show[Graphics3D[ReColor[f, graph]], Lighting -> False]

-- 
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com


  • Prev by Date: Re: InitializationCell
  • Next by Date: MemoryInUse[] differs from System report
  • Previous by thread: ContourPlot3D and mapping
  • Next by thread: Re: ContourPlot3D and mapping