Core 1.0
DiscSet2 Class Reference

A simple set of discs. More...

#include <sphereset.h>

Public Member Functions

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

Protected Attributes

QVector< Disc2discs
 Set of discs.
 

Detailed Description

A simple set of discs.

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

Constructor & Destructor Documentation

◆ DiscSet2() [1/3]

DiscSet2::DiscSet2 ( const Disc2 & s)
explicit

Creates a sphere set given one sphere.

Parameters
sDisc2.

◆ DiscSet2() [2/3]

DiscSet2::DiscSet2 ( const QVector< Disc2 > & s)
explicit

Creates a set of discs.

Parameters
sSet.

◆ DiscSet2() [3/3]

DiscSet2::DiscSet2 ( const DiscSet2 & ss,
const Disc2 & s )
explicit

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

Parameters
ssSet.
sDisc2.

Member Function Documentation

◆ Append()

void DiscSet2::Append ( const DiscSet2 & s)

Merge with another set of discs.

Parameters
sDiscSet2.

◆ Inside()

bool DiscSet2::Inside ( const Vector2 & p) const

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

Parameters
pThe point.

◆ Intersect()

bool DiscSet2::Intersect ( const DiscSet2 & set) const

Check if two sphere-sets intersect.

Parameters
setSet of discs.

◆ Normal()

Vector2 DiscSet2::Normal ( const Vector2 & p) const

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

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

Parameters
pPoint.

◆ R() [1/2]

double DiscSet2::R ( const DiscSet2 & set) const

Compute the signed distance between two sphere-sets.

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

Parameters
setSet of discs.

◆ R() [2/2]

double DiscSet2::R ( const Vector2 & p) const

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

Parameters
pThe point.

◆ RemoveDuplicates()

void DiscSet2::RemoveDuplicates ( const double & t)

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

Parameters
tThreshold value.

◆ Rotate()

void DiscSet2::Rotate ( const Matrix2 & r)

Rotates a sphere set.

Parameters
rRotation matrix.

◆ Scale()

void DiscSet2::Scale ( const double & s)

Uniformly scales a sphere-set.

Parameters
sScaling factor.

◆ Signed()

double DiscSet2::Signed ( const Vector2 & p) const

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

Parameters
pThe point.

◆ Transform()

void DiscSet2::Transform ( const Frame2 & t)

Transforms a sphere set given a frame transformation.

Parameters
tTransformation.

◆ Translate()

void DiscSet2::Translate ( const Vector2 & t)

Translates a sphere set.

Parameters
tTranslation vector.