Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Re: finding irregular areas

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1144] Re: [mg1084] Re: finding irregular areas
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Wed, 17 May 1995 04:49:23 -0400

Richard Mercer < richard at 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 at haystack.demon.co.uk




  • Prev by Date: Re: Online documentation available?
  • Next by Date: Sort[] accuracy problem
  • Previous by thread: Re: finding irregular areas
  • Next by thread: Switch Axis?