Class BoundingSphere

Class Documentation

class BoundingSphere

Computes smallest enclosing spheres of pointsets using Welzl’s algorithm \Author: Tassilo Kugelstadt.

Public Functions

inline BoundingSphere()

default constructor sets the center and radius to zero.

inline BoundingSphere(Vector3r const &x, const Real r)

constructor which sets the center and radius

Parameters
  • x – 3d coordiantes of the center point

  • r – radius of the sphere

inline BoundingSphere(const Vector3r &a)

constructs a sphere for one point (with radius 0)

Parameters

a – 3d coordinates of point a

inline BoundingSphere(const Vector3r &a, const Vector3r &b)

constructs the smallest enclosing sphere for two points

Parameters
  • a – 3d coordinates of point a

  • b – 3d coordinates of point b

inline BoundingSphere(const Vector3r &a, const Vector3r &b, const Vector3r &c)

constructs the smallest enclosing sphere for three points

Parameters
  • a – 3d coordinates of point a

  • b – 3d coordinates of point b

  • c – 3d coordinates of point c

inline BoundingSphere(const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d)

constructs the smallest enclosing sphere for four points

Parameters
  • a – 3d coordinates of point a

  • b – 3d coordinates of point b

  • c – 3d coordinates of point c

  • d – 3d coordinates of point d

inline BoundingSphere(const std::vector<Vector3r> &p)

constructs the smallest enclosing sphere a given pointset

Parameters

p – vertices of the points

inline Vector3r const &x() const

Getter for the center of the sphere.

Returns

const reference of the sphere center

inline Vector3r &x()

Access function for center of the sphere.

Returns

reference of the sphere center

inline Real r() const

Getter for the radius.

Returns

Radius of the sphere

inline Real &r()

Access function for the radius.

Returns

Reference to the radius of the sphere

inline void setPoints(const std::vector<Vector3r> &p)

constructs the smallest enclosing sphere a given pointset

Parameters

p – vertices of the points

inline bool overlaps(BoundingSphere const &other) const

intersection test for two spheres

Parameters

other – other sphere to be tested for intersection

Returns

returns true when this sphere and the other sphere are intersecting

inline bool contains(BoundingSphere const &other) const

tests whether the given sphere other is contained in the sphere

Parameters

other – bounding sphere

Returns

returns true when the other is contained in this sphere or vice versa

inline bool contains(Vector3r const &other) const

tests whether the given point other is contained in the sphere

Parameters

other – 3d coordinates of a point

Returns

returns true when the point is contained in the sphere