anglesBetweenDiagonals method

({Angle a, Angle b}) anglesBetweenDiagonals()

Calculates the angles between the diagonals of the rectangle.

The angles between the diagonals are calculated using the inverse tangent (atan) function, taking the ratio of the width to the length for one angle, and the ratio of the length to the width for the other angle.

The returned value is a map with two keys, 'a' and 'b', each containing an Angle instance representing the angles between the diagonals.

Implementation

({Angle a, Angle b}) anglesBetweenDiagonals() {
  return (
    a: Angle(rad: dmath.atan(width / length)),
    b: Angle(rad: dmath.atan(length / width))
  );
}