Core 1.0
Lens Class Reference

Lenses with uniform radius. More...

#include <lens.h>

Inheritance diagram for Lens:
Axis

Public Member Functions

 Lens (const Vector &, const Vector &, const double &)
 Create a lens.
 Lens (const Vector &, const double &, const double &)
 Create a lens.
bool Inside (const Vector &) const
 Test if a point is inside the lens.
double R (const Vector &) const
 Compute the squared Euclidean distance to the lens.
double Signed (const Vector &) const
 Compute the Euclidean distance to the lens.
Vector Center () const
 Compute the center of the lens.
double Height () const
 Compute the height of the lens.
double Thickness () const
 Compute the thickness of the lens.
void Rotate (const Matrix &)
 Rotates a lens.
void Translate (const Vector &)
 Translate a lens.
void Scale (const double &)
 Scale a lens.
Box GetBox () const
 Compute the (tight) bounding box.

Protected Attributes

double r = 1.0
 Radius.
double height = sqrt(3.0) / 2.0
 Height of the lens, defined as \( \sqrt{r^2-l^2/4} \) where l is the distance between the centers.
Protected Attributes inherited from Axis
Vector b = Vector::Z
 End vertexes of the axis.
Vector axis = Vector::Z
 Normalized axis vector.
double length = 1.0
 Length of the axis.

Friends

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

Additional Inherited Members

Protected Member Functions inherited from Axis
double Radial (const Vector &, Vector &, Vector &) const
 Compute the radial coordinates of a point.
 Axis ()
 Empty.
 Axis (const Vector &, const Vector &)
 Creates an axis given end vertices.
 ~Axis ()
 Empty.
void Rotate (const Matrix &)
 Rotates an axis.
void Translate (const Vector &)
 Translates an axis.
void Scale (const double &)
 Uniformly scales an axis.
void Scale (const Vector &)
 Scales an axis.
Quadric Equation (const Ray &) const
 Compute the polynomial equation of the Euclidean distance between a ray and the axis.
Vector Vertex (int) const
 Return one of the end vertexes of the axis.
Vector Point (const double &) const
 Compute a point on the axis.
Vector GetAxis () const
 Returns the normalized axis vector.
double Length () const
 Return the axis length.
Vector Symmetric (const Vector &) const
 Symmetric point.
Sphere Symmetric (const Sphere &) const
 Symmetric sphere.
Vector Normal (const Vector &) const
 Compute the normal vector between a point and its projection onto the edge.
double R (const Vector &) const
 Compute the squared distance to the segment.
double R (const Axis &) const
 Compute the squared distance between two axes.
double R (const Vector &, double &) const
 Compute the squared distance to the axis.
Matrix GetFrame () const
 Compute an orthonormal frame attached to the axis.
Vector2 Radial (const Vector &) const
 Compute the radial coordinates of a point.
Static Protected Member Functions inherited from Axis
static Matrix GetFrame (const Vector &)
 Compute an orthonormal frame attached to the axis.
static Vector BoxVector (const Vector &)
 Compute the box vector extent of a unit circle with a given axis.
Static Protected Attributes inherited from Axis
static const Axis Z
 Axes from origin, identical to Axis(Vector::Null,Vector::X) ...

Detailed Description

Lenses with uniform radius.

A lens is defined as the intersection of two spheres with the same radius.

Constructor & Destructor Documentation

◆ Lens() [1/2]

Lens::Lens ( const Vector & a,
const Vector & b,
const double & r )
explicit

Create a lens.

Parameters
a,bCenters of the circles.
rRadius.

◆ Lens() [2/2]

Lens::Lens ( const Vector & c,
const double & t,
const double & h )
explicit

Create a lens.

Parameters
cCenters of the lens.
tThickness.
hHeight.

Member Function Documentation

◆ Inside()

bool Lens::Inside ( const Vector & p) const

Test if a point is inside the lens.

Parameters
pPoint.

◆ R()

double Lens::R ( const Vector & p) const

Compute the squared Euclidean distance to the lens.

Parameters
pPoint.

◆ Rotate()

void Lens::Rotate ( const Matrix & r)

Rotates a lens.

Parameters
rRotation matrix.

◆ Scale()

void Lens::Scale ( const double & s)

Scale a lens.

The radius, the height and the length of the axis are scaled by the absolute value of the factor.

Parameters
sScaling factor.

◆ Signed()

double Lens::Signed ( const Vector & p) const

Compute the Euclidean distance to the lens.

Parameters
pPoint.

◆ Translate()

void Lens::Translate ( const Vector & t)

Translate a lens.

Parameters
tTranslation vector.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const Lens & l )
friend

Overloaded.

Parameters
sStream.
lLens.