Reverse the outline if it's traced clockwise to ensure counter-clockwise direction.
Usage
coo_direction_positive(x, ..., .cols = NULL, .ldk_col = NULL)
coo_direction_negative(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
xis a tibble. IfNULL, automatically detects columns containing coo columns.- .ldk_col
Character. Name of landmark column. If
NULL, usescolname_ldk.
Value
If
xis a single matrix: returns the matrix (reversed if needed)If
xis a list: returns a list of matricesIf
xis a tibble: returns the tibble with direction-corrected coo column(s)
Details
coo_direction_positive(): Ensures outline is traced counter-clockwise
(trigonometric/positive direction). If clockwise, reverses point order and syncs landmarks.
coo_direction_negative(): Ensures outline is traced clockwise
(negative direction). If counter-clockwise, reverses point order and syncs landmarks.
See also
get_direction_sign() for checking direction; coo_reverse() for reversing
Examples
# Ensure counter-clockwise
coo_direction_positive(shapes$cat)
#> <xy [120 x 2]>
#> [,1] [,2]
#> [1,] 202 65
#> [2,] 204 59
#> [3,] 208 53
#> [4,] 213 47
#> [5,] 219 45
#> [6,] ... ...
#> [7,] 209 48
#> [8,] 206 54
#> [9,] 200 56
#> [10,] 196 56
#> [11,] 200 62
# Ensure clockwise
coo_direction_negative(bot$coo)
#> $brahma
#> <xy [138 x 2]>
#> [,1] [,2]
#> [1,] 35 593
#> [2,] 34 603
#> [3,] 33 624
#> [4,] 33 645
#> [5,] 34 656
#> [6,] ... ...
#> [7,] 46 487
#> [8,] 43 508
#> [9,] 40 529
#> [10,] 40 540
#> [11,] 37 561
#>
#> $caney
#> <xy [168 x 2]>
#> [,1] [,2]
#> [1,] 55 555
#> [2,] 59 575
#> [3,] 62 585
#> [4,] 67 596
#> [5,] 76 616
#> [6,] ... ...
#> [7,] 54 485
#> [8,] 53 495
#> [9,] 54 505
#> [10,] 53 525
#> [11,] 53 535
#>
#> $chimay
#> <xy [189 x 2]>
#> [,1] [,2]
#> [1,] 48 348
#> [2,] 49 356
#> [3,] 51 364
#> [4,] 54 371
#> [5,] 59 379
#> [6,] ... ...
#> [7,] 50 302
#> [8,] 50 310
#> [9,] 49 318
#> [10,] 49 325
#> [11,] 49 333
#>
#> $corona
#> <xy [129 x 2]>
#> [,1] [,2]
#> [1,] 94 447
#> [2,] 101 466
#> [3,] 105 477
#> [4,] 110 486
#> [5,] 118 506
#> [6,] ... ...
#> [7,] 91 374
#> [8,] 91 385
#> [9,] 90 395
#> [10,] 91 416
#> [11,] 91 426
#>
#> $deusventrue
#> <xy [152 x 2]>
#> [,1] [,2]
#> [1,] 82 500
#> [2,] 87 518
#> [3,] 90 527
#> [4,] 97 545
#> [5,] 100 555
#> [6,] ... ...
#> [7,] 52 425
#> [8,] 59 445
#> [9,] 62 454
#> [10,] 70 472
#> [11,] 74 481
#>
#> $duvel
#> <xy [161 x 2]>
#> [,1] [,2]
#> [1,] 63 337
#> [2,] 65 348
#> [3,] 65 348
#> [4,] 69 358
#> [5,] 74 369
#> [6,] ... ...
#> [7,] 61 282
#> [8,] 61 293
#> [9,] 61 293
#> [10,] 61 304
#> [11,] 61 315
#>
#> $franziskaner
#> <xy [124 x 2]>
#> [,1] [,2]
#> [1,] 54 470
#> [2,] 54 480
#> [3,] 57 501
#> [4,] 59 511
#> [5,] 60 532
#> [6,] ... ...
#> [7,] 54 379
#> [8,] 54 389
#> [9,] 54 408
#> [10,] 54 418
#> [11,] 54 439
#>
#> $grimbergen
#> <xy [126 x 2]>
#> [,1] [,2]
#> [1,] 44 425
#> [2,] 50 446
#> [3,] 54 456
#> [4,] 60 467
#> [5,] 74 487
#> [6,] ... ...
#> [7,] 40 352
#> [8,] 40 362
#> [9,] 40 373
#> [10,] 40 394
#> [11,] 42 404
#>
#> $guiness
#> <xy [183 x 2]>
#> [,1] [,2]
#> [1,] 69 401
#> [2,] 68 410
#> [3,] 67 418
#> [4,] 71 433
#> [5,] 73 442
#> [6,] ... ...
#> [7,] 69 344
#> [8,] 69 360
#> [9,] 69 369
#> [10,] 69 377
#> [11,] 69 385
#>
#> $hoegardeen
#> <xy [193 x 2]>
#> [,1] [,2]
#> [1,] 46 568
#> [2,] 47 581
#> [3,] 51 594
#> [4,] 54 606
#> [5,] 58 619
#> [6,] ... ...
#> [7,] 40 493
#> [8,] 40 506
#> [9,] 40 519
#> [10,] 40 531
#> [11,] 42 544
#>
#> $jupiler
#> <xy [156 x 2]>
#> [,1] [,2]
#> [1,] 59 542
#> [2,] 62 556
#> [3,] 66 570
#> [4,] 69 583
#> [5,] 74 597
#> [6,] ... ...
#> [7,] 54 460
#> [8,] 54 474
#> [9,] 54 488
#> [10,] 54 501
#> [11,] 55 515
#>
#> $kingfisher
#> <xy [182 x 2]>
#> [,1] [,2]
#> [1,] 73 403
#> [2,] 73 413
#> [3,] 76 423
#> [4,] 78 433
#> [5,] 81 442
#> [6,] ... ...
#> [7,] 71 345
#> [8,] 71 355
#> [9,] 71 365
#> [10,] 71 374
#> [11,] 71 384
#>
#> $latrappe
#> <xy [136 x 2]>
#> [,1] [,2]
#> [1,] 26 414
#> [2,] 26 426
#> [3,] 26 439
#> [4,] 25 451
#> [5,] 28 464
#> [6,] ... ...
#> [7,] 25 339
#> [8,] 25 352
#> [9,] 25 364
#> [10,] 25 377
#> [11,] 26 389
#>
#> $lindemanskriek
#> <xy [176 x 2]>
#> [,1] [,2]
#> [1,] 65 444
#> [2,] 70 461
#> [3,] 72 469
#> [4,] 75 478
#> [5,] 77 486
#> [6,] ... ...
#> [7,] 54 387
#> [8,] 54 395
#> [9,] 55 404
#> [10,] 60 419
#> [11,] 60 427
#>
#> $nicechouffe
#> <xy [146 x 2]>
#> [,1] [,2]
#> [1,] 85 378
#> [2,] 89 394
#> [3,] 91 401
#> [4,] 93 410
#> [5,] 96 418
#> [6,] ... ...
#> [7,] 76 319
#> [8,] 77 327
#> [9,] 77 336
#> [10,] 81 353
#> [11,] 82 361
#>
#> $pecheresse
#> <xy [129 x 2]>
#> [,1] [,2]
#> [1,] 71 524
#> [2,] 73 533
#> [3,] 78 552
#> [4,] 83 570
#> [5,] 86 580
#> [6,] ... ...
#> [7,] 58 428
#> [8,] 60 447
#> [9,] 61 467
#> [10,] 61 476
#> [11,] 63 495
#>
#> $sierranevada
#> <xy [176 x 2]>
#> [,1] [,2]
#> [1,] 61 370
#> [2,] 61 370
#> [3,] 59 382
#> [4,] 61 394
#> [5,] 63 407
#> [6,] ... ...
#> [7,] 61 308
#> [8,] 61 320
#> [9,] 61 333
#> [10,] 61 333
#> [11,] 61 345
#>
#> $tanglefoot
#> <xy [174 x 2]>
#> [,1] [,2]
#> [1,] 47 383
#> [2,] 47 391
#> [3,] 48 407
#> [4,] 49 415
#> [5,] 52 423
#> [6,] ... ...
#> [7,] 49 327
#> [8,] 48 335
#> [9,] 48 351
#> [10,] 48 359
#> [11,] 48 367
#>
#> $tauro
#> <xy [174 x 2]>
#> [,1] [,2]
#> [1,] 59 538
#> [2,] 61 551
#> [3,] 63 563
#> [4,] 68 575
#> [5,] 71 587
#> [6,] ... ...
#> [7,] 54 466
#> [8,] 54 478
#> [9,] 54 491
#> [10,] 54 503
#> [11,] 56 515
#>
#> $westmalle
#> <xy [141 x 2]>
#> [,1] [,2]
#> [1,] 74 411
#> [2,] 76 427
#> [3,] 80 436
#> [4,] 83 452
#> [5,] 86 461
#> [6,] ... ...
#> [7,] 66 344
#> [8,] 67 361
#> [9,] 67 369
#> [10,] 70 386
#> [11,] 70 394
#>
#> $amrut
#> <xy [191 x 2]>
#> [,1] [,2]
#> [1,] 57 461
#> [2,] 57 471
#> [3,] 57 481
#> [4,] 57 491
#> [5,] 55 501
#> [6,] ... ...
#> [7,] 57 401
#> [8,] 57 411
#> [9,] 57 421
#> [10,] 57 431
#> [11,] 57 441
#>
#> $ballantines
#> <xy [146 x 2]>
#> [,1] [,2]
#> [1,] 38 381
#> [2,] 38 388
#> [3,] 38 404
#> [4,] 38 412
#> [5,] 38 428
#> [6,] ... ...
#> [7,] 38 310
#> [8,] 38 318
#> [9,] 38 333
#> [10,] 38 341
#> [11,] 38 357
#>
#> $bushmills
#> <xy [165 x 2]>
#> [,1] [,2]
#> [1,] 70 487
#> [2,] 70 502
#> [3,] 70 502
#> [4,] 70 518
#> [5,] 70 533
#> [6,] ... ...
#> [7,] 72 410
#> [8,] 72 425
#> [9,] 72 425
#> [10,] 72 441
#> [11,] 72 456
#>
#> $chivas
#> <xy [164 x 2]>
#> [,1] [,2]
#> [1,] 40 453
#> [2,] 51 470
#> [3,] 57 478
#> [4,] 73 495
#> [5,] 81 502
#> [6,] ... ...
#> [7,] 29 388
#> [8,] 29 404
#> [9,] 29 412
#> [10,] 31 429
#> [11,] 33 437
#>
#> $dalmore
#> <xy [155 x 2]>
#> [,1] [,2]
#> [1,] 67 396
#> [2,] 77 408
#> [3,] 89 419
#> [4,] 102 430
#> [5,] 102 430
#> [6,] ... ...
#> [7,] 42 322
#> [8,] 42 334
#> [9,] 44 346
#> [10,] 47 359
#> [11,] 52 371
#>
#> $famousgrouse
#> <xy [169 x 2]>
#> [,1] [,2]
#> [1,] 97 332
#> [2,] 97 342
#> [3,] 97 351
#> [4,] 97 351
#> [5,] 97 361
#> [6,] ... ...
#> [7,] 99 284
#> [8,] 99 284
#> [9,] 99 294
#> [10,] 99 303
#> [11,] 99 313
#>
#> $glendronach
#> <xy [197 x 2]>
#> [,1] [,2]
#> [1,] 73 459
#> [2,] 73 471
#> [3,] 73 471
#> [4,] 72 483
#> [5,] 72 495
#> [6,] ... ...
#> [7,] 74 399
#> [8,] 74 411
#> [9,] 74 411
#> [10,] 73 423
#> [11,] 73 435
#>
#> $glenmorangie
#> <xy [179 x 2]>
#> [,1] [,2]
#> [1,] 53 550
#> [2,] 53 550
#> [3,] 54 567
#> [4,] 58 584
#> [5,] 62 599
#> [6,] ... ...
#> [7,] 55 468
#> [8,] 54 485
#> [9,] 54 501
#> [10,] 54 501
#> [11,] 53 518
#>
#> $highlandpark
#> <xy [169 x 2]>
#> [,1] [,2]
#> [1,] 42 399
#> [2,] 42 399
#> [3,] 42 413
#> [4,] 42 427
#> [5,] 41 441
#> [6,] ... ...
#> [7,] 42 329
#> [8,] 42 343
#> [9,] 42 357
#> [10,] 42 357
#> [11,] 42 371
#>
#> $jackdaniels
#> <xy [150 x 2]>
#> [,1] [,2]
#> [1,] 65 440
#> [2,] 64 453
#> [3,] 65 466
#> [4,] 68 479
#> [5,] 70 493
#> [6,] ... ...
#> [7,] 63 362
#> [8,] 63 375
#> [9,] 63 388
#> [10,] 63 401
#> [11,] 63 414
#>
#> $jb
#> <xy [174 x 2]>
#> [,1] [,2]
#> [1,] 43 552
#> [2,] 43 563
#> [3,] 42 585
#> [4,] 40 595
#> [5,] 42 606
#> [6,] ... ...
#> [7,] 43 477
#> [8,] 42 488
#> [9,] 42 510
#> [10,] 43 520
#> [11,] 43 531
#>
#> $johnniewalker
#> <xy [168 x 2]>
#> [,1] [,2]
#> [1,] 133 183
#> [2,] 133 187
#> [3,] 133 191
#> [4,] 133 199
#> [5,] 133 203
#> [6,] ... ...
#> [7,] 134 155
#> [8,] 133 163
#> [9,] 133 167
#> [10,] 133 171
#> [11,] 133 175
#>
#> $magallan
#> <xy [141 x 2]>
#> [,1] [,2]
#> [1,] 77 419
#> [2,] 77 426
#> [3,] 75 441
#> [4,] 75 455
#> [5,] 75 462
#> [6,] ... ...
#> [7,] 81 346
#> [8,] 80 361
#> [9,] 80 375
#> [10,] 78 382
#> [11,] 78 397
#>
#> $makersmark
#> <xy [177 x 2]>
#> [,1] [,2]
#> [1,] 53 454
#> [2,] 67 464
#> [3,] 67 464
#> [4,] 74 473
#> [5,] 79 487
#> [6,] ... ...
#> [7,] 13 394
#> [8,] 16 408
#> [9,] 16 408
#> [10,] 23 420
#> [11,] 31 432
#>
#> $oban
#> <xy [179 x 2]>
#> [,1] [,2]
#> [1,] 73 474
#> [2,] 73 491
#> [3,] 73 500
#> [4,] 73 508
#> [5,] 72 517
#> [6,] ... ...
#> [7,] 74 414
#> [8,] 74 423
#> [9,] 74 431
#> [10,] 74 448
#> [11,] 74 457
#>
#> $oldpotrero
#> <xy [131 x 2]>
#> [,1] [,2]
#> [1,] 95 324
#> [2,] 101 333
#> [3,] 112 349
#> [4,] 117 358
#> [5,] 119 366
#> [6,] ... ...
#> [7,] 60 265
#> [8,] 63 274
#> [9,] 71 291
#> [10,] 77 299
#> [11,] 83 307
#>
#> $redbreast
#> <xy [177 x 2]>
#> [,1] [,2]
#> [1,] 113 242
#> [2,] 118 246
#> [3,] 127 253
#> [4,] 132 257
#> [5,] 137 261
#> [6,] ... ...
#> [7,] 98 210
#> [8,] 98 214
#> [9,] 101 224
#> [10,] 103 228
#> [11,] 105 233
#>
#> $tamdhu
#> <xy [176 x 2]>
#> [,1] [,2]
#> [1,] 47 577
#> [2,] 46 589
#> [3,] 45 601
#> [4,] 44 613
#> [5,] 46 625
#> [6,] ... ...
#> [7,] 49 503
#> [8,] 49 515
#> [9,] 49 527
#> [10,] 49 540
#> [11,] 49 552
#>
#> $wildturkey
#> <xy [185 x 2]>
#> [,1] [,2]
#> [1,] 15 597
#> [2,] 15 611
#> [3,] 15 625
#> [4,] 18 638
#> [5,] 20 651
#> [6,] ... ...
#> [7,] 18 513
#> [8,] 18 527
#> [9,] 18 541
#> [10,] 18 555
#> [11,] 18 569
#>
#> $yoichi
#> <xy [123 x 2]>
#> [,1] [,2]
#> [1,] 69 406
#> [2,] 68 421
#> [3,] 68 435
#> [4,] 68 450
#> [5,] 68 457
#> [6,] ... ...
#> [7,] 69 325
#> [8,] 69 340
#> [9,] 69 355
#> [10,] 69 369
#> [11,] 69 384
#>
#> attr(,"class")
#> [1] "out" "coo" "list"
# Works with landmarks
coo_direction_positive(hearts)
#> ✔ Updated landmarks in 'coo_ldk'
#> # A tibble: 40 × 4
#> img coo coo_ldk author
#> <path> <out> <named list> <fct>
#> 1 viodnwqb.jpg (80 x 2) <dbl [4]> ced
#> 2 ohmlpeqy.jpg (80 x 2) <dbl [4]> ced
#> 3 qleyuxan.jpg (80 x 2) <dbl [4]> ced
#> 4 esjuanpl.jpg (80 x 2) <dbl [4]> ced
#> 5 zjhldwkx.jpg (80 x 2) <dbl [4]> ced
#> 6 jgiurtke.jpg (80 x 2) <dbl [4]> jeya
#> 7 ctigzqxl.jpg (80 x 2) <dbl [4]> jeya
#> 8 azvxubnr.jpg (80 x 2) <dbl [4]> jeya
#> 9 pydkrcxh.jpg (80 x 2) <dbl [4]> jeya
#> 10 zxitnlfc.jpg (80 x 2) <dbl [4]> jeya
#> # ℹ 30 more rows
