Skip to contents

Create a list of x and y coordinates for a polygon with a given number of slices and a list of coordinates for the polygon.

Usage

polyfun(nslice, coor)

Arguments

nslice

Number of slices in the polygon

coor

Element form which to generate the polygon containing x and y coordinates and theta

Value

a list of x and y coordinates

Examples

polyfun(2, list(
    x = c(-0.5, -0.5, 0.5, 0.5),
    y = c(-0.5, 0.5, 0.5, -0.5),
    theta = -c(3, 5, 7, 9) * pi / 4
))
#> [[1]]
#> [[1]]$x
#> [1]  0.000000e+00  5.551115e-17 -5.000000e-01 -5.000000e-01 -1.110223e-16
#> 
#> [[1]]$y
#> [1] 0.5 0.0 0.0 1.0 1.0
#> 
#> 
#> [[2]]
#> [[2]]$x
#> [1]  0.000000e+00 -1.110223e-16  5.000000e-01  5.000000e-01  1.665335e-16
#> 
#> [[2]]$y
#> [1] 0.5 1.0 1.0 0.0 0.0
#> 
#>