Core 1.0
Public Member Functions | Protected Attributes | List of all members
SphereSet Class Reference

A simple set of spheres. More...

#include <sphereset.h>

Public Member Functions

 SphereSet ()
 Empty.
 
 SphereSet (const Sphere &)
 Creates a sphere set given one sphere. More...
 
 SphereSet (const QVector< Sphere > &)
 Creates a set of spheres. More...
 
 SphereSet (const SphereSet &, const Sphere &)
 Creates a set of spheres and keep only the subset of spheres that intersect the second argument sphere. More...
 
 ~SphereSet ()
 Empty.
 
void Append (const SphereSet &)
 Merge with another set of spheres. More...
 
bool Intersect (const SphereSet &) const
 Check if two sphere-sets intersect. More...
 
bool Inside (const Vector &) const
 Check if a point is inside or outside the set of sphere. More...
 
bool IsEmpty () const
 returns true if the set is empty
 
double R (const SphereSet &) const
 Compute the signed distance between two sphere-sets. More...
 
Box GetBox () const
 Compute the bounding box of the set of spheres.
 
Vector Normal (const Vector &) const
 Computes the normal vector between a point and the sphere set. More...
 
double R (const Vector &) const
 Compute the squared distance between a point and the set of spheres. More...
 
double Signed (const Vector &) const
 Compute the signed distance between a point and the set of spheres. More...
 
void Rotate (const Matrix &)
 Rotates a sphere set. More...
 
void Translate (const Vector &)
 Translates a sphere set. More...
 
void Scale (const double &)
 Uniformly scales a sphere-set. More...
 
void Transform (const Frame &)
 Transforms a sphere set given a frame transformation. More...
 
int Size (void) const
 Returns the number of Spheres.
 
Sphere GetSphere (int) const
 Returns the number of Spheres.
 
void RemoveDuplicates (const double &)
 Removes spheres that are close to or embedded in the sphere set. More...
 

Protected Attributes

QVector< Spherespheres
 Set of spheres.
 

Detailed Description

A simple set of spheres.

This class implements several high level functions to compute the distance between a point and a set of spheres, or the detect whether two set of spheres intersect.

Constructor & Destructor Documentation

◆ SphereSet() [1/3]

SphereSet::SphereSet ( const Sphere s)
explicit

Creates a sphere set given one sphere.

Parameters
sSphere.

◆ SphereSet() [2/3]

SphereSet::SphereSet ( const QVector< Sphere > &  s)
explicit

Creates a set of spheres.

Parameters
sSet.

◆ SphereSet() [3/3]

SphereSet::SphereSet ( const SphereSet ss,
const Sphere s 
)
explicit

Creates a set of spheres and keep only the subset of spheres that intersect the second argument sphere.

Parameters
ssSet.
sSphere.

Member Function Documentation

◆ Append()

void SphereSet::Append ( const SphereSet s)

Merge with another set of spheres.

Parameters
sSphereSet.

◆ Inside()

bool SphereSet::Inside ( const Vector p) const

Check if a point is inside or outside the set of sphere.

Parameters
pThe point.

◆ Intersect()

bool SphereSet::Intersect ( const SphereSet set) const

Check if two sphere-sets intersect.

Parameters
setSet of spheres.

◆ Normal()

Vector SphereSet::Normal ( const Vector p) const

Computes the normal vector between a point and the sphere set.

Simply project point onto the spheres, and return the corresponding Euclidean distance vector.

Parameters
pPoint.

◆ R() [1/2]

double SphereSet::R ( const SphereSet set) const

Compute the signed distance between two sphere-sets.

If two spheres intersect, the result will be negative. If one of the set is empty, returns 0.0.

Parameters
setSet of spheres.

◆ R() [2/2]

double SphereSet::R ( const Vector p) const

Compute the squared distance between a point and the set of spheres.

Parameters
pThe point.

◆ RemoveDuplicates()

void SphereSet::RemoveDuplicates ( const double &  t)

Removes spheres that are close to or embedded in the sphere set.

Parameters
tThreshold value.

◆ Rotate()

void SphereSet::Rotate ( const Matrix r)

Rotates a sphere set.

Parameters
rRotation matrix.

◆ Scale()

void SphereSet::Scale ( const double &  s)

Uniformly scales a sphere-set.

Parameters
sScaling factor.

◆ Signed()

double SphereSet::Signed ( const Vector p) const

Compute the signed distance between a point and the set of spheres.

Parameters
pThe point.

◆ Transform()

void SphereSet::Transform ( const Frame t)

Transforms a sphere set given a frame transformation.

Parameters
tTransformation.

◆ Translate()

void SphereSet::Translate ( const Vector t)

Translates a sphere set.

Parameters
tTranslation vector.