Angle between diagonals of a rectangle

1.3k Views Asked by At

Rectangle

I have both of an rectangle and want to find angle between diagonals of a rectangle (angles α, β)

I've found the following Math formulas:

α = 2δ, where sin δ = a/d, where d = Math.sqrt((a * a) + (b * b))

but I can't put it all together cause of I know only sin δ, but δ is needed in the first formula.

That's how it should calculate it: OmniCalculator. For example, for sides 12 and 4 - angle between diagonals is 143.13

1

There are 1 best solutions below

0
On BEST ANSWER

You have the following values:

tanδ = (a/2) / (b/2)
δ = atan(a/b) -> tan inverse

tan = (b/2) / (a/2)
 = atan(b/a) -> tan inverse

2 + α = π
2δ + β = π

You can calculate as such:

function getDiagonalAngles(a, b) {
  let δ = Math.atan(a / b),
     = Math.atan(b / a),
    α = Math.PI - 2 * δ,
    β = Math.PI - 2 * 

    return {
      "α": α * 180 / Math.PI,
      "β": β * 180 / Math.PI
    }
}

console.log(getDiagonalAngles(12, 4))
console.log(getDiagonalAngles(12, 12))