MathGroup Archive 2002

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

Search the Archive

RE: Re: ColorFunction TriangularSurfacePlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35440] RE: [mg35406] Re: ColorFunction TriangularSurfacePlot
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Fri, 12 Jul 2002 04:29:07 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

It's a small change, but this seems more natural:

coords = Table[{
    x = Random[]; 
      y = Random[]; z = Random[]; GrayLevel[z], Polygon[{{x, y, 
        z}, {x + .2, y, z}, {x + .1, y + .2, z}}]}, {i, 1, 10}];
Show[Graphics3D[coords], Lighting -> False, PlotRange -> {{0, 1.2}, {
            0, 1.2}, {0, 1}}];

or

pt := Random[] & /@ Range[3];
coords = Table[{{x, y, z} = pt;
 GrayLevel[z], 
    Polygon[{{x, y, z}, {x + .2, y, z}, {x + .1, y + .2, z}}]}, {i, 1,
10}];
Show[Graphics3D[coords], Lighting -> False, PlotRange -> {{0, 1.2}, {0, 
            1.2}, {0, 1}}];

or better yet:

pt := Random[] & /@ Range[3];
dx = {1, 0, 0}; dy = {0, 1, 0};
triangle = {GrayLevel@Last@#, Polygon[{#, # + 0.2dx, # + 0.1dx +
0.2dy}]} &;
Show[Graphics3D[Table[triangle@pt, {i, 1, 10}]], Lighting -> 
          False, PlotRange -> {{0, 1.2}, {0, 1.2}, {0, 1}}];

In the original version, you're creating a matrix with 5 columns, just
to throw away the first three columns.  You don't have to create those
columns in the first place.

Bobby

-----Original Message-----
From: ng [mailto:georgakopoulos at mindspring.com] 
To: mathgroup at smc.vnet.net
Subject: [mg35440] [mg35406] Re: ColorFunction TriangularSurfacePlot

Try this. The Table[] creates ten triangles at random heights z (and the
postfix [[{4,5}]] discards the x,y, and z values) that are drawn using
Polygon[]. Each triangle is preceded by a specification of graylevel.
Then Show[Graphics3D[ ]]  shows them all in a 1x1x1 box.

coords = Table[{x = Random[], y = Random[], z = Random[], GrayLevel[z],
        Polygon[{{x, y, z}, {x + .2, y, z}, {x + .1, y + .2, z}}]}[[{4,
        5}]], {i, 1, 10}];
Show[Graphics3D[coords], Lighting -> False,
  PlotRange -> {{0, 1.2}, {0, 1.2}, {0, 1}}];

"Boris Fain" <bfain at stanford.edu> wrote in message
news:aggkjf$ik$1 at smc.vnet.net...
> Hi. I am a complete newbie, and I am making surface plots out of sets
> of points in 3-D. I am using TriangleSurfacePlot - a wonderful
function
> btw, I gladly junked my own triangulation codes! However, I simply
need
> to color the polygons according to their height - or the height of,
> say, the lowest vertex. Actually, any vertex would be just fine. Is
> there a way to do this?
>
> thanks, boris.
>
>







  • Prev by Date: RE: White border in plots
  • Next by Date: Re: Memory conserving Input of big Ascii tables ?
  • Previous by thread: Re: ColorFunction TriangularSurfacePlot
  • Next by thread: RE: Re: RE: RE: Corrupted Files & Version 4.2 Problems