home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.programming:3172 sci.physics:19072 sci.math:15135
- Newsgroups: comp.programming,sci.physics,sci.math
- Path: sparky!uunet!caen!nic.umass.edu!news.amherst.edu!mkrogers
- From: mkrogers@unix.amherst.edu (MICHAEL K ROGERS)
- Subject: Re: area in closed curve; similar to net work calculation
- Message-ID: <BxvtAH.5D0@unix.amherst.edu>
- Summary: Green's Theorem applied to a piecewise linear path.
- Sender: news@unix.amherst.edu (No News is Good News)
- Nntp-Posting-Host: amhux3.amherst.edu
- Organization: Amherst College
- X-Newsreader: TIN [version 1.1 PL7]
- Date: Tue, 17 Nov 1992 22:32:40 GMT
- Lines: 43
-
- mark@hubcap.clemson.edu (Mark Smotherman) wrote:
- >
- > I want to get a reference to the first use/publication of an algorithm
- > to find the area within a discretized closed curve. While CAM is the
- > application for which I came up with the algorithm, I later found the
- > same type of problem as a net work calculation for a heat engine in
- > a freshman physics text (figure 19-8, Sears and Zemansky, University
- > Physics, 4th ed., 1970, p. 271). So I expect this algorithm has been
- > around for quite a while.
- >
- > Given a closed curve completely described by unit movements LRUD (left,
- > right, up, and down), calculate the enclosed area. The description
- > may be clockwise or counterclockwise and of arbitrary shape.
- >
- >
- > area = 0;
- > counter = ARBITRARY_VALUE; /* makes more sense visually if it is large */
- > /* enough so that counter never goes negative */
- > while( moves_are_left() ){
- > move = next_move();
- > switch(move){
- > case L:
- > area = area - counter;
- > break;
- > case R:
- > area = area + counter;
- > break;
- > case U:
- > counter = counter + 1;
- > break;
- > case D:
- > counter = counter - 1;
- > break;
- > }
- > area = abs(area);
-
- Green's Theorem implies that the path integral around the
- boundary of a region of y dx equals the area of the region
- (given by the double integral over the region of dx dy ).
- Your algorithm does the most straightforward evaluation
- of the path integral int y dx I can think of. Of course
- the algorithm may be older than Green's Theorem which was
- discovered about 1828.
-