PiMath API
    Preparing search index...

    Class Circle

    A circle of the plane, stored by its center and the square of its radius, so that everything stays exact. Built from an equation ("(x-1)^2+(y+2)^2=9"), from a center and a radius, from a center and a point of the circle, or from three points.

    new Circle("(x-1)^2+(y+2)^2=9").center.display // "(1;-2)"
    

    Implements

    Index
    RELATIVE_POSITION: typeof CircleRelativePosition = CircleRelativePosition

    The values returned by relativePosition for two circles.

    • get asCenterRadius(): this

      Output option: the form (x-a)^2+(y-b)^2=r^2 (default). Chainable, persistent.

      Returns this

    • get asDeveloped(): this

      Output option: the developed equation x^2+y^2-2x+4y-4=0. Chainable, persistent.

      Returns this

    • Copy the mathematical state of another instance into this (display state is NOT transferred — the receiver keeps its own formatting). Entry point used when constructing/parsing from a same-type input. Distinct from clone. Classes without a real implementation throw NotImplementedError.

      Parameters

      Returns this

    • The points of the circle with integer coordinates relative to the center. It is empty when the square of the radius is not an integer.

      Returns Point[]

    • Find the intersection points between the circle and a line. It can be 0, 1 or 2 points. The points are sorted depending on the direction vector of the line.

      Parameters

      Returns Point[]

    • Replace the circle with an equation, another circle, a center and a radius, a center and a point, or three points. Arguments that do not match any form leave the circle unchanged.

      Parameters

      • ...values: unknown[]

      Returns this

    • Change the radius.

      Parameters

      • radius: number | Fraction
      • Optionalsquare: boolean

        when true, radius is the square of the radius.

      Returns this

    • Returns the tangent line(s) to the circle.

      • P: Point on the circle → 1 tangent (perpendicular to the radius at P).
      • P: Point outside the circle → 2 tangents through P.
      • P: Point inside the circle → [] (no real tangent).
      • P: Fraction → 2 tangents with slope P.

      Parameters

      Returns Line[]

    • The circle with the given center and radius.

      Parameters

      • center: Point
      • radius: number | Fraction
      • Optionalsquare: boolean

        when true, radius is already the square of the radius.

      Returns Circle

    • The circle of an equation written in a string.

      Parameters

      • str: string

      Returns Circle

      if the equation is not the one of a circle.