is_congruent: Test whether two objects are congruent

View source: R/is_congruent.r

is_congruentR Documentation

Test whether two objects are congruent

Description

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.

Usage

is_congruent(x, y, ...)

## S3 method for class 'numeric'
is_congruent(x, y, ..., tolerance = sqrt(.Machine$double.eps))

## S3 method for class 'angle'
is_congruent(
  x,
  y,
  ...,
  mod_turns = TRUE,
  tolerance = sqrt(.Machine$double.eps)
)

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 tolerance will be considered “congruent”.

mod_turns

If TRUE angles that are congruent modulo full turns will be considered “congruent”.

Value

A logical vector

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
  isTRUE(all.equal(a1, a2))
  is_congruent(a1, a2)
  is_congruent(a1, a2, mod_turns = FALSE)
  a1 == a3
  isTRUE(all.equal(a1, a3))
  is_congruent(a1, a3)
  is_congruent(a1, a3, mod_turns = FALSE)


affiner documentation built on April 4, 2025, 4:42 a.m.