Sphere

A two dimensional surface that extends infinitely in 3d space, represented in Hessian normal form by a unit length normal vector and a constant.

Core Class

A two dimensional surface that extends infinitely in 3d space, represented in Hessian normal form by a unit length normal vector and a constant.

Constructors

Properties

center: Vector3

A Vector3 defining the center of the sphere.

radius: number

The radius of the sphere.

Methods

  • Sets the center and radius properties of this sphere.
    Please note that this method only copies the values from the given center.

    Parameters

    • center: Vector3

      center of the sphere.

    • radius: number

      radius of the sphere.

    Returns Sphere

  • Computes the minimum bounding sphere for an array of Array| points. If optionalCenter is given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing Array| points is calculated.

    Parameters

    Returns Sphere

  • If the radius smaller than zero, this will return false, otherwise return true.

    Returns boolean

  • Checks to see if the sphere contains the provided point inclusive of the surface of the sphere.

    Parameters

    Returns boolean

  • Returns the closest distance from the boundary of the sphere to the point. If the sphere contains the point, the distance will be negative.

    Parameters

    Returns number

  • Checks to see if two spheres intersect.

    Parameters

    • sphere: Sphere

      Sphere to check for intersection against.

    Returns boolean

  • Determines whether or not this sphere intersects a given box.

    Parameters

    • box: Box3

      Box3 to check for intersection against.

    Returns boolean

  • Determines whether or not this sphere intersects a given plane.

    Parameters

    • plane: Plane

      Plane to check for intersection against.

    Returns boolean

  • Clamps a point within the sphere. If the point is outside the sphere, it will clamp it to the closest point on the edge of the sphere. Points already inside the sphere will not be affected.

    Parameters

    Returns Vector3

  • Checks to see if the two spheres' centers and radii are equal.

    Parameters

    Returns boolean