fbpx
Wikipedia

Shoelace formula

The shoelace formula, shoelace algorithm, or shoelace method (also known as Gauss's area formula and the surveyor's formula)[1] is a mathematical algorithm to determine the area of a simple polygon whose vertices are described by their Cartesian coordinates in the plane.[2] It is called the shoelace formula because of the constant cross-multiplying for the coordinates making up the polygon, like threading shoelaces.[2] It has applications in surveying and forestry,[3] among other areas.

Shoelace scheme for determining the area of a polygon with point coordinates

The formula was described by Albrecht Ludwig Friedrich Meister (1724–1788) in 1769[4] and is based on the trapezoid formula which was described by Carl Friedrich Gauss and C.G.J. Jacobi.[5] The triangle form of the area formula can be considered to be a special case of Green's theorem.

The area formula can also be applied to self-overlapping polygons since the meaning of area is still clear even though self-overlapping polygons are not generally simple.[6] Furthermore, a self-overlapping polygon can have multiple "interpretations" but the Shoelace formula can be used to show that the polygon's area is the same regardless of the interpretation.[7]

The polygon area formulas

 
Basic idea: Any polygon edge determines the signed area of a trapezoid. All these areas sum up to the polygon area.

Given: A planar simple polygon with a positively oriented (counter clock wise) sequence of points   in a Cartesian coordinate system.
For the simplicity of the formulas below it is convenient to set  .

The formulas:
The area of the given polygon can be expressed by a variety of formulas, which are connected by simple operations (see below):
If the polygon is negatively oriented, then the result   of the formulas is negative. In any case   is the sought area of the polygon.[8]

Trapezoid formula

The trapezoid formula sums up a sequence of oriented areas   of trapezoids with   as one of its four edges (see below):

 

Triangle formula

The triangle formula sums up the oriented areas   of triangles  :[9]

 

Shoelace formula

 
Shoelace scheme, vertical form: With all the slashes drawn, the matrix loosely resembles a shoe with the laces done up, giving rise to the algorithm's name.

The determinant formulas are the base of the popular shoelace formula, which is a scheme, that optimizes the calculation of the sum of the 2×2-Determinants by hand:

 

Other formulas

 
 

A particularly concise statement of the formula can be given in terms of the exterior algebra. If   are the consecutive vertices of the polygon (regarded as vectors in the Cartesian plane) then

 
 
Example
 
Horizontal shoelace form for the example.

Example

For the area of the pentagon with

 
one gets
 

The advantage of the shoelace form: Only 6 columns have to be written for calculating the 5 determinants with 10 columns.

Deriving the formulas

Trapezoid formula

 
Deriving the trapezoid formula

The edge   determines the trapezoid   with its oriented area

 

In case of   the number   is negative, otherwise positive or   if  . In the diagram the orientation of an edge is shown by an arrow. The color shows the sign of  : red means  , green indicates  . In the first case the trapezoid is called negative in the second case positive. The negative trapezoids delete those parts of positive trapezoids, which are outside the polygon. In case of a convex polygon (in the diagram the upper example) this is obvious: The polygon area is the sum of the areas of the positive trapezoids (green edges) minus the areas of the negative trapezoids (red edges). In the non convex case one has to consider the situation more carefully (see diagram). In any case the result is

 

Triangle form, determinant form

 
Triangle form: The color of the edges indicate, which triangle area is positive (green) and negative (red) respectively.

Eliminating the brackets and using   (see convention   above), one gets the determinant form of the area formula:

 
Because one half of the i-th determinant is the oriented area of the triangle   this version of the area formula is called triangle form.

Other formulas

With   (see convention   above) one gets

 
Combining both sums and excluding   leads to
 
With the identity   one gets
 

Alternatively, this is a special case of Green's theorem with one function set to 0 and the other set to x, such that the area is the integral of xdy along the boundary.

Manipulations of a polygon

  indicates the oriented area of the simple polygon   with   (see above).   is positive/negative if the orientation of the polygon is positive/negative. From the triangle form of the area formula or the diagram below one observes for  :

 
In case of   one should first shift the indices.

Hence:

  1. Moving   affects only   and leaves   unchanged. There is no change of the area if   is moved parallel to  .
  2. Purging   changes the total area by  , which can be positive or negative.
  3. Inserting point   between   changes the total area by  , which can be positive or negative.

