Re: How do you draw Triangles and other Geometric figures in Mathematica?
- To: mathgroup@smc.vnet.net
- Subject: [mg10972] Re: How do you draw Triangles and other Geometric figures in Mathematica?
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Sun, 15 Feb 1998 02:10:38 -0500
- References: <6c3eoj$1f1@smc.vnet.net>
Show[Graphics[Line[{{x1,y1},...., {xn,yn},{x1,y1}}]]] displays a closed (because of the final {x1,y1}} polygonal line Show[Graphics[Polygon[{{x1,y1},...., {xn,yn}}]]] displays a black filled polygon/ Here's a blue triangle (thick line) In[16]:= ln=Show[Graphics[{Thickness[.02],Hue[.6],Line[{{0,0},{1,1},{0,1},{0,0}}]}]] and the corresponding red-filled polygon In[17]:= pol=Show[Graphics[{Hue[0],Polygon[{{0,0},{1,1},{0,1}}]}]] Put the two together: In[18]:= Show[pol,ln] For regular shapes the following Add-ons are useful in 2D: Geometry`Polytopes` in 3D Graphics`Polyhedra` Graphics`Shapes` -- Training and Consulting Leicester, UK hay@haystack.demon.co.uk http://www.haystack.demon.co.uk voice: +44 (0)116 271 4198 fax: +44 (0)116 271 8642