dot big bang

Developer API
Menu

Class Sphere

All
  • Public
  • Public/Protected
  • All

Hierarchy

  • Sphere

Index

Constructors

constructor

  • Creates a new Sphere.

    Parameters

    • Optional center: Vector3

      The center of the sphere. Default is (0, 0, 0).

    • Optional radius: number

      The radius of the sphere. Default is 0.

    Returns Sphere

Properties

center

center: Vector3

The center of the sphere.

radius

radius: number

The radius of the sphere.

Methods

applyMatrix4

  • Transforms this sphere with the provided matrix m.

    Parameters

    Returns Sphere

clampPoint

  • Clamps a point within this sphere. If the point is outside the sphere, it is clamped to the closest point on the surface of the sphere. Points already inside the sphere are not affected.

    Parameters

    Returns Vector3

clone

  • Returns a new sphere with the same center and radius as this one.

    Returns Sphere

containsPoint

  • containsPoint(point: Vector3): boolean
  • Returns true if this sphere contains the provided point inclusive of the surface of the sphere.

    Parameters

    • point: Vector3

      The point to be checked.

    Returns boolean

copy

  • Copies the values of the passed sphere's center and radius properties to this sphere.

    Parameters

    Returns Sphere

distanceToPoint

  • distanceToPoint(point: Vector3): number
  • Returns the closest distance from the surface of the sphere to the point. If the sphere contains the point, the returned distance is negative.

    Parameters

    • point: Vector3

      The point to calculate the distance to.

    Returns number

empty

  • empty(): boolean
  • Returns true if this sphere is empty, i.e. the radius is zero or negative)

    Returns boolean

equals

  • Returns true if this and the other sphere have equal center and radius.

    Parameters

    • sphere: Sphere

      The other sphere to compare this one to.

    Returns Sphere

getBoundingBox

  • getBoundingBox(optionalTarget?: Box3): Box3
  • Returns a minimum bounding box for the sphere.

    Parameters

    • Optional optionalTarget: Box3

      The result will be copied into this Box3.

    Returns Box3

intersectsBox

  • intersectsBox(box: Box3): boolean
  • Determines whether or not this sphere intersects box.

    Parameters

    • box: Box3

      The box to check for intersection against.

    Returns boolean

intersectsPlane

  • intersectsPlane(plane: Plane): boolean
  • Determines whether or not this sphere intersects plane.

    Parameters

    • plane: Plane

      The plane to check for intersection against.

    Returns boolean

intersectsSphere

  • intersectsSphere(sphere: Sphere): boolean
  • Determines whether or not this sphere intersects sphere.

    Parameters

    • sphere: Sphere

      The sphere to check for intersection against.

    Returns boolean

set

  • Sets the center and radius of this sphere from the provided ones.

    Parameters

    • center: Vector3

      The center of the sphere.

    • radius: number

      The radius of the sphere.

    Returns Sphere

setFromPoints

  • Computes the minimum bounding sphere for the provided array of points and store the result in this sphere. If _optionalCenter_is provided, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing points is calculated and used instead.

    Parameters

    • points: Vector3[]

      An array of points.

    • Optional optionalCenter: Vector3

      The point to use as the sphere's centre.

    Returns Sphere

translate

  • Translate the sphere's center by the provided offset.

    Parameters

    • offset: Vector3

      The vector by which to translate the sphere's center.

    Returns Sphere