Core 1.0
TwinDisc2 Class Reference

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

#include <lens.h>

Public Member Functions

 TwinDisc2 (const Vector2 &, const Vector2 &, const double &)
 Create a twin disc.
 
bool Inside (const Vector2 &) const
 Test if a point is inside the lens.
 
double R (const Vector2 &) const
 Compute the Euclidean distance to the lens.
 
double Signed (const Vector2 &) const
 Compute the Euclidean distance to the lens.
 
double Area () const
 Compute the area.
 
Box2 GetBox () const
 Compute the 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 uniform radius.

Constructor & Destructor Documentation

◆ TwinDisc2()

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

Create a twin disc.

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 lens.

Parameters
pPoint.

◆ R()

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

Compute the Euclidean distance to the lens.

Parameters
pPoint.

◆ Signed()

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

Compute the Euclidean distance to the lens.

Parameters
pPoint.

Friends And Related Symbol Documentation

◆ operator<<

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

Overloaded.

Parameters
sStream.
dDiscs.