Core 1.0
Lune Class Reference

A scale is defined as the difference between two spheres. More...

#include <scales.h>

Public Member Functions

 Lune (const Sphere &, const Sphere &)
 Create a scale as the difference of two spheres.
 Lune (const Circle &, const double &, const double &)
 Create a scale from a circle and two heights.
Lune Translated (const Vector &) const
 Translate a scale.
Lune Rotated (const Matrix &) const
 Return a scale rotated by a given matrix.
Box GetBox () const
 Compute the bounding box.
double Signed (const Vector &) const
 Compute the signed distance between the scale and a point.
double R (const Vector &) const
 Compute the squared distance between the scale and a point.
Vector Normal (const Vector &) const
 Compute the distance vector between the scale and a point.

Protected Attributes

Sphere cut
 Sphere and the cutting sphere
Circle circle
 Intersection circle.

Detailed Description

A scale is defined as the difference between two spheres.

See also
Lens

Constructor & Destructor Documentation

◆ Lune() [1/2]

Lune::Lune ( const Sphere & a,
const Sphere & b )

Create a scale as the difference of two spheres.

Parameters
a,bSphere and cutting sphere (the radius of the cutting sphere should be larger).

◆ Lune() [2/2]

Lune::Lune ( const Circle & circle,
const double & a,
const double & b )

Create a scale from a circle and two heights.

Parameters
circleThe circle.
a,bHeights, starting with the largest.

Member Function Documentation

◆ Normal()

Vector Lune::Normal ( const Vector & p) const

Compute the distance vector between the scale and a point.

The vector goes from the closest point of the scale to the point, so that the projection of the point on the scale is p-Normal(p). It is null if the point is inside the scale.

The scale is the difference of the sphere and of the cutting sphere. Its boundary is made of a cap of the sphere, outside the cutting sphere, a cap of the cutting sphere, inside the sphere, and the circle where the two spheres intersect. The closest point of the scale is the closest point among:

  • the radial projection of p on the sphere, if it is outside the cutting sphere;
  • the radial projection of p on the cutting sphere, if it is inside the sphere;
  • the closest point of the intersection circle, if the spheres intersect.

The vector is null if the cutting sphere contains the sphere, as the scale is then empty.

Parameters
pPoint.

◆ R()

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

Compute the squared distance between the scale and a point.

Parameters
pPoint.

◆ Rotated()

Lune Lune::Rotated ( const Matrix & r) const

Return a scale rotated by a given matrix.

Parameters
rRotation matrix.

◆ Signed()

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

Compute the signed distance between the scale and a point.

Parameters
pPoint.

◆ Translated()

Lune Lune::Translated ( const Vector & t) const

Translate a scale.

Parameters
tTranslation vector.