Skip to contents

Keep only points in a specific direction relative to the centroid.

Usage

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

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

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

coo_left(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.

Value

  • If x is a single matrix: returns the filtered matrix (open curve)

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

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

Details

Filters points based on their position relative to the centroid:

  • coo_up(): Keep points with y > centroid_y

  • coo_down(): Keep points with y < centroid_y

  • coo_right(): Keep points with x > centroid_x

  • coo_left(): Keep points with x < centroid_x

Returns an open curve. Landmarks are synced.

See also

coo_extract() for extracting specific points

Examples

# Keep upper half
coo_up(shapes$cat)
#> <xy [51 x 2]>
#>       [,1] [,2]
#>  [1,] 133   98 
#>  [2,] 133  104 
#>  [3,] 134  110 
#>  [4,] 134  116 
#>  [5,] 136  122 
#>  [6,] ...  ... 
#>  [7,] 227  120 
#>  [8,] 224  114 
#>  [9,] 222  108 
#> [10,] 221  102 
#> [11,] 221   97 

# Keep right half
coo_right(bot$coo)
#> $brahma
#> <xy [69 x 2]>
#>       [,1] [,2]
#>  [1,] 185   15 
#>  [2,] 196   15 
#>  [3,] 217   16 
#>  [4,] 238   18 
#>  [5,] 259   24 
#>  [6,] ...  ... 
#>  [7,]  229 1068
#>  [8,]  232 1087
#>  [9,]  226 1096
#> [10,]  205 1101
#> [11,]  183 1102
#> 
#> $caney
#> <xy [85 x 2]>
#>       [,1] [,2]
#>  [1,] 184   26 
#>  [2,] 203   28 
#>  [3,] 213   29 
#>  [4,] 223   31 
#>  [5,] 243   35 
#>  [6,] ...  ... 
#>  [7,]  235 1009
#>  [8,]  215 1017
#>  [9,]  205 1018
#> [10,]  195 1020
#> [11,]  185 1020
#> 
#> $chimay
#> <xy [95 x 2]>
#>       [,1] [,2]
#>  [1,] 170   11 
#>  [2,] 184   11 
#>  [3,] 192   13 
#>  [4,] 200   13 
#>  [5,] 208   14 
#>  [6,] ...  ... 
#>  [7,] 202  651 
#>  [8,] 194  654 
#>  [9,] 187  654 
#> [10,] 179  654 
#> [11,] 171  654 
#> 
#> $corona
#> <xy [65 x 2]>
#>       [,1] [,2]
#>  [1,] 195   17 
#>  [2,] 205   17 
#>  [3,] 216   19 
#>  [4,] 235   21 
#>  [5,] 246   23 
#>  [6,] ...  ... 
#>  [7,] 226  796 
#>  [8,] 225  807 
#>  [9,] 216  822 
#> [10,] 205  822 
#> [11,] 195  822 
#> 
#> $deusventrue
#> <xy [76 x 2]>
#>       [,1] [,2]
#>  [1,] 189   53 
#>  [2,] 199   53 
#>  [3,] 219   53 
#>  [4,] 228   53 
#>  [5,] 238   54 
#>  [6,] ...  ... 
#>  [7,] 228  909 
#>  [8,] 225  919 
#>  [9,] 211  932 
#> [10,] 201  935 
#> [11,] 191  939 
#> 
#> $duvel
#> <xy [81 x 2]>
#>       [,1] [,2]
#>  [1,] 184   11 
#>  [2,] 195   11 
#>  [3,] 206   11 
#>  [4,] 217   12 
#>  [5,] 217   12 
#>  [6,] ...  ... 
#>  [7,] 215  606 
#>  [8,] 204  613 
#>  [9,] 193  616 
#> [10,] 193  616 
#> [11,] 182  617 
#> 
#> $franziskaner
#> <xy [62 x 2]>
#>       [,1] [,2]
#>  [1,] 175    5 
#>  [2,] 184    7 
#>  [3,] 205    8 
#>  [4,] 215   10 
#>  [5,] 236   15 
#>  [6,] ...  ... 
#>  [7,] 203  837 
#>  [8,] 203  847 
#>  [9,] 202  867 
#> [10,] 182  868 
#> [11,] 171  870 
#> 
#> $grimbergen
#> <xy [63 x 2]>
#>       [,1] [,2]
#>  [1,] 174   25 
#>  [2,] 184   25 
#>  [3,] 205   27 
#>  [4,] 216   29 
#>  [5,] 237   32 
#>  [6,] ...  ... 
#>  [7,] 218  764 
#>  [8,] 215  785 
#>  [9,] 204  789 
#> [10,] 194  790 
#> [11,] 173  790 
#> 
#> $guiness
#> <xy [91 x 2]>
#>       [,1] [,2]
#>  [1,] 190   17 
#>  [2,] 206   18 
#>  [3,] 214   18 
#>  [4,] 223   19 
#>  [5,] 231   19 
#>  [6,] ...  ... 
#>  [7,] 221  752 
#>  [8,] 214  757 
#>  [9,] 206  759 
#> [10,] 198  759 
#> [11,] 190  759 
#> 
#> $hoegardeen
#> <xy [97 x 2]>
#>       [,1] [,2]
#>  [1,] 174   21 
#>  [2,] 187   21 
#>  [3,] 198   23 
#>  [4,] 211   23 
#>  [5,] 224   25 
#>  [6,] ...  ... 
#>  [7,]  229 1055
#>  [8,]  220 1064
#>  [9,]  207 1068
#> [10,]  194 1069
#> [11,]  181 1069
#> 
#> $jupiler
#> <xy [79 x 2]>
#>       [,1] [,2]
#>  [1,] 177   34 
#>  [2,] 190   35 
#>  [3,] 204   37 
#>  [4,] 218   39 
#>  [5,] 231   42 
#>  [6,] ...  ... 
#>  [7,]  236  994
#>  [8,]  227 1007
#>  [9,]  213 1014
#> [10,]  200 1017
#> [11,]  186 1018
#> 
#> $kingfisher
#> <xy [91 x 2]>
#>       [,1] [,2]
#>  [1,] 169   18 
#>  [2,] 169   18 
#>  [3,] 178   20 
#>  [4,] 188   20 
#>  [5,] 197   22 
#>  [6,] ...  ... 
#>  [7,] 189  709 
#>  [8,] 192  719 
#>  [9,] 189  729 
#> [10,] 181  735 
#> [11,] 171  736 
#> 
#> $latrappe
#> <xy [68 x 2]>
#>       [,1] [,2]
#>  [1,] 188   11 
#>  [2,] 201   11 
#>  [3,] 213   11 
#>  [4,] 226   11 
#>  [5,] 238   11 
#>  [6,] ...  ... 
#>  [7,] 230  721 
#>  [8,] 217  744 
#>  [9,] 205  747 
#> [10,] 192  747 
#> [11,] 180  747 
#> 
#> $lindemanskriek
#> <xy [89 x 2]>
#>       [,1] [,2]
#>  [1,] 172   14 
#>  [2,] 189   14 
#>  [3,] 197   15 
#>  [4,] 205   17 
#>  [5,] 214   18 
#>  [6,] ...  ... 
#>  [7,] 205  823 
#>  [8,] 189  832 
#>  [9,] 181  834 
#> [10,] 172  835 
#> [11,] 164  835 
#> 
#> $nicechouffe
#> <xy [73 x 2]>
#>       [,1] [,2]
#>  [1,] 175   17 
#>  [2,] 184   17 
#>  [3,] 192   17 
#>  [4,] 209   17 
#>  [5,] 217   17 
#>  [6,] ...  ... 
#>  [7,] 205  665 
#>  [8,] 200  682 
#>  [9,] 199  691 
#> [10,] 194  698 
#> [11,] 186  701 
#> 
#> $pecheresse
#> <xy [65 x 2]>
#>       [,1] [,2]
#>  [1,] 177   36 
#>  [2,] 187   36 
#>  [3,] 207   38 
#>  [4,] 226   40 
#>  [5,] 246   46 
#>  [6,] ...  ... 
#>  [7,] 237  933 
#>  [8,] 232  950 
#>  [9,] 219  959 
#> [10,] 209  962 
#> [11,] 191  964 
#> 
#> $sierranevada
#> <xy [89 x 2]>
#>       [,1] [,2]
#>  [1,] 171   26 
#>  [2,] 171   26 
#>  [3,] 183   26 
#>  [4,] 196   26 
#>  [5,] 208   27 
#>  [6,] ...  ... 
#>  [7,] 206  669 
#>  [8,] 194  677 
#>  [9,] 182  679 
#> [10,] 182  679 
#> [11,] 169  680 
#> 
#> $tanglefoot
#> <xy [87 x 2]>
#>       [,1] [,2]
#>  [1,] 182   32 
#>  [2,] 190   32 
#>  [3,] 198   32 
#>  [4,] 206   32 
#>  [5,] 222   32 
#>  [6,] ...  ... 
#>  [7,] 220  707 
#>  [8,] 213  712 
#>  [9,] 205  712 
#> [10,] 197  712 
#> [11,] 181  712 
#> 
#> $tauro
#> <xy [88 x 2]>
#>       [,1] [,2]
#>  [1,] 184   34 
#>  [2,] 195   36 
#>  [3,] 208   38 
#>  [4,] 220   39 
#>  [5,] 232   41 
#>  [6,] ...  ... 
#>  [7,]  228 1007
#>  [8,]  215 1013
#>  [9,]  204 1017
#> [10,]  192 1018
#> [11,]  180 1018
#> 
#> $westmalle
#> <xy [70 x 2]>
#>       [,1] [,2]
#>  [1,] 174   12 
#>  [2,] 182   12 
#>  [3,] 199   14 
#>  [4,] 207   16 
#>  [5,] 224   22 
#>  [6,] ...  ... 
#>  [7,] 202  744 
#>  [8,] 201  760 
#>  [9,] 197  768 
#> [10,] 182  776 
#> [11,] 174  776 
#> 
#> $amrut
#> <xy [96 x 2]>
#>       [,1] [,2]
#>  [1,] 168   11 
#>  [2,] 178   11 
#>  [3,] 188   11 
#>  [4,] 198   11 
#>  [5,] 208   12 
#>  [6,] ...  ... 
#>  [7,] 200  864 
#>  [8,] 193  871 
#>  [9,] 184  874 
#> [10,] 174  875 
#> [11,] 164  875 
#> 
#> $ballantines
#> <xy [73 x 2]>
#>       [,1] [,2]
#>  [1,] 189    4 
#>  [2,] 197    4 
#>  [3,] 213    4 
#>  [4,] 221    3 
#>  [5,] 236    3 
#>  [6,] ...  ... 
#>  [7,] 205  687 
#>  [8,] 208  701 
#>  [9,] 204  707 
#> [10,] 188  710 
#> [11,] 180  710 
#> 
#> $bushmills
#> <xy [83 x 2]>
#>       [,1] [,2]
#>  [1,] 192   12 
#>  [2,] 192   12 
#>  [3,] 207   12 
#>  [4,] 223   13 
#>  [5,] 238   13 
#>  [6,] ...  ... 
#>  [7,] 220  865 
#>  [8,] 221  881 
#>  [9,] 208  891 
#> [10,] 208  891 
#> [11,] 193  893 
#> 
#> $chivas
#> <xy [83 x 2]>
#>       [,1] [,2]
#>  [1,] 190   43 
#>  [2,] 198   43 
#>  [3,] 215   44 
#>  [4,] 223   44 
#>  [5,] 240   45 
#>  [6,] ...  ... 
#>  [7,] 224  832 
#>  [8,] 216  834 
#>  [9,] 199  835 
#> [10,] 191  836 
#> [11,] 183  836 
#> 
#> $dalmore
#> <xy [78 x 2]>
#>       [,1] [,2]
#>  [1,] 178   34 
#>  [2,] 178   34 
#>  [3,] 191   34 
#>  [4,] 203   34 
#>  [5,] 215   34 
#>  [6,] ...  ... 
#>  [7,] 212  689 
#>  [8,] 210  702 
#>  [9,] 210  702 
#> [10,] 198  705 
#> [11,] 186  706 
#> 
#> $famousgrouse
#> <xy [84 x 2]>
#>       [,1] [,2]
#>  [1,] 181   11 
#>  [2,] 191   11 
#>  [3,] 200   11 
#>  [4,] 210   11 
#>  [5,] 219   12 
#>  [6,] ...  ... 
#>  [7,] 198  600 
#>  [8,] 198  610 
#>  [9,] 192  617 
#> [10,] 192  617 
#> [11,] 182  617 
#> 
#> $glendronach
#> <xy [99 x 2]>
#>       [,1] [,2]
#>  [1,] 177   19 
#>  [2,] 189   19 
#>  [3,] 201   20 
#>  [4,] 201   20 
#>  [5,] 213   21 
#>  [6,] ...  ... 
#>  [7,] 208  824 
#>  [8,] 206  836 
#>  [9,] 194  841 
#> [10,] 194  841 
#> [11,] 182  841 
#> 
#> $glenmorangie
#> <xy [89 x 2]>
#>       [,1] [,2]
#>  [1,] 187   25 
#>  [2,] 202   26 
#>  [3,] 202   26 
#>  [4,] 219   28 
#>  [5,] 236   29 
#>  [6,] ...  ... 
#>  [7,]  222  984
#>  [8,]  222 1001
#>  [9,]  222 1001
#> [10,]  209 1010
#> [11,]  192 1011
#> 
#> $highlandpark
#> <xy [86 x 2]>
#>       [,1] [,2]
#>  [1,] 170   16 
#>  [2,] 184   17 
#>  [3,] 184   17 
#>  [4,] 198   18 
#>  [5,] 212   19 
#>  [6,] ...  ... 
#>  [7,] 211  712 
#>  [8,] 198  719 
#>  [9,] 184  721 
#> [10,] 170  722 
#> [11,] 170  722 
#> 
#> $jackdaniels
#> <xy [76 x 2]>
#>       [,1] [,2]
#>  [1,] 188   17 
#>  [2,] 202   17 
#>  [3,] 215   17 
#>  [4,] 228   17 
#>  [5,] 241   17 
#>  [6,] ...  ... 
#>  [7,] 229  789 
#>  [8,] 227  801 
#>  [9,] 215  807 
#> [10,] 202  807 
#> [11,] 189  810 
#> 
#> $jb
#> <xy [88 x 2]>
#>       [,1] [,2]
#>  [1,] 179   31 
#>  [2,] 189   30 
#>  [3,] 211   31 
#>  [4,] 222   31 
#>  [5,] 232   31 
#>  [6,] ...  ... 
#>  [7,]  221 1027
#>  [8,]  217 1036
#>  [9,]  195 1037
#> [10,]  185 1037
#> [11,]  174 1037
#> 
#> $johnniewalker
#> <xy [83 x 2]>
#>       [,1] [,2]
#>  [1,] 178    6 
#>  [2,] 182    7 
#>  [3,] 186    7 
#>  [4,] 190    7 
#>  [5,] 198    7 
#>  [6,] ...  ... 
#>  [7,] 188  331 
#>  [8,] 188  335 
#>  [9,] 188  339 
#> [10,] 186  342 
#> [11,] 178  342 
#> 
#> $magallan
#> <xy [71 x 2]>
#>       [,1] [,2]
#>  [1,] 170   20 
#>  [2,] 184   22 
#>  [3,] 192   23 
#>  [4,] 205   26 
#>  [5,] 220   32 
#>  [6,] ...  ... 
#>  [7,] 194  743 
#>  [8,] 194  757 
#>  [9,] 194  764 
#> [10,] 185  776 
#> [11,] 171  779 
#> 
#> $makersmark
#> <xy [90 x 2]>
#>       [,1] [,2]
#>  [1,] 184    5 
#>  [2,] 184    5 
#>  [3,] 198    5 
#>  [4,] 213    5 
#>  [5,] 228    5 
#>  [6,] ...  ... 
#>  [7,] 221  852 
#>  [8,] 207  856 
#>  [9,] 192  856 
#> [10,] 178  856 
#> [11,] 178  856 
#> 
#> $oban
#> <xy [90 x 2]>
#>       [,1] [,2]
#>  [1,] 177   37 
#>  [2,] 185   37 
#>  [3,] 203   38 
#>  [4,] 211   39 
#>  [5,] 220   40 
#>  [6,] ...  ... 
#>  [7,] 214  871 
#>  [8,] 213  888 
#>  [9,] 205  895 
#> [10,] 197  897 
#> [11,] 188  898 
#> 
#> $oldpotrero
#> <xy [65 x 2]>
#>       [,1] [,2]
#>  [1,] 174    7 
#>  [2,] 182    7 
#>  [3,] 191    7 
#>  [4,] 207    8 
#>  [5,] 216   11 
#>  [6,] ...  ... 
#>  [7,] 195  571 
#>  [8,] 198  587 
#>  [9,] 198  596 
#> [10,] 191  602 
#> [11,] 182  603 
#> 
#> $redbreast
#> <xy [90 x 2]>
#>       [,1] [,2]
#>  [1,] 179    7 
#>  [2,] 184    7 
#>  [3,] 189    7 
#>  [4,] 193    8 
#>  [5,] 203    8 
#>  [6,] ...  ... 
#>  [7,] 199  427 
#>  [8,] 191  432 
#>  [9,] 186  432 
#> [10,] 181  433 
#> [11,] 177  433 
#> 
#> $tamdhu
#> <xy [88 x 2]>
#>       [,1] [,2]
#>  [1,] 180   49 
#>  [2,] 192   49 
#>  [3,] 205   49 
#>  [4,] 217   50 
#>  [5,] 229   51 
#>  [6,] ...  ... 
#>  [7,]  221 1024
#>  [8,]  221 1037
#>  [9,]  218 1049
#> [10,]  207 1055
#> [11,]  183 1057
#> 
#> $wildturkey
#> <xy [94 x 2]>
#>       [,1] [,2]
#>  [1,] 178   23 
#>  [2,] 192   23 
#>  [3,] 206   23 
#>  [4,] 220   23 
#>  [5,] 234   26 
#>  [6,] ...  ... 
#>  [7,]  224 1106
#>  [8,]  216 1117
#>  [9,]  203 1120
#> [10,]  189 1120
#> [11,]  175 1120
#> 
#> $yoichi
#> <xy [62 x 2]>
#>       [,1] [,2]
#>  [1,] 185   26 
#>  [2,] 200   26 
#>  [3,] 214   27 
#>  [4,] 229   27 
#>  [5,] 244   28 
#>  [6,] ...  ... 
#>  [7,] 227  716 
#>  [8,] 225  730 
#>  [9,] 210  737 
#> [10,] 203  738 
#> [11,] 188  738 
#> 
#> attr(,"class")
#> [1] "out"  "coo"  "list"

# Keep lower half
coo_down(shapes$cat)
#> <xy [69 x 2]>
#>       [,1] [,2]
#>  [1,] 200   62 
#>  [2,] 196   56 
#>  [3,] 200   56 
#>  [4,] 206   54 
#>  [5,] 209   48 
#>  [6,] ...  ... 
#>  [7,] 219   45 
#>  [8,] 213   47 
#>  [9,] 208   53 
#> [10,] 204   59 
#> [11,] 202   65 

# Keep left half with landmarks
coo_left(hearts)
#> ✔ Updated landmarks in 'coo_ldk'
#> # A tibble: 40 × 4
#>    img          coo      coo_ldk      author
#>    <path>       <out>    <named list> <fct> 
#>  1 viodnwqb.jpg (40 x 2) <dbl [4]>    ced   
#>  2 ohmlpeqy.jpg (40 x 2) <dbl [4]>    ced   
#>  3 qleyuxan.jpg (39 x 2) <dbl [4]>    ced   
#>  4 esjuanpl.jpg (40 x 2) <dbl [4]>    ced   
#>  5 zjhldwkx.jpg (40 x 2) <dbl [4]>    ced   
#>  6 jgiurtke.jpg (39 x 2) <dbl [4]>    jeya  
#>  7 ctigzqxl.jpg (40 x 2) <dbl [4]>    jeya  
#>  8 azvxubnr.jpg (40 x 2) <dbl [4]>    jeya  
#>  9 pydkrcxh.jpg (39 x 2) <dbl [4]>    jeya  
#> 10 zxitnlfc.jpg (39 x 2) <dbl [4]>    jeya  
#> # ℹ 30 more rows