Example:

 
 
 
Manipulations of a polygon

With the above notation of the shoelace scheme one gets for the oriented area of the

  • blue polygon:
     
  • green triangle:
     
  • red triangle:
     
  • blue polygon minus point  :
     
  • blue polygon plus point   between  :
     

One checks, that the following equations hold:

 
 

Generalization

In higher dimensions the area of a polygon can be calculated from its vertices using the exterior algebra form of the Shoelace formula (e.g. in 3d, the sum of successive cross products):

 
(when the vertices are not coplanar this computes the vector area enclosed by the loop, i.e. the projected area or "shadow" in the plane in which it is greatest).

This formulation can also be generalized to calculate the volume of an n-dimensional polytope from the coordinates of its vertices, or more accurately, from its hypersurface mesh.[10] For example, the volume of a 3-dimensional polyhedron can be found by triangulating its surface mesh and summing the signed volumes of the tetrahedra formed by each surface triangle and the origin:

 
where the sum is over the faces and care has to be taken to order the vertices consistently (all clockwise or anticlockwise viewed from outside the polyhedron). Alternatively, an expression in terms of the face areas and surface normals may be derived using the divergence theorem (see Polyhedron § Volume).

See also

External links

  • Mathologer video about Gauss' shoelace formula

References

  1. ^ Bart Braden (1986). (PDF). The College Mathematics Journal. 17 (4): 326–337. doi:10.2307/2686282. JSTOR 2686282. Archived from the original (PDF) on 29 June 2014.
  2. ^ a b Dahlke, Karl. "Shoelace Formula". Retrieved 9 June 2008.
  3. ^ Hans Pretzsch, Forest Dynamics, Growth and Yield: From Measurement to Model, Springer, 2009, ISBN 3-540-88306-1, p. 232.
  4. ^ Meister, A. L. F. (1769), "Generalia de genesi figurarum planarum et inde pendentibus earum affectionibus", Nov. Com. Gött. (in Latin), 1: 144.
  5. ^ Max Koecher, Aloys Krieg: Ebene Geometrie, Springer-Verlag, 2013,ISBN 3662068095, 9783662068090, p. 116
  6. ^ P.W. Shor; C.J. Van Wyk (1992), "Detecting and decomposing self-overlapping curves", Comput. Geom. Theory Appl., 2 (1): 31–50, doi:10.1016/0925-7721(92)90019-O
  7. ^ Ralph P. Boland; Jorge Urrutia (2000). Polygon Area Problems. 12th Canadian Conference on Computational Geometry. pp. 159–162.
  8. ^ Antti Laaksonen: Guide to Competitive Programming: Learning and Improving Algorithms Through Contests, Springer, 2018, ISBN 3319725475, 9783319725475, p. 217
  9. ^ Mauren Abreu de Souza, Humberto Remigio Gamba, Helio Pedrini: Multi-Modality Imaging: Applications and Computational Techniques, Springer, 2018,ISBN 331998974X, 9783319989747, p. 229
  10. ^ Allgower, Eugene L.; Schmidt, Phillip H. (1986). "Computing Volumes of Polyhedra" (PDF). Mathematics of Computation. 46 (173): 171–174. doi:10.2307/2008221. ISSN 0025-5718. JSTOR 2008221.

