PiMath API
    Preparing search index...

    Class Triangle

    A triangle ABC of the plane. Built from three points, three lines, or six coordinates. It gives the sides, the angles and the remarkable lines (medians, heights, mediators, bisectors) with exact coordinates. tex and display are not available: describe a triangle through its vertices or its lines.

    new Triangle(new Point(0, 0), new Point(4, 0), new Point(0, 3)).isRectangle() // true
    

    Implements

    Index
    • get tex(): string

      Not implemented on purpose: a triangle has no single equation to display.

      Returns string

      always. Describe it through its lines or its vertices.

    • Angle at a vertex, as a decimal number: in radians by default, in degrees after asDegree.

      Parameters

      • name: "A" | "B" | "C"

      Returns number

    • The bisectors of the angles, as {A, B, C, intersection}, where intersection is their common point.

      Parameters

      • internal: boolean = true

        true (default) for the internal bisectors, false for the external ones.

      Returns { A: Line; B: Line; C: Line; intersection: Point | null }

      if the triangle is degenerate.

    • The perpendicular bisectors of the sides, as {a, b, c, intersection}, where intersection is the circumcenter.

      Returns { a: Line; b: Line; c: Line; intersection: Point | null }

      if the triangle is degenerate.

    • Replace the triangle with a triangle, three lines (objects or equation strings), three points, or six coordinates.

      Parameters

      • ...values: unknown[]

      Returns this

      if one of six values is not a number.

      if the points are collinear or the lines do not form a triangle.

    • Recompute the validity and forget the cached lines and remarkable lines. This is done automatically when a vertex changes through its setter or its x and y coordinates.

      Returns this

    • Build a triangle from the lines of its sides AB, BC and AC, given as lines or equation strings.

      Parameters

      • line1: string | Line
      • line2: string | Line
      • line3: string | Line

      Returns Triangle

      if two lines are parallel or the lines do not form a triangle.