|
|
| Annulus2 () |
| | Empty.
|
| | Annulus2 (const double &, const double &) |
| | Creates a annulus.
|
| | Annulus2 (const Vector2 &, const double &, const double &) |
| | Creates a annulus.
|
| | Annulus2 (const Circle2 &, const double &) |
| | Creates a annulus.
|
|
| ~Annulus2 () |
| | Empty.
|
|
Box2 | GetBox () const |
| | Bounding box.
|
| Vector2 | RandomInside (Random &=Random::R239) const |
| | Generate a random vector inside the region between the two concentric circles.
|
|
double | Area () const |
| | Area.
|
| double | R (const Vector2 &) const |
| | Compute the squared distance to a point.
|
| double | Signed (const Vector2 &) const |
| | Compute the squared distance to a point.
|
| Vector2 | Normal (const Vector2 &) const |
| | Computes the distance vector between an annulus and a point.
|
| int | Intersect (const Ray2 &, double *) const |
| | Compute the intersection with a ray.
|
| bool | Intersect (const Circle2 &) const |
| | Check if the annulus and a circle intersect.
|
| bool | Intersect (const Box2 &) const |
| | Check if the annulus and a box intersect.
|
| bool | Intersect (const Annulus2 &) const |
| | Check if the annulus and another annulus intersect.
|
| bool | Inside (const Vector2 &) const |
| | Check if a point is inside.
|
| void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
| | Draw the shape.
|
An annulus, the region between two concentric circles.
| bool Annulus2::Intersect |
( |
const Annulus2 & | annulus | ) |
const |
Check if the annulus and another annulus intersect.
Let d be the distance between the centers. A point at distance s of the center of the first annulus and at distance t of the center of the second one exists if and only if |s-t| <= d <= s+t. The annuli intersect if such distances exist with s in [ri,re] and t in [ri',re'], which is equivalent to max(0, ri-re', ri'-re) <= d <= re+re': the first inequality tells that the intervals of distances can be reached by two points at distance at most d, the second one that the outer discs overlap. This holds in particular for concentric annuli (d = 0), which intersect if their intervals of radii overlap.
- Parameters
-
| annulus | The other annulus. |
| bool Annulus2::Intersect |
( |
const Circle2 & | circle | ) |
const |
Check if the annulus and a circle intersect.
The circle is considered as a disc, like in Circle2::Intersect(const Circle2&): the function returns true if the annulus and the disc have at least one point in common. A disc inside the hole of the annulus does not intersect it, unless it touches the interior circle, and a disc which contains the annulus intersects it.
The distance to the center of the annulus varies continuously over a disc, from max(0,d-r) to d+r, where d is the distance between the centers and r the radius of the circle. The annulus and the disc intersect if and only if this range meets the interval [ri,re] of the annulus. Both tests are performed with squared lengths.
- Parameters
-
- See also
- Annulus2::Intersect(const Box2&) const
| int Annulus2::Intersect |
( |
const Ray2 & | ray, |
|
|
double * | t ) const |
Compute the intersection with a ray.
The ray should be normalized. If the ray crosses the hole, four depths are returned in increasing order: t[0] and t[3] are the depths on the exterior circle, t[1] and t[2] on the interior circle, and the annulus is the union of the intervals [t[0],t[1]] and [t[2],t[3]]. Otherwise two depths are returned, on the exterior circle.
- Parameters
-
| ray | The (normalized) ray. |
| t | Set of intersections, which should have room for four depths. |
- Returns
- The number of depths: 0, 2 or 4.
Computes the distance vector between an annulus and a point.
The annulus is considered as a filled region: the vector is null if the point is inside the annulus, otherwise it goes from the nearest point of the annulus to the point, and its squared norm is Annulus2::R(). For a point in the hole, it points towards the center of the annulus. At the center, the nearest point is arbitrarily chosen on the positive x axis.
- Parameters
-