is_congruent() is a S3 generic that tests whether two different objects are “congruent”.
The is_congruent() method for angle() classes tests whether two angles are congruent.
Arguments
- x, y
Two objects to test whether they are “"congruent"”.
- ...
Further arguments passed to or from other methods.
- tolerance
Angles (coerced to half-turns) or numerics with differences smaller than
tolerancewill be considered “congruent”.- mod_turns
If
TRUEangles that are congruent modulo full turns will be considered “congruent”.
Examples
# Use `is_congruent()` to check if two angles are "congruent"
a1 <- angle(180, "degrees")
a2 <- angle(pi, "radians")
a3 <- angle(-180, "degrees") # Only congruent modulus full turns
a1 == a2
#> [1] TRUE
isTRUE(all.equal(a1, a2))
#> [1] FALSE
is_congruent(a1, a2)
#> [1] TRUE
is_congruent(a1, a2, mod_turns = FALSE)
#> [1] TRUE
a1 == a3
#> [1] FALSE
isTRUE(all.equal(a1, a3))
#> [1] FALSE
is_congruent(a1, a3)
#> [1] TRUE
is_congruent(a1, a3, mod_turns = FALSE)
#> [1] FALSE
