Skip to contents

Sample points at regular angular intervals from the centroid (radial sampling).

Usage

coo_sample_regular_radius(x, ..., .cols = NULL, .ldk_col = NULL)

Arguments

x

A matrix (nx2), list of matrices, or tibble with coo columns.

...

Additional arguments (reserved for future use).

.cols

Column name(s) to process when x is a tibble. If NULL, automatically detects columns containing coo columns.

.ldk_col

Character. Name of landmark column. If NULL, uses colname_ldk.

n

Integer. Number of points to sample.

Value

  • If x is a single matrix: returns the sampled matrix

  • If x is a list: returns a list of sampled matrices

  • If x is a tibble: returns the tibble with sampled coo column(s)

Details

Samples points at regular angular intervals from the centroid, like spokes on a wheel. For each target angle, finds the outline point closest to that direction.

Landmarks are NOT preserved - this resampling method fundamentally changes the point structure.

See also

coo_sample() for arc-length sampling

Examples

# Sample at 64 regular angles
coo_sample_regular_radius(shapes$cat, n = 64)
#> <xy [64 x 2]>
#>       [,1] [,2]
#>  [1,] 221   97 
#>  [2,] 221   97 
#>  [3,] 221  102 
#>  [4,] 221  102 
#>  [5,] 222  108 
#>  [6,] ...  ... 
#>  [7,] 133   92 
#>  [8,] 133   92 
#>  [9,] 133   92 
#> [10,] 133   92 
#> [11,] 133   92 

