|
| | Lens2 (const Vector2 &, const Vector2 &, const double &) |
| | Create a lens.
|
| | Lens2 (const Vector2 &, const double &, const double &) |
| | Create a lens from its thickness and its height.
|
| 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.
|
| Vector2 | Normal (const Vector2 &) const |
| | Compute the distance vector between the lens and a point.
|
| bool | Intersect (const Circle2 &) const |
| | Check if the lens intersects a circle.
|
| bool | Intersect (const Lens2 &) const |
| | Check if the lens intersects another 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.
|
| Lens2 | Rotated (const double &) const |
| | Rotation.
|
| Lens2 | Translated (const Vector2 &) const |
| | Translation.
|
| double | Area () const |
| | Compute the area of the lens.
|
|
Box2 | GetBox () const |
| | Compute the (tight) bounding box.
|
|
OrientedBox2 | GetOrientedBox () 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.
|
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.
| Lens2::Lens2 |
( |
const Vector2 & | c, |
|
|
const double & | t, |
|
|
const double & | h ) |
Create a lens from its thickness and its height.
The lens is the intersection of two discs of radius \( r \) whose centers are on the x axis, symmetrically with respect to c. The thickness t is the width of the lens along the axis of the centers, and h is the half height, that is, the distance from c to the corners of the lens, as returned by Height(). The radius and the distance l between the centers are:
\[r=\frac{h^2+t^2/4}{t}, \quad l=2r-t.
\]
The parameters should satisfy \( 0<t \le 2h \): the case \( t=2h \) is the disc of radius h, and for larger values of t the distance l is negative and the object is not the lens of thickness t. This is not checked.
- Parameters
-
| c | Center of the lens. |
| t | Thickness, which is the value returned by Thickness(). |
| h | Half height. |
| bool Lens2::Intersect |
( |
const Lens2 & | lens | ) |
const |
Check if the lens intersects another lens.
A lens is the intersection of two discs: two lenses intersect if and only if their four discs have a common point. The common region of discs is either one of the discs, in which case its center is in all the discs, or it has a vertex, which is an intersection point of two circles. It is therefore enough to test the four centers and the intersection points of the circles taken two by two.
- Parameters
-
Compute the distance vector between the lens and a point.
The vector goes from the closest point of the lens to the point, so that the projection of the point on the lens is p-Normal(p). It is null if the point is inside the lens.
The boundary of the lens is made of an arc of the first circle, inside the second disc, and of an arc of the second circle, inside the first disc, which meet at the two corners of the lens. On an arc, the closest point to p is the radial projection of p on the circle if it belongs to the arc, and one of the corners otherwise. The closest point of the lens is therefore the closest point among:
- the radial projection of p on the first circle, if it is inside the second disc;
- the radial projection of p on the second circle, if it is inside the first disc;
- the two corners.
- Parameters
-