Create a list of polygonal elements with x, y coordinates and theta for the square, circle, diamond and triangle. The number of slices in each element can be specified.
Arguments
- nslice
Number of slices in each element If nslice > 1, the elements are created with
polyfun()
.
Examples
polygons()
#> $square
#> $square[[1]]
#> $square[[1]]$x
#> [1] -0.5 -0.5 0.5 0.5
#>
#> $square[[1]]$y
#> [1] 0 1 1 0
#>
#>
#>
#> $circle
#> $circle[[1]]
#> $circle[[1]]$x
#> [1] 0.50000000 0.49589501 0.48364743 0.46345838 0.43565935 0.40070681
#> [7] 0.35917468 0.31174490 0.25919628 0.20239167 0.14226379 0.07979995
#> [13] 0.01602579 -0.04801151 -0.11126047 -0.17268253 -0.23126915 -0.28605833
#> [19] -0.33615045 -0.38072298 -0.41904405 -0.45048443 -0.47452787 -0.49077958
#> [25] -0.49897270 -0.49897270 -0.49077958 -0.47452787 -0.45048443 -0.41904405
#> [31] -0.38072298 -0.33615045 -0.28605833 -0.23126915 -0.17268253 -0.11126047
#> [37] -0.04801151 0.01602579 0.07979995 0.14226379 0.20239167 0.25919628
#> [43] 0.31174490 0.35917468 0.40070681 0.43565935 0.46345838 0.48364743
#> [49] 0.49589501 0.50000000
#>
#> $circle[[1]]$y
#> [1] 0.5000000000 0.5639385808 0.6268272920 0.6876335024 0.7453587760
#> [6] 0.7990552652 0.8478412753 0.8909157412 0.9275713815 0.9572063115
#> [11] 0.9793339265 0.9935908917 0.9997431081 0.9976895565 0.9874639561
#> [16] 0.9692342110 0.9432996532 0.9100861273 0.8701389985 0.8241141977
#> [21] 0.7727674506 0.7169418696 0.6575541090 0.5955793144 0.5320351100
#> [26] 0.4679648900 0.4044206856 0.3424458910 0.2830581304 0.2272325494
#> [31] 0.1758858023 0.1298610015 0.0899138727 0.0567003468 0.0307657890
#> [36] 0.0125360439 0.0023104435 0.0002568919 0.0064091083 0.0206660735
#> [41] 0.0427936885 0.0724286185 0.1090842588 0.1521587247 0.2009447348
#> [46] 0.2546412240 0.3123664976 0.3731727080 0.4360614192 0.5000000000
#>
#>
#>
#> $diamond
#> $diamond[[1]]
#> $diamond[[1]]$x
#> [1] 0.0 -0.5 0.0 0.5
#>
#> $diamond[[1]]$y
#> [1] 0.0 0.5 1.0 0.5
#>
#>
#>
#> $triangle
#> $triangle[[1]]
#> $triangle[[1]]$x
#> [1] 0.00 -0.56 0.56
#>
#> $triangle[[1]]$y
#> [1] 0 1 1
#>
#>
#>
polygons(4)
#> $square
#> $square[[1]]
#> $square[[1]]$x
#> [1] 0.000000e+00 5.551115e-17 -5.000000e-01 -5.000000e-01
#>
#> $square[[1]]$y
#> [1] 0.5 0.0 0.0 0.5
#>
#>
#> $square[[2]]
#> $square[[2]]$x
#> [1] 0.000000e+00 -5.000000e-01 -5.000000e-01 -1.110223e-16
#>
#> $square[[2]]$y
#> [1] 0.5 0.5 1.0 1.0
#>
#>
#> $square[[3]]
#> $square[[3]]$x
#> [1] 0.000000e+00 -1.110223e-16 5.000000e-01 5.000000e-01
#>
#> $square[[3]]$y
#> [1] 0.5 1.0 1.0 0.5
#>
#>
#> $square[[4]]
#> $square[[4]]$x
#> [1] 0.000000e+00 5.000000e-01 5.000000e-01 1.665335e-16
#>
#> $square[[4]]$y
#> [1] 0.5 0.5 0.0 0.0
#>
#>
#>
#> $circle
#> $circle[[1]]
#> $circle[[1]]$x
#> [1] 0.000000e+00 3.061617e-17 -6.526310e-02 -1.294095e-01 -1.913417e-01
#> [6] -2.500000e-01 -3.043807e-01 -3.535534e-01 -3.966767e-01 -4.330127e-01
#> [11] -4.619398e-01 -4.829629e-01 -4.957224e-01 -5.000000e-01
#>
#> $circle[[1]]$y
#> [1] 0.500000000 0.000000000 0.004277569 0.017037087 0.038060234 0.066987298
#> [7] 0.103323330 0.146446609 0.195619285 0.250000000 0.308658284 0.370590477
#> [13] 0.434736904 0.500000000
#>
#>
#> $circle[[2]]
#> $circle[[2]]$x
#> [1] 0.000000e+00 -5.000000e-01 -4.957224e-01 -4.829629e-01 -4.619398e-01
#> [6] -4.330127e-01 -3.966767e-01 -3.535534e-01 -3.043807e-01 -2.500000e-01
#> [11] -1.913417e-01 -1.294095e-01 -6.526310e-02 -9.184851e-17
#>
#> $circle[[2]]$y
#> [1] 0.5000000 0.5000000 0.5652631 0.6294095 0.6913417 0.7500000 0.8043807
#> [8] 0.8535534 0.8966767 0.9330127 0.9619398 0.9829629 0.9957224 1.0000000
#>
#>
#> $circle[[3]]
#> $circle[[3]]$x
#> [1] 0.000000e+00 -9.184851e-17 6.526310e-02 1.294095e-01 1.913417e-01
#> [6] 2.500000e-01 3.043807e-01 3.535534e-01 3.966767e-01 4.330127e-01
#> [11] 4.619398e-01 4.829629e-01 4.957224e-01 5.000000e-01
#>
#> $circle[[3]]$y
#> [1] 0.5000000 1.0000000 0.9957224 0.9829629 0.9619398 0.9330127 0.8966767
#> [8] 0.8535534 0.8043807 0.7500000 0.6913417 0.6294095 0.5652631 0.5000000
#>
#>
#> $circle[[4]]
#> $circle[[4]]$x
#> [1] 0.000000e+00 5.000000e-01 4.957224e-01 4.829629e-01 4.619398e-01
#> [6] 4.330127e-01 3.966767e-01 3.535534e-01 3.043807e-01 2.500000e-01
#> [11] 1.913417e-01 1.294095e-01 6.526310e-02 1.530808e-16
#>
#> $circle[[4]]$y
#> [1] 0.500000000 0.500000000 0.434736904 0.370590477 0.308658284 0.250000000
#> [7] 0.195619285 0.146446609 0.103323330 0.066987298 0.038060234 0.017037087
#> [13] 0.004277569 0.000000000
#>
#>
#>
#> $diamond
#> $diamond[[1]]
#> $diamond[[1]]$x
#> [1] 0.000000e+00 5.551115e-17 0.000000e+00 -5.000000e-01
#>
#> $diamond[[1]]$y
#> [1] 5.000000e-01 5.551115e-17 0.000000e+00 5.000000e-01
#>
#>
#> $diamond[[2]]
#> $diamond[[2]]$x
#> [1] 0.000000e+00 -5.000000e-01 -5.000000e-01 -1.110223e-16
#>
#> $diamond[[2]]$y
#> [1] 0.5 0.5 0.5 1.0
#>
#>
#> $diamond[[3]]
#> $diamond[[3]]$x
#> [1] 0.000000e+00 -1.110223e-16 0.000000e+00 5.000000e-01
#>
#> $diamond[[3]]$y
#> [1] 0.5 1.0 1.0 0.5
#>
#>
#> $diamond[[4]]
#> $diamond[[4]]$x
#> [1] 0.000000e+00 5.000000e-01 5.000000e-01 1.665335e-16
#>
#> $diamond[[4]]$y
#> [1] 5.000000e-01 5.000000e-01 5.000000e-01 1.665335e-16
#>
#>
#>
#> $triangle
#> $triangle[[1]]
#> $triangle[[1]]$x
#> [1] 0.00 0.00 -0.56 -0.28
#>
#> $triangle[[1]]$y
#> [1] 0.5 0.0 0.0 0.5
#>
#>
#> $triangle[[2]]
#> $triangle[[2]]$x
#> [1] 0.000000e+00 -2.800000e-01 0.000000e+00 -1.110223e-16
#>
#> $triangle[[2]]$y
#> [1] 0.5 0.5 1.0 1.0
#>
#>
#> $triangle[[3]]
#> $triangle[[3]]$x
#> [1] 0.000000e+00 -1.110223e-16 2.800000e-01
#>
#> $triangle[[3]]$y
#> [1] 0.5 1.0 0.5
#>
#>
#> $triangle[[4]]
#> $triangle[[4]]$x
#> [1] 0.000000e+00 2.800000e-01 5.600000e-01 1.110223e-16
#>
#> $triangle[[4]]$y
#> [1] 0.5 0.5 0.0 0.0
#>
#>
#>