Calculates the third side length of a triangle (either the hypotenuse or the second leg) given two side lengths with the Pythagorean theorem.

// Returns 3
const leg = Chalkboard.geom.Pythagorean(4, 5, "leg");

// Returns 5
const hyp = Chalkboard.geom.Pythagorean(3, 4, "hyp");
  • Parameters

    • a: number

      The first side length

    • b: number

      The second side length

    • Optionaltype: "hyp" | "leg" = "hyp"

      The type of calculation, either "hyp" for hypotenuse or "leg" for leg

    Returns number