Learn R Programming

affiner (version 0.1.3)

is_congruent: 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 numeric is_congruent(x, y, ..., tolerance = sqrt(.Machine$double.eps))

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

Value

A logical vector

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”.

Examples

Run this code
  # 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)

Run the code above in your browser using DataLab