MathGroup Archive 1997

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

Search the Archive

Re: Changing Plot3D to polygons?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5913] Re: [mg5850] Changing Plot3D to polygons?
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Tue, 4 Feb 1997 00:03:32 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Robert Shanks <shanks at synthlab.pdial.interpath.net>
[mg5850] Changing Plot3D to polygons?

>I'm looking for a Mathematica comand or code to convert Plot3D or
>ParametricPlot3D to polygons.

Robert:

ParametricPlot3D gives the polygons in its output:

pp = ParametricPlot3D[{x,y,x+y},{x,0,1},{y,0,1}, PlotPoints ->3]

	-Graphics3D-

pp[[1]]

	{Polygon[{{0., 0., 0.}, {0.5, 0., 0.5}, {0.5, 0.5, 1.},
	{0., 0.5, 0.5}}],  Polygon[{{0.5, 0., 0.5}, {1., 0., 1.}, 	
	{1., 0.5, 1.5}, {0.5, 0.5, 1.}}], Polygon[{{0., 0.5, 0.5},
	{0.5, 0.5, 1.}, {0.5, 1., 1.5}, {0., 1., 1.}}], 	
	Polygon[{{0.5, 0.5, 1.}, {1., 0.5, 1.5}, {1., 1., 2.}, {0.5, 	
	1., 1.5}}]}
	
You can see the full output by evaluating
InputForm[pp]

Plot3D gives a matrix of heights rather than polygons in its  
output( which is a SurfaceGraphics object instead of the Graphicss3D  
object given by ParametricPlot3D).
But we can convert to the corresponding Graphicss3D object with  
polygons and then extract these:


Plot3D[x+y,{x,0,1},{y,0,1}, PlotPoints ->3]

	-SurfaceGraphics-

Graphics3D[%]			(*converting*)
	-Graphics3D-

%[[1]]
{Polygon[{{0., 0.5, 0.5}, {0., 0., 0.}, {0.5, 0., 0.5},

    {0.5, 0.5, 1.}}], Polygon[{{0.5, 0.5, 1.}, {0.5, 0., 0.5},

    {1., 0., 1.}, {1., 0.5, 1.5}}],

  Polygon[{{0., 1., 1.}, {0., 0.5, 0.5}, {0.5, 0.5, 1.},

    {0.5, 1., 1.5}}], Polygon[{{0.5, 1., 1.5}, {0.5, 0.5, 1.},

    {1., 0.5, 1.5}, {1., 1., 2.}}]}

Allan Hayes
hay at haystack.demon.co.uk
tel:  +44-(0)-116-271-4198
fax: +44-(0)-116-271-8642
http://www.haystack.demon.co.uk/



  • Prev by Date: Re: Peak fitting
  • Next by Date: Re: How do you plot Exp?????
  • Previous by thread: Re: Peak fitting
  • Next by thread: Re: Changing Plot3D to polygons?