Re: How I can calculate a surface of a points list?
- To: mathgroup@smc.vnet.net
- Subject: [mg11662] Re: How I can calculate a surface of a points list?
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Sat, 21 Mar 1998 18:35:02 -0500
- Organization: University of Western Australia
- References: <6esmu7$63v@smc.vnet.net>
Joan Garcia wrote: > I have a very little problem with Mathematica, > > I have a points list, this list defines a polygon. How I can calculate > the surface of this polygon I have defined with a points list? A search of comp.soft-sys.math.mathematica using Deja news http://www.dejanews.com/home_ps.shtml returned the following: Subject: [mg11662] Re: finding irregular areas From: Richard Mercer <richard@seuss.math.wright.edu> To: mathgroup@smc.vnet.net Approved: Steven M. Christensen <steve@christensen.cybernetics.net>, Moderator Organization: MathSolutions, Inc. > I have a colleague who is looking for a full or partial > Mathematica solution to the following situation. > > He has some aerial photographs of agricultural fields. > These fields are broken up by fences. The fields are > not of any nice shape being defined by rivers, roads, > etc. He was to be able to scan the photos into his > computer and then find the areas of the various fenced > areas. > > He will need to be able to define the fenced areas with > a mouse or similar device and then feed the numbers to > a program to find the area. > > Any ideas on how to handle all or part of this kind of > problem? > > [I did suggest that he just cut the photos into the > various areas and weight each and compare to a known > area's weight, but that was not technical enough. :-) > ] > > Thanks. > > Steve Christensen > Here is a formula for the area of a polygon with vertices {(xk,yk): k = 1,...,n}: Area = 1/2 [(x1*y2 - x2*y1) + (x2*y3 - x3*y2) + ... + (xn*y1 - x1*yn)]. This formula appears in an Article by Gil Strang of MIT on p. 253 of the March 1993 issue of The American Mathematical Monthly, with the note that it is "known, but not well known". There is also a very brief discussion of proofs and other references, including an article by Bart Braden of Northern Kentucky U., a known Mathematica enthusiast. If your friend is successful in digitizing enough points to define the region, this formula will calculate the area. Being a polygon is not a practical limitation, you just might have to use more points! Richard Mercer Subject: [mg11662] Re: [mg1084] Re: finding irregular areas From: Allan Hayes <hay@haystack.demon.co.uk> To: mathgroup@smc.vnet.net Richard Mercer < richard@seuss.math.wright.edu > [mg1084] Re: finding irregular areas writes >Here is a formula for the area of a polygon with vertices >{(xk,yk): k = 1,...,n}: > >Area = >1/2 [(x1*y2 - x2*y1) + (x2*y3 - x3*y2) + ... + (xn*y1 - x1*yn)]. > >This formula appears in an Article by Gil Strang of MIT on p. 253 of >the March 1993 issue of The American Mathematical ..... Here are two quite different codes for Strang's formula Area2[cds_] := Plus@@Det/@Partition[Append[cds,First[cds]],2,1]/2 Area3[cds_] := (#1.RotateLeft[#2] - RotateLeft[#1].#2)&@@Thread[cds]/2 The second one is the quicker (and both are quicker than the code I gave in an earlier posting). The result depends on signed areas given by determinants and the idea of a radius vector sweeping out area (in Strangs's formula the vector rotates around the origin, in my previous posting it rotates around the first point of the polygon). Allan Hayes hay@haystack.demon.co.uk Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul@physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________