Re: ContourPlot3D and mapping
- To: mathgroup at smc.vnet.net
- Subject: [mg55079] Re: ContourPlot3D and mapping
- From: Jon Harrop <usenet at jdh30.plus.com>
- Date: Fri, 11 Mar 2005 04:21:10 -0500 (EST)
- References: <d0p8ch$j8c$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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