Core 1.0
Lens2 Class Reference

Lenses in the plane with uniform radius. More...

#include <lens.h>

Public Member Functions

 Lens2 (const Vector2 &, const Vector2 &, const double &)
 Create a lens.
 
 Lens2 (const Vector2 &, const double &, const double &)
 Create a lens.
 
bool Inside (const Vector2 &) const
 Test if a point is inside the lens.
 
double R (const Vector2 &) const
 Compute the squared Euclidean distance to the lens.
 
double Signed (const Vector2 &) const
 Compute the Euclidean distance to the lens.
 
double Height () const
 Compute the height of the lens.
 
double Thickness () const
 Compute the thickness of the lens.
 
Vector2 Center () const
 Compute the center of the lens.
 
double Alpha () const
 Compute the internal half opening angle of the lens.
 
double Area () const
 Compute the area of the lens.
 
Box2 GetBox () const
 Compute the (tight) bounding box.
 
Frame2 GetFrame () const
 Compute the local frame of the lens.
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw the lens.
 

Protected Attributes

Vector2 b = -Vector::X
 Centers.
 
double r = 3.0
 Radius.
 

Friends

std::ostream & operator<< (std::ostream &s, const Lens2 &l)
 Overloaded.
 

Detailed Description

Lenses in the plane with uniform radius.

A lens is defined as the intersection of two circles. Lenses are used in beta-skeletons geometric graphs.

Constructor & Destructor Documentation

◆ Lens2() [1/2]

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

Create a lens.

Parameters
a,bCenters of the circles.
rRadius.

◆ Lens2() [2/2]

Lens2::Lens2 ( const Vector2 & c,
const double & t,
const double & h )

Create a lens.

Parameters
cCenters of the lens.
tThickness.
hHeight.

Member Function Documentation

◆ Alpha()

double Lens2::Alpha ( ) const
inline

Compute the internal half opening angle of the lens.

This is an inlined and optimized version of:

Lens2 lens;
double a = acos(lens.Height()/(0.5*lens.Thickness()));
double Thickness() const
Compute the thickness of the lens.
Definition lens.h:92
Lens2(const Vector2 &, const Vector2 &, const double &)
Create a lens.
Definition lens2.cpp:20
double Height() const
Compute the height of the lens.
Definition lens.h:84

◆ Area()

double Lens2::Area ( ) const

Compute the area of the lens.

This is a simplified version of the equation of the area of two intersecting circles with different radii.

See also
Circle2::Area(const Circle2&) const

◆ Draw()

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

Draw the lens.

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

◆ Inside()

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

Test if a point is inside the lens.

Parameters
pPoint.

◆ R()

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

Compute the squared Euclidean distance to the lens.

Parameters
pPoint.

◆ Signed()

double Lens2::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 Lens2 & l )
friend

Overloaded.

Parameters
sStream.
lLens.