Core 1.0
TwinDisc2 Class Reference

Twin discs in the plane with the same radius. More...

#include <lens.h>

Public Member Functions

 TwinDisc2 (const Vector2 &, const Vector2 &, const double &)
 Create twin discs.
bool Inside (const Vector2 &) const
 Test if a point is inside the union of the discs.
double R (const Vector2 &) const
 Compute the squared Euclidean distance to the union of the discs.
double Signed (const Vector2 &) const
 Compute the signed Euclidean distance to the union of two discs.
bool Intersect (const TwinDisc2 &) const
 Test if the twin discs intersect.
bool Intersect (const Circle2 &) const
 Test if the twin discs intersect a circle.
double Area () const
 Compute the area.
Box2 GetBox () const
 Compute the bounding box.
OrientedBox2 GetOrientedBox () const
 Compute the oriented bounding box.
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw the union of two discs.

Protected Attributes

Vector2 b
 Centers.
double r
 Radius.

Friends

std::ostream & operator<< (std::ostream &s, const TwinDisc2 &d)
 Overloaded.

Detailed Description

Twin discs in the plane with the same radius.

Constructor & Destructor Documentation

◆ TwinDisc2()

TwinDisc2::TwinDisc2 ( const Vector2 & a,
const Vector2 & b,
const double & r )

Create twin discs.

Parameters
a,bCenters of the discs.
rRadius.

Member Function Documentation

◆ Area()

double TwinDisc2::Area ( ) const

Compute the area.

Area is defined as the sum of the areas of the discs, minus the area of their lens-shaped intersecting region.

See also
Lens2::Area() const

◆ Draw()

void TwinDisc2::Draw ( QGraphicsScene & scene,
const QPen & pen = QPen(),
const QBrush & brush = QBrush() ) const

Draw the union of two discs.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush, should the circle be filled.

◆ Inside()

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

Test if a point is inside the union of the discs.

Parameters
pPoint.

◆ Intersect() [1/2]

bool TwinDisc2::Intersect ( const Circle2 & circle) const

Test if the twin discs intersect a circle.

The union of the two discs intersects the circle if one of the discs does.

Parameters
circleThe circle.

◆ Intersect() [2/2]

bool TwinDisc2::Intersect ( const TwinDisc2 & disc) const

Test if the twin discs intersect.

Parameters
discOther twin discs.

◆ R()

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

Compute the squared Euclidean distance to the union of the discs.

See also
Disc2::R() const
Parameters
pPoint.

◆ Signed()

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

Compute the signed Euclidean distance to the union of two discs.

The exact signed Euclidean distance differs from the minimum of the signed distance between two discs. The distance is negative inside the union; outside, it is the minimum of the distances to the two discs. Inside, the closest boundary point is either on the arc of the closest disc, or one of the intersection points of the two circles. Disjoint discs and discs with the same center are handled as a single disc.

Parameters
pPoint.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const TwinDisc2 & d )
friend

Overloaded.

Parameters
sStream.
dDiscs.