# Works on lists
coo_sample_regular_radius(bot$coo, n = 32)
#> $brahma
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 297  534 
#>  [2,] 305  576 
#>  [3,] 310  608 
#>  [4,] 310  639 
#>  [5,] 307  681 
#>  [6,] ...  ... 
#>  [7,]  40  540 
#>  [8,]  40  540 
#>  [9,]  40  540 
#> [10,]  40  540 
#> [11,]  40  540 
#> 
#> $caney
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 310  503 
#>  [2,] 311  543 
#>  [3,] 309  563 
#>  [4,] 304  583 
#>  [5,] 285  624 
#>  [6,] ...  ... 
#>  [7,]  54  505 
#>  [8,]  54  505 
#>  [9,]  54  505 
#> [10,]  54  505 
#> [11,]  54  505 
#> 
#> $chimay
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 286  317 
#>  [2,] 286  341 
#>  [3,] 284  364 
#>  [4,] 273  387 
#>  [5,] 265  401 
#>  [6,] ...  ... 
#>  [7,]  50  310 
#>  [8,]  50  310 
#>  [9,]  50  310 
#> [10,]  50  310 
#> [11,]  50  310 
#> 
#> $corona
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 276  410 
#>  [2,] 276  421 
#>  [3,] 273  452 
#>  [4,] 270  461 
#>  [5,] 256  491 
#>  [6,] ...  ... 
#>  [7,]  90  395 
#>  [8,]  90  395 
#>  [9,]  90  395 
#> [10,]  90  395 
#> [11,]  90  395 
#> 
#> $deusventrue
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 294  472 
#>  [2,] 290  481 
#>  [3,] 276  510 
#>  [4,] 271  519 
#>  [5,] 260  547 
#>  [6,] ...  ... 
#>  [7,]  62  454 
#>  [8,]  62  454 
#>  [9,]  62  454 
#> [10,]  62  454 
#> [11,]  62  454 
#> 
#> $duvel
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 298  282 
#>  [2,] 297  315 
#>  [3,] 295  336 
#>  [4,] 288  358 
#>  [5,] 274  380 
#>  [6,] ...  ... 
#>  [7,]  61  282 
#>  [8,]  61  282 
#>  [9,]  61  282 
#> [10,]  61  282 
#> [11,]  61  282 
#> 
#> $franziskaner
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 266  419 
#>  [2,] 266  450 
#>  [3,] 266  461 
#>  [4,] 266  492 
#>  [5,] 262  523 
#>  [6,] ...  ... 
#>  [7,]  54  418 
#>  [8,]  54  418 
#>  [9,]  54  418 
#> [10,]  54  418 
#> [11,]  54  418 
#> 
#> $grimbergen
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 291  389 
#>  [2,] 290  420 
#>  [3,] 282  450 
#>  [4,] 276  461 
#>  [5,] 257  489 
#>  [6,] ...  ... 
#>  [7,]  40  394 
#>  [8,]  40  394 
#>  [9,]  40  394 
#> [10,]  40  394 
#> [11,]  40  394 
#> 
#> $guiness
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 295  374 
#>  [2,] 295  391 
#>  [3,] 295  423 
#>  [4,] 292  439 
#>  [5,] 276  472 
#>  [6,] ...  ... 
#>  [7,]  69  369 
#>  [8,]  69  369 
#>  [9,]  69  369 
#> [10,]  69  369 
#> [11,]  69  369 
#> 
#> $hoegardeen
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 305  527 
#>  [2,] 302  552 
#>  [3,] 298  577 
#>  [4,] 291  602 
#>  [5,] 280  639 
#>  [6,] ...  ... 
#>  [7,]  40  519 
#>  [8,]  40  519 
#>  [9,]  40  519 
#> [10,]  40  519 
#> [11,]  40  519 
#> 
#> $jupiler
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 294  518 
#>  [2,] 292  531 
#>  [3,] 287  559 
#>  [4,] 280  586 
#>  [5,] 272  613 
#>  [6,] ...  ... 
#>  [7,]  54  501 
#>  [8,]  54  501 
#>  [9,]  54  501 
#> [10,]  54  501 
#> [11,]  54  501 
#> 
#> $kingfisher
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 255  365 
#>  [2,] 253  384 
#>  [3,] 249  404 
#>  [4,] 244  422 
#>  [5,] 239  442 
#>  [6,] ...  ... 
#>  [7,]  71  365 
#>  [8,]  71  365 
#>  [9,]  71  365 
#> [10,]  71  365 
#> [11,]  71  365 
#> 
#> $latrappe
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 326  340 
#>  [2,] 326  377 
#>  [3,] 326  402 
#>  [4,] 325  440 
#>  [5,] 312  489 
#>  [6,] ...  ... 
#>  [7,]  25  339 
#>  [8,]  25  339 
#>  [9,]  25  339 
#> [10,]  25  339 
#> [11,]  25  339 
#> 
#> $lindemanskriek
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 270  403 
#>  [2,] 265  427 
#>  [3,] 262  443 
#>  [4,] 254  468 
#>  [5,] 247  493 
#>  [6,] ...  ... 
#>  [7,]  55  404 
#>  [8,]  55  404 
#>  [9,]  55  404 
#> [10,]  55  404 
#> [11,]  55  404 
#> 
#> $nicechouffe
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 262  342 
#>  [2,] 259  358 
#>  [3,] 256  374 
#>  [4,] 251  391 
#>  [5,] 244  415 
#>  [6,] ...  ... 
#>  [7,]  77  336 
#>  [8,]  77  336 
#>  [9,]  77  336 
#> [10,]  77  336 
#> [11,]  77  336 
#> 
#> $pecheresse
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 286  489 
#>  [2,] 283  509 
#>  [3,] 277  538 
#>  [4,] 273  557 
#>  [5,] 266  585 
#>  [6,] ...  ... 
#>  [7,]  61  476 
#>  [8,]  61  476 
#>  [9,]  61  476 
#> [10,]  61  476 
#> [11,]  61  476 
#> 
#> $sierranevada
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 272  329 
#>  [2,] 272  354 
#>  [3,] 271  379 
#>  [4,] 268  403 
#>  [5,] 255  428 
#>  [6,] ...  ... 
#>  [7,]  61  333 
#>  [8,]  61  333 
#>  [9,]  61  333 
#> [10,]  61  333 
#> [11,]  61  333 
#> 
#> $tanglefoot
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 298  345 
#>  [2,] 299  369 
#>  [3,] 300  401 
#>  [4,] 295  425 
#>  [5,] 282  448 
#>  [6,] ...  ... 
#>  [7,]  48  335 
#>  [8,]  48  335 
#>  [9,]  48  335 
#> [10,]  48  335 
#> [11,]  48  335 
#> 
#> $tauro
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 293  520 
#>  [2,] 293  532 
#>  [3,] 288  557 
#>  [4,] 282  581 
#>  [5,] 275  605 
#>  [6,] ...  ... 
#>  [7,]  54  503 
#>  [8,]  54  503 
#>  [9,]  54  503 
#> [10,]  54  503 
#> [11,]  54  503 
#> 
#> $westmalle
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 254  389 
#>  [2,] 252  397 
#>  [3,] 247  421 
#>  [4,] 244  436 
#>  [5,] 237  460 
#>  [6,] ...  ... 
#>  [7,]  67  369 
#>  [8,]  67  369 
#>  [9,]  67  369 
#> [10,]  67  369 
#> [11,]  67  369 
#> 
#> $amrut
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 268  423 
#>  [2,] 268  443 
#>  [3,] 268  463 
#>  [4,] 268  493 
#>  [5,] 267  523 
#>  [6,] ...  ... 
#>  [7,]  57  411 
#>  [8,]  57  411 
#>  [9,]  57  411 
#> [10,]  57  411 
#> [11,]  57  411 
#> 
#> $ballantines
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 309  335 
#>  [2,] 309  359 
#>  [3,] 308  382 
#>  [4,] 308  414 
#>  [5,] 307  461 
#>  [6,] ...  ... 
#>  [7,]  38  318 
#>  [8,]  38  318 
#>  [9,]  38  318 
#> [10,]  38  318 
#> [11,]  38  318 
#> 
#> $bushmills
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 288  430 
#>  [2,] 288  460 
#>  [3,] 288  476 
#>  [4,] 288  507 
#>  [5,] 290  537 
#>  [6,] ...  ... 
#>  [7,]  72  425 
#>  [8,]  72  425 
#>  [9,]  72  425 
#> [10,]  72  425 
#> [11,]  72  425 
#> 
#> $chivas
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 332  406 
#>  [2,] 330  431 
#>  [3,] 315  464 
#>  [4,] 297  486 
#>  [5,] 281  501 
#>  [6,] ...  ... 
#>  [7,]  29  404 
#>  [8,]  29  404 
#>  [9,]  29  404 
#> [10,]  29  404 
#> [11,]  29  404 
#> 
#> $dalmore
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 311  334 
#>  [2,] 306  359 
#>  [3,] 295  384 
#>  [4,] 286  396 
#>  [5,] 262  421 
#>  [6,] ...  ... 
#>  [7,]  42  322 
#>  [8,]  42  322 
#>  [9,]  42  322 
#> [10,]  42  322 
#> [11,]  42  322 
#> 
#> $famousgrouse
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 250  296 
#>  [2,] 250  315 
#>  [3,] 250  334 
#>  [4,] 250  353 
#>  [5,] 250  372 
#>  [6,] ...  ... 
#>  [7,]  99  294 
#>  [8,]  99  294 
#>  [9,]  99  294 
#> [10,]  99  294 
#> [11,]  99  294 
#> 
#> $glendronach
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 272  404 
#>  [2,] 272  428 
#>  [3,] 272  452 
#>  [4,] 272  476 
#>  [5,] 270  512 
#>  [6,] ...  ... 
#>  [7,]  74  399 
#>  [8,]  74  399 
#>  [9,]  74  399 
#> [10,]  74  399 
#> [11,]  74  399 
#> 
#> $glenmorangie
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 298  491 
#>  [2,] 300  524 
#>  [3,] 300  541 
#>  [4,] 298  574 
#>  [5,] 289  608 
#>  [6,] ...  ... 
#>  [7,]  54  485 
#>  [8,]  54  485 
#>  [9,]  54  485 
#> [10,]  54  485 
#> [11,]  54  485 
#> 
#> $highlandpark
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 291  347 
#>  [2,] 291  375 
#>  [3,] 291  403 
#>  [4,] 291  431 
#>  [5,] 293  473 
#>  [6,] ...  ... 
#>  [7,]  42  343 
#>  [8,]  42  343 
#>  [9,]  42  343 
#> [10,]  42  343 
#> [11,]  42  343 
#> 
#> $jackdaniels
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 301  389 
#>  [2,] 301  415 
#>  [3,] 300  441 
#>  [4,] 298  467 
#>  [5,] 291  492 
#>  [6,] ...  ... 
#>  [7,]  63  375 
#>  [8,]  63  375 
#>  [9,]  63  375 
#> [10,]  63  375 
#> [11,]  63  375 
#> 
#> $jb
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 300  500 
#>  [2,] 299  532 
#>  [3,] 300  554 
#>  [4,] 302  597 
#>  [5,] 293  629 
#>  [6,] ...  ... 
#>  [7,]  42  488 
#>  [8,]  42  488 
#>  [9,]  42  488 
#> [10,]  42  488 
#> [11,]  42  488 
#> 
#> $johnniewalker
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 217  164 
#>  [2,] 217  176 
#>  [3,] 217  184 
#>  [4,] 217  192 
#>  [5,] 217  208 
#>  [6,] ...  ... 
#>  [7,] 133  163 
#>  [8,] 133  163 
#>  [9,] 133  163 
#> [10,] 133  163 
#> [11,] 133  163 
#> 
#> $magallan
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 255  385 
#>  [2,] 255  400 
#>  [3,] 257  421 
#>  [4,] 258  450 
#>  [5,] 258  479 
#>  [6,] ...  ... 
#>  [7,]  78  382 
#>  [8,]  78  382 
#>  [9,]  78  382 
#> [10,]  78  382 
#> [11,]  78  382 
#> 
#> $makersmark
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 338  400 
#>  [2,] 326  426 
#>  [3,] 303  449 
#>  [4,] 276  469 
#>  [5,] 262  490 
#>  [6,] ...  ... 
#>  [7,]  13  394 
#>  [8,]  13  394 
#>  [9,]  13  394 
#> [10,]  13  394 
#> [11,]  13  394 
#> 
#> $oban
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 278  449 
#>  [2,] 279  466 
#>  [3,] 279  492 
#>  [4,] 280  509 
#>  [5,] 277  543 
#>  [6,] ...  ... 
#>  [7,]  74  431 
#>  [8,]  74  431 
#>  [9,]  74  431 
#> [10,]  74  431 
#> [11,]  74  431 
#> 
#> $oldpotrero
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 265  282 
#>  [2,] 256  298 
#>  [3,] 238  323 
#>  [4,] 232  331 
#>  [5,] 226  340 
#>  [6,] ...  ... 
#>  [7,]  63  274 
#>  [8,]  63  274 
#>  [9,]  63  274 
#> [10,]  63  274 
#> [11,]  63  274 
#> 
#> $redbreast
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 255  200 
#>  [2,] 255  214 
#>  [3,] 248  233 
#>  [4,] 236  246 
#>  [5,] 227  252 
#>  [6,] ...  ... 
#>  [7,]  97  200 
#>  [8,]  97  200 
#>  [9,]  97  200 
#> [10,]  97  200 
#> [11,]  97  200 
#> 
#> $tamdhu
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 299  527 
#>  [2,] 299  551 
#>  [3,] 301  588 
#>  [4,] 302  625 
#>  [5,] 298  650 
#>  [6,] ...  ... 
#>  [7,]  49  527 
#>  [8,]  49  527 
#>  [9,]  49  527 
#> [10,]  49  527 
#> [11,]  49  527 
#> 
#> $wildturkey
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 327  537 
#>  [2,] 327  565 
#>  [3,] 330  606 
#>  [4,] 327  634 
#>  [5,] 312  676 
#>  [6,] ...  ... 
#>  [7,]  18  527 
#>  [8,]  18  527 
#>  [9,]  18  527 
#> [10,]  18  527 
#> [11,]  18  527 
#> 
#> $yoichi
#> <xy [32 x 2]>
#>       [,1] [,2]
#>  [1,] 292  356 
#>  [2,] 293  386 
#>  [3,] 293  408 
#>  [4,] 294  437 
#>  [5,] 293  481 
#>  [6,] ...  ... 
#>  [7,]  69  355 
#>  [8,]  69  355 
#>  [9,]  69  355 
#> [10,]  69  355 
#> [11,]  69  355 
#> 
#> attr(,"class")
#> [1] "out"  "coo"  "list"

# Works on tibbles
coo_sample_regular_radius(bot, n = 128)
#> # A tibble: 40 × 3
#>    coo       type   dummy
#>    <out>     <fct>  <fct>
#>  1 (128 x 2) whisky a    
#>  2 (128 x 2) whisky a    
#>  3 (128 x 2) whisky a    
#>  4 (128 x 2) whisky a    
#>  5 (128 x 2) whisky a    
#>  6 (128 x 2) whisky a    
#>  7 (128 x 2) whisky a    
#>  8 (128 x 2) whisky a    
#>  9 (128 x 2) whisky a    
#> 10 (128 x 2) whisky a    
#> # ℹ 30 more rows