PiMath API
    Preparing search index...

    Class Sphere3

    A sphere of space, stored by its center and the square of its radius, so that everything stays exact. Built from an equation ("(x-1)^2+y^2+z^2=9") or from a center and a radius. A sphere that has not been defined throws a StateError when it is read.

    new Sphere3(new Point(0, 0, 0), 3).squareRadius.display // "9"
    

    Implements

    Index
    RELATIVE_POSITION: typeof Sphere3RelativePosition = Sphere3RelativePosition

    The values returned by relativePosition.

    • get asCenterRadius(): this

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

      Returns this

    • get asDeveloped(): this

      Output option: the developed equation. Chainable, persistent.

      Returns this

    • get radius(): { display: string; tex: string; value: number }

      The radius, as an object with its tex, its display and its decimal value. It is written as a number when the square of the radius is a perfect square, and as a root otherwise.

      Returns { display: string; tex: string; value: number }

      if the sphere is not defined.

    • 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

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

      Parameters

      • ...values: unknown[]

      Returns this

    • The sphere of an equation written in a string.

      Parameters

      • str: string

      Returns Sphere3

      if the equation is not the one of a sphere.