shoelace, formula, shoelace, formula, shoelace, algorithm, shoelace, method, also, known, gauss, area, formula, surveyor, formula, mathematical, algorithm, determine, area, simple, polygon, whose, vertices, described, their, cartesian, coordinates, plane, call. The shoelace formula shoelace algorithm or shoelace method also known as Gauss s area formula and the surveyor s formula 1 is a mathematical algorithm to determine the area of a simple polygon whose vertices are described by their Cartesian coordinates in the plane 2 It is called the shoelace formula because of the constant cross multiplying for the coordinates making up the polygon like threading shoelaces 2 It has applications in surveying and forestry 3 among other areas Shoelace scheme for determining the area of a polygon with point coordinates x 1 y 1 x n y n displaystyle x 1 y 1 x n y n The formula was described by Albrecht Ludwig Friedrich Meister 1724 1788 in 1769 4 and is based on the trapezoid formula which was described by Carl Friedrich Gauss and C G J Jacobi 5 The triangle form of the area formula can be considered to be a special case of Green s theorem The area formula can also be applied to self overlapping polygons since the meaning of area is still clear even though self overlapping polygons are not generally simple 6 Furthermore a self overlapping polygon can have multiple interpretations but the Shoelace formula can be used to show that the polygon s area is the same regardless of the interpretation 7 Contents 1 The polygon area formulas 1 1 Trapezoid formula 1 2 Triangle formula 1 3 Shoelace formula 1 4 Other formulas 2 Example 3 Deriving the formulas 3 1 Trapezoid formula 3 2 Triangle form determinant form 3 3 Other formulas 4 Manipulations of a polygon 5 Generalization 6 See also 7 External links 8 ReferencesThe polygon area formulas Edit Basic idea Any polygon edge determines the signed area of a trapezoid All these areas sum up to the polygon area Given A planar simple polygon with a positively oriented counter clock wise sequence of points P i x i y i i 1 n displaystyle P i x i y i i 1 dots n in a Cartesian coordinate system For the simplicity of the formulas below it is convenient to set P 0 P n P n 1 P 1 displaystyle P 0 P n P n 1 P 1 The formulas The area of the given polygon can be expressed by a variety of formulas which are connected by simple operations see below If the polygon is negatively oriented then the result A displaystyle A of the formulas is negative In any case A displaystyle A is the sought area of the polygon 8 Trapezoid formula Edit The trapezoid formula sums up a sequence of oriented areas A i 1 2 y i y i 1 x i x i 1 displaystyle A i tfrac 1 2 y i y i 1 x i x i 1 of trapezoids with P i P i 1 displaystyle P i P i 1 as one of its four edges see below A 1 2 i 1 n y i y i 1 x i x i 1 1 2 y 1 y 2 x 1 x 2 y n y 1 x n x 1 displaystyle begin aligned A amp frac 1 2 sum i 1 n y i y i 1 x i x i 1 amp frac 1 2 Big y 1 y 2 x 1 x 2 cdots y n y 1 x n x 1 Big end aligned Triangle formula Edit The triangle formula sums up the oriented areas A i displaystyle A i of triangles O P i P i 1 displaystyle OP i P i 1 9 A 1 2 i 1 n x i y i 1 x i 1 y i 1 2 i 1 n x i x i 1 y i y i 1 1 2 i 1 n x i y i x i 1 y i 1 1 2 x 1 y 2 x 2 y 1 x 2 y 3 x 3 y 2 x n y 1 x 1 y n displaystyle begin aligned A amp frac 1 2 sum i 1 n x i y i 1 x i 1 y i frac 1 2 sum i 1 n begin vmatrix x i amp x i 1 y i amp y i 1 end vmatrix frac 1 2 sum i 1 n begin vmatrix x i amp y i x i 1 amp y i 1 end vmatrix amp frac 1 2 Big x 1 y 2 x 2 y 1 x 2 y 3 x 3 y 2 cdots x n y 1 x 1 y n Big end aligned Shoelace formula Edit Shoelace scheme vertical form With all the slashes drawn the matrix loosely resembles a shoe with the laces done up giving rise to the algorithm s name The determinant formulas are the base of the popular shoelace formula which is a scheme that optimizes the calculation of the sum of the 2 2 Determinants by hand 2 A x 1 x 2 y 1 y 2 x 2 x 3 y 2 y 3 x n x 1 y n y 1 x 1 x 2 x 3 x n x 1 y 1 y 2 y 3 y n y 1 horizontal shoelace scheme x 1 y 1 x 2 y 2 x n y n x 1 y 1 vertical form displaystyle begin aligned 2A amp underbrace begin vmatrix x 1 amp x 2 y 1 amp y 2 end vmatrix begin vmatrix x 2 amp x 3 y 2 amp y 3 end vmatrix cdots begin vmatrix x n amp x 1 y n amp y 1 end vmatrix amp begin vmatrix x 1 amp x 2 amp x 3 cdots amp x n amp x 1 y 1 amp y 2 amp y 3 cdots amp y n amp y 1 end vmatrix amp text horizontal shoelace scheme amp begin vmatrix x 1 amp y 1 x 2 amp y 2 vdots amp vdots x n amp y n x 1 amp y 1 end vmatrix amp text vertical form end aligned Other formulas Edit A 1 2 i 1 n y i x i 1 x i 1 1 2 y 1 x n x 2 y 2 x 1 x 3 y n x n 1 x 1 displaystyle begin aligned A amp frac 1 2 sum i 1 n y i x i 1 x i 1 amp frac 1 2 Big y 1 x n x 2 y 2 x 1 x 3 cdots y n x n 1 x 1 Big end aligned A 1 2 i 1 n x i y i 1 y i 1 displaystyle A frac 1 2 sum i 1 n x i y i 1 y i 1 A particularly concise statement of the formula can be given in terms of the exterior algebra If v 1 v n displaystyle v 1 dots v n are the consecutive vertices of the polygon regarded as vectors in the Cartesian plane thenA 1 2 i 1 n v i v i 1 displaystyle A frac 1 2 cdot left sum i 1 n v i wedge v i 1 right Example Horizontal shoelace form for the example Example EditFor the area of the pentagon withP 1 1 6 P 2 3 1 P 3 7 2 P 4 4 4 P 5 8 5 displaystyle begin aligned amp P 1 1 6 P 2 3 1 P 3 7 2 amp P 4 4 4 P 5 8 5 end aligned one gets 2 A 1 3 6 1 3 7 1 2 7 4 2 4 4 8 4 5 8 1 5 6 1 18 6 7 28 8 20 32 48 5 33 A 16 5 displaystyle begin aligned 2A amp begin vmatrix 1 amp 3 6 amp 1 end vmatrix begin vmatrix 3 amp 7 1 amp 2 end vmatrix begin vmatrix 7 amp 4 2 amp 4 end vmatrix begin vmatrix 4 amp 8 4 amp 5 end vmatrix begin vmatrix 8 amp 1 5 amp 6 end vmatrix amp 1 18 6 7 28 8 20 32 48 5 33 A amp 16 5 end aligned The advantage of the shoelace form Only 6 columns have to be written for calculating the 5 determinants with 10 columns Deriving the formulas EditTrapezoid formula Edit Deriving the trapezoid formula The edge P i P i 1 displaystyle P i P i 1 determines the trapezoid x i y i x i 1 y i 1 x i 0 x i 1 0 displaystyle x i y i x i 1 y i 1 x i 0 x i 1 0 with its oriented area A i 1 2 y i y i 1 x i x i 1 displaystyle A i tfrac 1 2 y i y i 1 x i x i 1 In case of x i lt x i 1 displaystyle x i lt x i 1 the number A i displaystyle A i is negative otherwise positive or A i 0 displaystyle A i 0 if x i x i 1 displaystyle x i x i 1 In the diagram the orientation of an edge is shown by an arrow The color shows the sign of A i displaystyle A i red means A i lt 0 displaystyle A i lt 0 green indicates A i gt 0 displaystyle A i gt 0 In the first case the trapezoid is called negative in the second case positive The negative trapezoids delete those parts of positive trapezoids which are outside the polygon In case of a convex polygon in the diagram the upper example this is obvious The polygon area is the sum of the areas of the positive trapezoids green edges minus the areas of the negative trapezoids red edges In the non convex case one has to consider the situation more carefully see diagram In any case the result isA i 1 n A i 1 2 i 1 n y i y i 1 x i x i 1 displaystyle A sum i 1 n A i frac 1 2 sum i 1 n y i y i 1 x i x i 1 Triangle form determinant form Edit Triangle form The color of the edges indicate which triangle area is positive green and negative red respectively Eliminating the brackets and using i 1 n x i y i i 1 n x i 1 y i 1 textstyle sum i 1 n x i y i sum i 1 n x i 1 y i 1 see convention P n 1 P 1 displaystyle P n 1 P 1 above one gets the determinant form of the area formula A 1 2 i 1 n x i y i 1 x i 1 y i 1 2 i 1 n x i x i 1 y i y i 1 displaystyle A frac 1 2 sum i 1 n x i y i 1 x i 1 y i frac 1 2 sum i 1 n begin vmatrix x i amp x i 1 y i amp y i 1 end vmatrix Because one half of the i th determinant is the oriented area of the triangle O P i P i 1 displaystyle O P i P i 1 this version of the area formula is called triangle form Other formulas Edit With i 1 n x i y i 1 i 1 n x i 1 y i textstyle sum i 1 n x i y i 1 sum i 1 n x i 1 y i see convention P 0 P n P n 1 P 1 displaystyle P 0 P n P n 1 P 1 above one gets2 A i 1 n x i y i 1 x i 1 y i i 1 n x i y i 1 i 1 n x i 1 y i i 1 n x i 1 y i i 1 n x i 1 y i displaystyle 2A sum i 1 n x i y i 1 x i 1 y i sum i 1 n x i y i 1 sum i 1 n x i 1 y i sum i 1 n x i 1 y i sum i 1 n x i 1 y i Combining both sums and excluding y i displaystyle y i leads to A 1 2 i 1 n y i x i 1 x i 1 displaystyle A frac 1 2 sum i 1 n y i x i 1 x i 1 With the identity i 1 n x i 1 y i i 1 n x i y i 1 textstyle sum i 1 n x i 1 y i sum i 1 n x i y i 1 one gets A 1 2 i 1 n x i y i 1 y i 1 displaystyle A frac 1 2 sum i 1 n x i y i 1 y i 1 Alternatively this is a special case of Green s theorem with one function set to 0 and the other set to x such that the area is the integral of xdy along the boundary Manipulations of a polygon EditA P 1 P n displaystyle A P 1 dots P n indicates the oriented area of the simple polygon P 1 P n displaystyle P 1 dots P n with n 4 displaystyle n geq 4 see above A displaystyle A is positive negative if the orientation of the polygon is positive negative From the triangle form of the area formula or the diagram below one observes for 1 lt k lt n displaystyle 1 lt k lt n A P 1 P n A P 1 P k 1 P k 1 P n A P k 1 P k P k 1 displaystyle A P 1 dots P n A P 1 dots P k 1 P k 1 dots P n A P k 1 P k P k 1 In case of k 1 or n displaystyle k 1 text or n one should first shift the indices Hence Moving P k displaystyle P k affects only A P k 1 P k P k 1 displaystyle A P k 1 P k P k 1 and leaves A P 1 P k 1 P k 1 P n displaystyle A P 1 P k 1 P k 1 P n unchanged There is no change of the area if P k displaystyle P k is moved parallel to P k 1 P k 1 displaystyle overline P k 1 P k 1 Purging P k displaystyle P k changes the total area by A P k 1 P k P k 1 displaystyle A P k 1 P k P k 1 which can be positive or negative Inserting point Q displaystyle Q between P k P k 1 displaystyle P k P k 1 changes the total area by A P k Q P k 1 displaystyle A P k Q P k 1 which can be positive or negative Example P 1 3 1 P 2 7 2 P 3 4 4 displaystyle P 1 3 1 P 2 7 2 P 3 4 4 P 4 8 6 P 5 1 7 Q 4 3 displaystyle P 4 8 6 P 5 1 7 Q 4 3 Manipulations of a polygon With the above notation of the shoelace scheme one gets for the oriented area of the blue polygon A P 1 P 2 P 3 P 4 P 5 1 2 3 7 4 8 1 3 1 2 4 6 7 1 15 5 displaystyle A P 1 P 2 P 3 P 4 P 5 tfrac 1 2 begin vmatrix 3 amp 7 amp 4 amp 8 amp 1 amp 3 1 amp 2 amp 4 amp 6 amp 7 amp 1 end vmatrix 15 5 green triangle A P 2 P 3 P 4 1 2 7 4 8 7 2 4 6 2 7 displaystyle A P 2 P 3 P 4 tfrac 1 2 begin vmatrix 7 amp 4 amp 8 amp 7 2 amp 4 amp 6 amp 2 end vmatrix 7 red triangle A P 1 Q P 2 1 2 3 4 7 3 1 3 2 1 3 5 displaystyle A P 1 Q P 2 tfrac 1 2 begin vmatrix 3 amp 4 amp 7 amp 3 1 amp 3 amp 2 amp 1 end vmatrix 3 5 blue polygon minus point P 3 displaystyle P 3 A P 1 P 2 P 4 P 5 1 2 3 7 8 1 3 1 2 6 7 1 27 5 displaystyle A P 1 P 2 P 4 P 5 tfrac 1 2 begin vmatrix 3 amp 7 amp 8 amp 1 amp 3 1 amp 2 amp 6 amp 7 amp 1 end vmatrix 27 5 blue polygon plus point Q displaystyle Q between P 1 P 2 displaystyle P 1 P 2 A P 1 Q P 2 P 3 P 4 P 5 1 2 3 4 7 4 8 1 3 1 3 2 4 6 7 1 17 displaystyle A P 1 Q P 2 P 3 P 4 P 5 tfrac 1 2 begin vmatrix 3 amp 4 amp 7 amp 4 amp 8 amp 1 amp 3 1 amp 3 amp 2 amp 4 amp 6 amp 7 amp 1 end vmatrix 17 One checks that the following equations hold A P 1 P 2 P 3 P 4 P 5 A P 1 P 2 P 4 P 5 A P 2 P 3 P 4 20 5 displaystyle A P 1 P 2 P 3 P 4 P 5 A P 1 P 2 P 4 P 5 A P 2 P 3 P 4 20 5 A P 1 P 2 P 3 P 4 P 5 A P 1 Q P 2 A P 1 Q P 2 P 3 P 4 P 5 17 displaystyle A P 1 P 2 P 3 P 4 P 5 A P 1 Q P 2 A P 1 Q P 2 P 3 P 4 P 5 17 Generalization EditIn higher dimensions the area of a polygon can be calculated from its vertices using the exterior algebra form of the Shoelace formula e g in 3d the sum of successive cross products A 1 2 i 1 n v i v i 1 displaystyle A frac 1 2 left sum i 1 n v i wedge v i 1 right when the vertices are not coplanar this computes the vector area enclosed by the loop i e the projected area or shadow in the plane in which it is greatest This formulation can also be generalized to calculate the volume of an n dimensional polytope from the coordinates of its vertices or more accurately from its hypersurface mesh 10 For example the volume of a 3 dimensional polyhedron can be found by triangulating its surface mesh and summing the signed volumes of the tetrahedra formed by each surface triangle and the origin V 1 6 F v a v b v c displaystyle V frac 1 6 left sum F v a wedge v b wedge v c right where the sum is over the faces and care has to be taken to order the vertices consistently all clockwise or anticlockwise viewed from outside the polyhedron Alternatively an expression in terms of the face areas and surface normals may be derived using the divergence theorem see Polyhedron Volume See also EditPlanimeter Polygon area Pick s theorem Heron s formulaExternal links EditMathologer video about Gauss shoelace formulaReferences Edit Bart Braden 1986 The Surveyor s Area Formula PDF The College Mathematics Journal 17 4 326 337 doi 10 2307 2686282 JSTOR 2686282 Archived from the original PDF on 29 June 2014 a b Dahlke Karl Shoelace Formula Retrieved 9 June 2008 Hans Pretzsch Forest Dynamics Growth and Yield From Measurement to Model Springer 2009 ISBN 3 540 88306 1 p 232 Meister A L F 1769 Generalia de genesi figurarum planarum et inde pendentibus earum affectionibus Nov Com Gott in Latin 1 144 Max Koecher Aloys Krieg Ebene Geometrie Springer Verlag 2013 ISBN 3662068095 9783662068090 p 116 P W Shor C J Van Wyk 1992 Detecting and decomposing self overlapping curves Comput Geom Theory Appl 2 1 31 50 doi 10 1016 0925 7721 92 90019 O Ralph P Boland Jorge Urrutia 2000 Polygon Area Problems 12th Canadian Conference on Computational Geometry pp 159 162 Antti Laaksonen Guide to Competitive Programming Learning and Improving Algorithms Through Contests Springer 2018 ISBN 3319725475 9783319725475 p 217 Mauren Abreu de Souza Humberto Remigio Gamba Helio Pedrini Multi Modality Imaging Applications and Computational Techniques Springer 2018 ISBN 331998974X 9783319989747 p 229 Allgower Eugene L Schmidt Phillip H 1986 Computing Volumes of Polyhedra PDF Mathematics of Computation 46 173 171 174 doi 10 2307 2008221 ISSN 0025 5718 JSTOR 2008221 Retrieved from https en wikipedia org w index php title Shoelace formula amp oldid 1121798305, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.