-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpolygon_properties_prb_output.txt
736 lines (517 loc) · 15.7 KB
/
polygon_properties_prb_output.txt
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
20 October 2015 01:28:24 PM
POLYGON_PROPERTIES_PRB
C++ version
Test the POLYGON_PROPERTIES library.
POLYGON_ANGLES_TEST
POLYGON_ANGLES computes the angles of a polygon.
Number of polygonal vertices = 6
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 2 1
3: 3 0
4: 3 2
5: 1 2
Polygonal angles in degrees:
0 63.4349
1 135
2 270
3 45
4 90
5 116.565
POLYGON_AREA_TEST
POLYGON_AREA computes the area of a polygon.
Number of polygonal vertices = 4
The polygon vertices:
Row: 0 1
Col
0: 1 0
1: 2 1
2: 1 2
3: 0 1
Exact area is 2
The computed area is 2
Number of polygonal vertices = 8
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 3 0
2: 3 3
3: 2 3
4: 2 1
5: 1 1
6: 1 2
7: 0 2
Exact area is 6
The computed area is 6
POLYGON_AREA_2_TEST
POLYGON_AREA_2 computes the area of a polygon.
Number of polygonal vertices = 4
The polygon vertices:
Row: 0 1
Col
0: 1 0
1: 2 1
2: 1 2
3: 0 1
Exact area is 2
The computed area is 2
Number of polygonal vertices = 8
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 3 0
2: 3 3
3: 2 3
4: 2 1
5: 1 1
6: 1 2
7: 0 2
Exact area is 6
The computed area is 6
POLYGON_CENTROID_TEST
POLYGON_CENTROID computes the centroid of a polygon.
The polygon vertices:
Row: 0 1
Col
0: 1 0
1: 2 1
2: 1 2
3: 0 1
POLYGON_CENTROID:
0: 1
1: 1
POLYGON_CENTROID_2_TEST
POLYGON_CENTROID_2 computes the centroid of a polygon.
The polygon vertices:
Row: 0 1
Col
0: 1 0
1: 2 1
2: 1 2
3: 0 1
POLYGON_CENTROID_2:
0: 1
1: 1
POLYGON_CONTAINS_POINT_TEST
POLYGON_CONTAINS_POINT determines if a point is in a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 2 1
3: 1 2
4: 0 2
P Inside
1 1 1
3 4 0
0 2 1
0.5 -0.25 0
POLYGON_CONTAINS_POINT_2_TEST
POLYGON_CONTAINS_POINT_2 determines if a point is in a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 2 1
3: 1 2
4: 0 2
P Inside
1 1 1
3 4 0
0 2 1
0.5 -0.25 0
POLYGON_DIAMETER_TEST
POLYGON_DIAMETER computes the diameter of a polygon.
The polygon vertices:
Row: 0 1
Col
0: 1 0
1: 2 1
2: 1 2
3: 0 1
Diameter ( computed ) 2
Diameter ( exact ) 2
POLGON_EXPAND_TEST
POLYGON_EXPAND expands a polygon by an amount H.
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 5 1
2: 2 4
3: 1 3
The expansion amount H = 0.5
The expanded polygon:
Row: 0 1
Col
0: 0.5 0.5
1: 6.20711 0.5
2: 2 4.70711
3: 0.5 3.20711
POLYGON_INRAD_DATA_TEST
POLYGON_INRAD_DATA uses the inradius of a regular polygon
to compute the area, outradius, and side length.
Number of polygonal sides = 3
Assuming RADIN = 1
AREA = 5.19615
RADOUT = 2
SIDE = 3.4641
Number of polygonal sides = 4
Assuming RADIN = 1
AREA = 4
RADOUT = 1.41421
SIDE = 2
Number of polygonal sides = 5
Assuming RADIN = 1
AREA = 3.63271
RADOUT = 1.23607
SIDE = 1.45309
POLYGON_INTEGRAL_1_TEST
POLYGON_INTEGRAL_1 integrates 1 over a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
1 1
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
1 5
POLYGON_INTEGRAL_X_TEST
POLYGON_INTEGRAL_X integrates x over a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
x 0.5
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
x 11.6667
POLYGON_INTEGRAL_XX_TEST
POLYGON_INTEGRAL_XX integrates x^2 over a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
x^2 0.333333
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
x^2 29.1667
POLYGON_INTEGRAL_XY_TEST
POLYGON_INTEGRAL_XY integrates xy over a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
x*y 0.25
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
x*y 35.8333
POLYGON_INTEGRAL_Y_TEST
POLYGON_INTEGRAL_Y integrates y over a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
y 0.5
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
y 15
POLYGON_INTEGRAL_YY_TEST
POLYGON_INTEGRAL_YY integrates y^2 over a polygon.
The polygon vertices:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
y^2 0.333333
The polygon vertices:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
y^2 48.3333
POLYGON_IS_CONVEX_TEST
POLYGON_IS_CONVEX determines if a polygon is convex.
A point:
Row: 0 1
Col
0: 0 0
The polygon is degenerate and convex.
A line:
Row: 0 1
Col
0: 0 0
1: 1 2
The polygon is degenerate and convex.
A triangle:
Row: 0 1
Col
0: 0 0
1: 2 0
2: 1 0
The polygon is convex and clockwise.
A CCW triangle:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 0 2
The polygon is convex and counterclockwise.
A CW triangle:
Row: 0 1
Col
0: 0 0
1: 0 2
2: 1 0
The polygon is convex and clockwise.
Polygon with large angle:
Row: 0 1
Col
0: 1 0
1: 2 0
2: 3 1
3: 0 1
The polygon is convex and counterclockwise.
Polygon with huge angle:
Row: 0 1
Col
0: 0 0
1: 0.5 0.5
2: 1 0
3: 1 1
4: 0 1
The polygon is not convex.
A five-pointed star:
Row: 0 1
Col
0: 1 0
1: -0.809017 0.587785
2: 0.309017 -0.951057
3: 0.309017 0.951057
4: -0.809017 -0.587785
The polygon is not convex.
A hexagon:
Row: 0 1
Col
0: 1 0
1: 0.5 0.866025
2: -0.5 0.866025
3: -1 1.22465e-16
4: -0.5 -0.866025
5: 0.5 -0.866025
The polygon is convex and counterclockwise.
A triangle twice:
Row: 0 1
Col
0: 0 0
1: 2 0
2: 1 1
3: 0 0
4: 2 0
5: 1 1
The polygon is not convex.
Square knot:
Row: 0 1
Col
0: 1 0
1: 3 0
2: 3 3
3: 0 3
4: 0 1
5: 2 1
6: 2 2
7: 1 2
The polygon is not convex.
POLYGON_LATTICE_AREA_TEST
POLYGON_LATTICE_AREA returns the area
of a polygon, measured in lattice points.
Number of interior lattice points = 5
Number of boundary lattice points = 6
Area of polygon is 7
POLYGON_OUTRAD_DATA_TEST
POLYGON_OUTRAD_DATA uses the outradius of a regular polygon
to determine the area, inradius, and side length.
Number of polygonal sides = 3
Assuming RADOUT = 1
AREA = 1.29904
RADIN = 0.5
SIDE = 1.73205
Number of polygonal sides = 4
Assuming RADOUT = 1
AREA = 2
RADIN = 0.707107
SIDE = 1.41421
Number of polygonal sides = 5
Assuming RADOUT = 1
AREA = 2.37764
RADIN = 0.809017
SIDE = 1.17557
POLYGON_PERIMETER_TEST
POLYGON_PERIMETER computes the perimeter of a polygon
Vertices of polygon V1:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
Perimeter = 4
Vertices of polygon V2:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
Perimeter = 10.5571
POLYGON_PERIMETER_QUAD_TEST
POLYGON_PERIMETER_QUAD estimates the integral of
a function over the perimeter of a polygon using
the composite midpoint rule over each side.
Vertices of polygon V1:
Row: 0 1
Col
0: 0 0
1: 1 0
2: 1 1
3: 0 1
Using HMAX = 0.5, estimated integral of 1 over perimeter = 4
Using HMAX = 1, estimated integral of x^2 over perimeter = 1.5
Using HMAX = 0.5, estimated integral of x^2 over perimeter = 1.625
Using HMAX = 0.25, estimated integral of x^2 over perimeter = 1.65625
Vertices of polygon V2:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
Using HMAX = 0.5, estimated integral of 1 over perimeter = 10.5571
Using HMAX = 1, estimated integral of x^2 over perimeter = 60.9706
Using HMAX = 0.5, estimated integral of x^2 over perimeter = 61.1854
Using HMAX = 0.25, estimated integral of x^2 over perimeter = 61.2383
POLYGON_POINT_DIST_TEST
POLYGON_POINT_DIST computes polygon-point distance.
Vertices of polygon:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
X Y DIST
4 5 1.41421
2 3 0.485071
-2 -1 3.60555
POLYGON_POINT_NEAR_TEST
POLYGON_POINT_NEAR computes nearest point on polygon.
Vertices of polygon:
Row: 0 1
Col
0: 1 1
1: 4 3
2: 2 5
X Y XN YN
4 5 3 4
2 3 1.52941 3.11765
-2 -1 1 1
POLYGON_SAMPLE_TEST
POLYGON_SAMPLE samples a polygon.
Sample points:
Row: 0 1
Col
0: 1.57165 0.0436824
1: 1.48143 0.584693
2: 1.69243 0.109957
3: 0.511266 1.44954
4: 1.44804 0.754673
5: 0.496513 0.102496
6: 0.254573 0.0136169
7: 1.86187 0.130616
8: 0.0522955 0.0875163
9: 0.180039 0.177113
10: 0.577122 1.13878
11: 1.49011 0.911977
12: 0.316961 0.238508
13: 0.117215 0.574366
14: 0.574459 1.21293
15: 0.417036 1.29933
16: 1.05162 0.886522
17: 0.866277 1.77799
18: 0.791952 1.10063
19: 0.8313 1.59303
POLYGON_SIDE_DATA_TEST
POLYGON_SIDE_DATA uses the side length of a regular polygon
to determine the area, inradius and outradius.
Number of polygonal sides = 3
Assuming SIDE = 1
AREA = 0.433013
RADIN = 0.288675
RADOUT = 0.57735
Number of polygonal sides = 4
Assuming SIDE = 1
AREA = 1
RADIN = 0.5
RADOUT = 0.707107
Number of polygonal sides = 5
Assuming SIDE = 1
AREA = 1.72048
RADIN = 0.688191
RADOUT = 0.850651
POLYGON_TRIANGULATE_TEST
POLYGON_TRIANGULATE triangulates a polygon.
Here, we triangulate the comb_10 polygon.
Triangles:
0: 2 0 1
1: 4 2 3
2: 6 4 5
3: 8 6 7
4: 9 6 8
5: 2 9 0
6: 4 9 2
7: 6 9 4
POLYGON_PROPERTIES_PRB
Normal end of execution.
20 October 2015 01:28:24 PM