-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolygon_wiki.txt
More file actions
1292 lines (614 loc) · 31.7 KB
/
Copy pathpolygon_wiki.txt
File metadata and controls
1292 lines (614 loc) · 31.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
In geometry, a polygon () is a plane figure made up of line segments connected to form a closed polygonal chain.
The segments of a closed polygonal chain are called its edges or sides. The points where two edges meet are the polygon's vertices or corners. An n-gon is a polygon with n sides; for example, a triangle is a 3-gon.
A simple polygon is one which does not intersect itself. More precisely, the only allowed intersections among the line segments that make up the polygon are the shared endpoints of consecutive segments in the polygonal chain. A simple polygon is the boundary of a region of the plane that is called a solid polygon. The interior of a solid polygon is its body, also known as a polygonal region or polygonal area. In contexts where one is concerned only with simple and solid polygons, a polygon may refer only to a simple polygon or to a solid polygon.
A polygonal chain may cross over itself, creating star polygons and other self-intersecting polygons. Some sources also consider closed polygonal chains in Euclidean space to be a type of polygon (a skew polygon), even when the chain does not lie in a single plane.
A polygon is a 2-dimensional example of the more general polytope in any number of dimensions. There are many more generalizations of polygons defined for different purposes.
== Etymology ==
The word polygon derives from the Greek adjective πολύς (polús) 'much', 'many' and γωνία (gōnía) 'corner' or 'angle'. It has been suggested that γόνυ (gónu) 'knee' may be the origin of gon.
== Classification ==
=== Number of sides ===
Polygons are primarily classified by the number of sides.
=== Convexity and intersection ===
Polygons may be characterized by their convexity or type of non-convexity:
Convex: any line drawn through the polygon (and not tangent to an edge or corner) meets its boundary exactly twice. As a consequence, all its interior angles are less than 180°. Equivalently, any line segment with endpoints on the boundary passes through only interior points between its endpoints. This condition is true for polygons in any geometry, not just Euclidean.
Non-convex: a line may be found which meets its boundary more than twice. Equivalently, there exists a line segment between two boundary points that passes outside the polygon.
Simple: the boundary of the polygon does not cross itself. All convex polygons are simple.
Concave: Non-convex and simple. There is at least one interior angle greater than 180°.
Star-shaped: the whole interior is visible from at least one point, without crossing any edge. The polygon must be simple, and may be convex or concave. All convex polygons are star-shaped.
Self-intersecting: the boundary of the polygon crosses itself. The term complex is sometimes used in contrast to simple, but this usage risks confusion with the idea of a complex polygon as one which exists in the complex Hilbert plane consisting of two complex dimensions.
Star polygon: a polygon which self-intersects in a regular way. A polygon cannot be both a star and star-shaped.
=== Equality and symmetry ===
Equiangular: all corner angles are equal.
Equilateral: all edges are of the same length.
Regular: both equilateral and equiangular.
Cyclic: all corners lie on a single circle, called the circumcircle.
Tangential: all sides are tangent to an inscribed circle.
Isogonal or vertex-transitive: all corners lie within the same symmetry orbit. The polygon is also cyclic and equiangular.
Isotoxal or edge-transitive: all sides lie within the same symmetry orbit. The polygon is also equilateral and tangential.The property of regularity may be defined in other ways: a polygon is regular if and only if it is both isogonal and isotoxal, or equivalently it is both cyclic and equilateral. A non-convex regular polygon is called a regular star polygon.
=== Miscellaneous ===
Rectilinear: the polygon's sides meet at right angles, i.e. all its interior angles are 90 or 270 degrees.
Monotone with respect to a given line L: every line orthogonal to L intersects the polygon not more than twice.
== Properties and formulas ==
Euclidean geometry is assumed throughout.
=== Angles ===
Any polygon has as many corners as it has sides. Each corner has several angles. The two most important ones are:
Interior angle – The sum of the interior angles of a simple n-gon is (n − 2) × π radians or (n − 2) × 180 degrees. This is because any simple n-gon ( having n sides ) can be considered to be made up of (n − 2) triangles, each of which has an angle sum of π radians or 180 degrees. The measure of any interior angle of a convex regular n-gon is
(
1
−
2
n
)
π
{\displaystyle \left(1-{\tfrac {2}{n}}\right)\pi }
radians or
180
−
360
n
{\displaystyle 180-{\tfrac {360}{n}}}
degrees. The interior angles of regular star polygons were first studied by Poinsot, in the same paper in which he describes the four regular star polyhedra: for a regular
p
q
{\displaystyle {\tfrac {p}{q}}}
-gon (a p-gon with central density q), each interior angle is
π
(
p
−
2
q
)
p
{\displaystyle {\tfrac {\pi (p-2q)}{p}}}
radians or
180
(
p
−
2
q
)
p
{\displaystyle {\tfrac {180(p-2q)}{p}}}
degrees.
Exterior angle – The exterior angle is the supplementary angle to the interior angle. Tracing around a convex n-gon, the angle "turned" at a corner is the exterior or external angle. Tracing all the way around the polygon makes one full turn, so the sum of the exterior angles must be 360°. This argument can be generalized to concave simple polygons, if external angles that turn in the opposite direction are subtracted from the total turned. Tracing around an n-gon in general, the sum of the exterior angles (the total amount one rotates at the vertices) can be any integer multiple d of 360°, e.g. 720° for a pentagram and 0° for an angular "eight" or antiparallelogram, where d is the density or turning number of the polygon.
=== Area ===
In this section, the vertices of the polygon under consideration are taken to be
(
x
0
,
y
0
)
,
(
x
1
,
y
1
)
,
…
,
(
x
n
−
1
,
y
n
−
1
)
{\displaystyle (x_{0},y_{0}),(x_{1},y_{1}),\ldots ,(x_{n-1},y_{n-1})}
in order. For convenience in some formulas, the notation (xn, yn) = (x0, y0) will also be used.
==== Simple polygons ====
If the polygon is non-self-intersecting (that is, simple), the signed area is
A
=
1
2
∑
i
=
0
n
−
1
(
x
i
y
i
+
1
−
x
i
+
1
y
i
)
where
x
n
=
x
0
and
y
n
=
y
0
,
{\displaystyle A={\frac {1}{2}}\sum _{i=0}^{n-1}(x_{i}y_{i+1}-x_{i+1}y_{i})\quad {\text{where }}x_{n}=x_{0}{\text{ and }}y_{n}=y_{0},}
or, using determinants
16
A
2
=
∑
i
=
0
n
−
1
∑
j
=
0
n
−
1
|
Q
i
,
j
Q
i
,
j
+
1
Q
i
+
1
,
j
Q
i
+
1
,
j
+
1
|
,
{\displaystyle 16A^{2}=\sum _{i=0}^{n-1}\sum _{j=0}^{n-1}{\begin{vmatrix}Q_{i,j}&Q_{i,j+1}\\Q_{i+1,j}&Q_{i+1,j+1}\end{vmatrix}},}
where
Q
i
,
j
{\displaystyle Q_{i,j}}
is the squared distance between
(
x
i
,
y
i
)
{\displaystyle (x_{i},y_{i})}
and
(
x
j
,
y
j
)
.
{\displaystyle (x_{j},y_{j}).}
The signed area depends on the ordering of the vertices and of the orientation of the plane. Commonly, the positive orientation is defined by the (counterclockwise) rotation that maps the positive x-axis to the positive y-axis. If the vertices are ordered counterclockwise (that is, according to positive orientation), the signed area is positive; otherwise, it is negative. In either case, the area formula is correct in absolute value. This is commonly called the shoelace formula or surveyor's formula.The area A of a simple polygon can also be computed if the lengths of the sides, a1, a2, ..., an and the exterior angles, θ1, θ2, ..., θn are known, from:
A
=
1
2
(
a
1
[
a
2
sin
(
θ
1
)
+
a
3
sin
(
θ
1
+
θ
2
)
+
⋯
+
a
n
−
1
sin
(
θ
1
+
θ
2
+
⋯
+
θ
n
−
2
)
]
+
a
2
[
a
3
sin
(
θ
2
)
+
a
4
sin
(
θ
2
+
θ
3
)
+
⋯
+
a
n
−
1
sin
(
θ
2
+
⋯
+
θ
n
−
2
)
]
+
⋯
+
a
n
−
2
[
a
n
−
1
sin
(
θ
n
−
2
)
]
)
.
{\displaystyle {\begin{aligned}A={\frac {1}{2}}(a_{1}[a_{2}\sin(\theta _{1})+a_{3}\sin(\theta _{1}+\theta _{2})+\cdots +a_{n-1}\sin(\theta _{1}+\theta _{2}+\cdots +\theta _{n-2})]\\{}+a_{2}[a_{3}\sin(\theta _{2})+a_{4}\sin(\theta _{2}+\theta _{3})+\cdots +a_{n-1}\sin(\theta _{2}+\cdots +\theta _{n-2})]\\{}+\cdots +a_{n-2}[a_{n-1}\sin(\theta _{n-2})]).\end{aligned}}}
The formula was described by Lopshits in 1963.If the polygon can be drawn on an equally spaced grid such that all its vertices are grid points, Pick's theorem gives a simple formula for the polygon's area based on the numbers of interior and boundary grid points: the former number plus one-half the latter number, minus 1.
In every polygon with perimeter p and area A , the isoperimetric inequality
p
2
>
4
π
A
{\displaystyle p^{2}>4\pi A}
holds.For any two simple polygons of equal area, the Bolyai–Gerwien theorem asserts that the first can be cut into polygonal pieces which can be reassembled to form the second polygon.
The lengths of the sides of a polygon do not in general determine its area. However, if the polygon is simple and cyclic then the sides do determine the area. Of all n-gons with given side lengths, the one with the largest area is cyclic. Of all n-gons with a given perimeter, the one with the largest area is regular (and therefore cyclic).
==== Regular polygons ====
Many specialized formulas apply to the areas of regular polygons.
The area of a regular polygon is given in terms of the radius r of its inscribed circle and its perimeter p by
A
=
1
2
⋅
p
⋅
r
.
{\displaystyle A={\tfrac {1}{2}}\cdot p\cdot r.}
This radius is also termed its apothem and is often represented as a.
The area of a regular n-gon in terms of the radius R of its circumscribed circle can be expressed trigonometrically as:
A
=
R
2
⋅
n
2
⋅
sin
2
π
n
=
R
2
⋅
n
⋅
sin
π
n
⋅
cos
π
n
{\displaystyle A=R^{2}\cdot {\frac {n}{2}}\cdot \sin {\frac {2\pi }{n}}=R^{2}\cdot n\cdot \sin {\frac {\pi }{n}}\cdot \cos {\frac {\pi }{n}}}
The area of a regular n-gon inscribed in a unit-radius circle, with side s and interior angle
α
,
{\displaystyle \alpha ,}
can also be expressed trigonometrically as:
A
=
n
s
2
4
cot
π
n
=
n
s
2
4
cot
α
n
−
2
=
n
⋅
sin
α
n
−
2
⋅
cos
α
n
−
2
.
{\displaystyle A={\frac {ns^{2}}{4}}\cot {\frac {\pi }{n}}={\frac {ns^{2}}{4}}\cot {\frac {\alpha }{n-2}}=n\cdot \sin {\frac {\alpha }{n-2}}\cdot \cos {\frac {\alpha }{n-2}}.}
==== Self-intersecting ====
The area of a self-intersecting polygon can be defined in two different ways, giving different answers:
Using the formulas for simple polygons, we allow that particular regions within the polygon may have their area multiplied by a factor which we call the density of the region. For example, the central convex pentagon in the center of a pentagram has density 2. The two triangular regions of a cross-quadrilateral (like a figure 8) have opposite-signed densities, and adding their areas together can give a total area of zero for the whole figure.
Considering the enclosed regions as point sets, we can find the area of the enclosed point set. This corresponds to the area of the plane covered by the polygon or to the area of one or more simple polygons having the same outline as the self-intersecting one. In the case of the cross-quadrilateral, it is treated as two simple triangles.
=== Centroid ===
Using the same convention for vertex coordinates as in the previous section, the coordinates of the centroid of a solid simple polygon are
C
x
=
1
6
A
∑
i
=
0
n
−
1
(
x
i
+
x
i
+
1
)
(
x
i