MathGroup Archive 2005

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

Search the Archive

Re: ContourPlot3D and mapping


Jon Harrop <usenet at jdh30.plus.com> wrote:
> 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

Hi,

I tried the above code with the following added

Needs["Graphics`ContourPlot3D`"];
<< Graphics`Graphics3D`;

and got the error message:

Graphics3D::"gprim":
f[Mean[{{-0.7250000000000001`, -\[LeftSkeleton] 19 \[RightSkeleton], 
-0.3999999999999999`, \[LeftSkeleton] 2 \[RightSkeleton]} was 
encountered where a Graphics3D  primitive or directive was expected."

Any idea ?

Minhhuy


  • Prev by Date: Re: how to set a global assumption setting Every Varaible I use is Real?
  • Next by Date: Re: Map, List
  • Previous by thread: Re: ContourPlot3D and mapping
  • Next by thread: Re: ContourPlot3D and mapping