Re: How to calculate the area of a polygon?
- To: mathgroup at smc.vnet.net
- Subject: [mg27724] Re: How to calculate the area of a polygon?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 13 Mar 2001 03:52:42 -0500 (EST)
- References: <98htbn$mod@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Liwin, For a polygon with vertices verts= {v1,v2,....vn,v1} (*notice the closing v1} The signed area is (#1.RotateLeft[#2] - RotateLeft[#1].#2)&@@Thread[verts]/2 If verts is not closes then we can close it. With your example we get. verts= Append[#,First[#]]&[{{0,0},{5,0},{10,5},{0,10},{-5,5}}] {{0,0},{5,0},{10,5},{0,10},{-5,5},{0,0}} And the area is (#1.RotateLeft[#2] - RotateLeft[#1].#2)&@@Thread[verts]/2 175/2 This appoach can be modified to give swept area. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "liwen liwen" <gzgear at yahoo.com> wrote in message news:98htbn$mod at smc.vnet.net... > Dear friends, > > I want to calculate the area of a polygon, for > example, the polygon is defined by following points: > data={{0,0},{5,0},{10,5},{0,10},{-5,5}}; > Regardless of that it is concave or convex. > > Any help is appreciated. > > Thank you very much! > > Liwen 3/11/2001 > > E-mail: gzgear at yahoo.com > > __________________________________________________ > Do You Yahoo!? > Yahoo! Auctions - Buy the things you want at great prices. > http://auctions.yahoo.com/ >