MathGroup Archive 2001

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

Search the Archive

Re: Function Coloring with ParametricPlot3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31277] Re: [mg31264] Function Coloring with ParametricPlot3D
  • From: Christopher Purcell <purcell at drea.dnd.ca>
  • Date: Fri, 26 Oct 2001 04:28:19 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

The best way I have found to make well controlled smooth shaded images 
of geometric objects
is to use the GLExplorer package, which provides full access to OpenGL. 
Unfortunately, the
distributor appears to have lost interest in this superb product and 
their website says they no longer sell it.
This example makes a nicely color shaded rectangle. I subdivide my 
surfaces into quadrilateral patches (like ParametricPlot3D)
and apply a routine based on this method to each quad. It works better 
than any of the built-in tools for tasks like showing
the values of calculated or modelled physical parameters over surfaces.

In[4]:=
Needs["GLExplorer`GLRenderer`"] ;

poly= {{0,0,0},{1,0,0},{1,1,1},{0,1,1}};

  GLShow[GLGraphics[
Polygon[poly,ShadeModel->Smooth,
Colors->Table[Hue[poly[[i,3]]/3],
{i,1,Length[poly]}]],Lighting->False],
Window->If[Length[glMWindows[]]>0,
First[glMWindows[]],Automatic]];

This procedure did not handle polygons with more than 4 sides as nicely, 
and I don't understand why.

**************************************************************************
******
On Tuesday, October 23, 2001, at 10:59 PM, David Park wrote:

> Dear MathGroup,
>
> There is a percularity of the ParametricPlot3D command with color
> specification as the fourth element that bugs me.
>
> It appears that this is the way that the algorithm works. Mathematica
> calculates the color that would result from the four corners of the 
> square
> and then blends the colors. I suppose that in some sense this can be
> considered to be reasonable. But if you write a color function that
> specifices a specific set of colors, this blending introduces new colors
> which one may not want. Here is an example.
>
> Needs["Graphics`Colors`"]
>
> cfun[x_, y_] :=
>  Module[{val = Sqrt[x^2 + y^2]},
>   Which[
>   val <= 7, PaleGreen,
>   val > 7, OrangeRed]]
>
> ParametricPlot3D[{x, y, 0, cfun[x, y]}, {x, 0, 10}, {y, 0, 10},
>  PlotPoints -> 8,
>  Lighting -> False];
>
> What I would like to do is have Mathematica determine a single function
> value for each square, perhaps by averaging the values at the four 
> corners,
> and then apply my color function to that single value. In that case 
> there
> would be no blending, unless I decide to do the blending in my color
> function.
>
> Does anyone know how to work around this?
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
>
>
>



  • Prev by Date: Hints for printing on non-PS printer, and pasting into Word
  • Next by Date: Re: Function Coloring with ParametricPlot3D
  • Previous by thread: Re: Function Coloring with ParametricPlot3D
  • Next by thread: Re: Function Coloring with ParametricPlot3D