A line-swept-cricle.
More...
#include <capsule.h>
|
|
| Capsule2 () |
| | Empty.
|
| | Capsule2 (const Vector2 &, const Vector2 &, const double &) |
| | Creates a capsule.
|
|
| ~Capsule2 () |
| | Empty.
|
| bool | Intersect (const Box2 &) const |
| | Check the intersection with a box.
|
| bool | Intersect (const Triangle2 &) const |
| | Check the intersection with a triangle.
|
| bool | Inside (const Vector2 &) const |
| | Check if a point is inside the capsule.
|
| double | R (const Vector2 &) const |
| | Computes the squared distance between a point and the capsule.
|
| double | Signed (const Vector2 &) const |
| | Computes the signed distance between a point and the capsule.
|
| Vector2 | Normal (const Vector2 &) const |
| | Compute the normal vector between a point and its projection onto the capsule.
|
| bool | Intersect (const Ray2 &) const |
| | Check the intersection between a capsule and a ray.
|
| int | Intersect (const Ray2 &, double &, double &) const |
| | Compute the intersections between a capsule and a ray.
|
| Box2 | GetBox () const |
| | Computes the tight bounding box of the capsule.
|
| double | Area () const |
| | Compute the surface area.
|
| void | Draw (QGraphicsScene &, const QPen &, const QBrush &) const |
| | Draws a capsule.
|
|
Vector2 | Vertex (int) const |
| | Return one of the end vertexes of the axis.
|
|
|
double | r = 1.0 |
| | Radius.
|
|
Vector2 | b = Vector2(1.0, 0.0) |
| | End vertexes of the axis.
|
|
Vector2 | axis = Vector2::X |
| | Normalized axis vector.
|
|
double | length = 1.0 |
| | Length of the axis.
|
◆ Capsule2()
| Capsule2::Capsule2 |
( |
const Vector2 & | a, |
|
|
const Vector2 & | b, |
|
|
const double & | r ) |
|
explicit |
Creates a capsule.
- Parameters
-
◆ Area()
| double Capsule2::Area |
( |
| ) |
const |
Compute the surface area.
The capsule is the union of a rectangle of size 2r by L, with L the length of the axis, and of two half discs of radius r: \( A = \pi r^2 + 2 r L \).
◆ Draw()
| void Capsule2::Draw |
( |
QGraphicsScene & | scene, |
|
|
const QPen & | pen, |
|
|
const QBrush & | brush ) const |
Draws a capsule.
- Parameters
-
| scene | Graphics scene. |
| pen | The pen. |
| brush | The brush. |
◆ GetBox()
| Box2 Capsule2::GetBox |
( |
| ) |
const |
◆ Inside()
| bool Capsule2::Inside |
( |
const Vector2 & | p | ) |
const |
Check if a point is inside the capsule.
- Parameters
-
◆ Intersect() [1/4]
| bool Capsule2::Intersect |
( |
const Box2 & | box | ) |
const |
Check the intersection with a box.
- Parameters
-
◆ Intersect() [2/4]
| bool Capsule2::Intersect |
( |
const Ray2 & | ray | ) |
const |
Check the intersection between a capsule and a ray.
- Parameters
-
◆ Intersect() [3/4]
| int Capsule2::Intersect |
( |
const Ray2 & | ray, |
|
|
double & | ta, |
|
|
double & | tb ) const |
Compute the intersections between a capsule and a ray.
- Parameters
-
| ray | The ray. |
| ta,tb | Intersection depths. |
◆ Intersect() [4/4]
| bool Capsule2::Intersect |
( |
const Triangle2 & | triangle | ) |
const |
Check the intersection with a triangle.
The capsule is the set of points at distance at most r from the segment [a,b]. It intersects the triangle if the segment crosses the triangle, or if the distance between the triangle and one end of the segment, or between one vertex of the triangle and the segment, is less than the radius.
- Parameters
-
◆ Normal()
Compute the normal vector between a point and its projection onto the capsule.
- Parameters
-
◆ R()
| double Capsule2::R |
( |
const Vector2 & | p | ) |
const |
Computes the squared distance between a point and the capsule.
- Parameters
-
◆ Signed()
| double Capsule2::Signed |
( |
const Vector2 & | p | ) |
const |
Computes the signed distance between a point and the capsule.
- Parameters
-
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | s, |
|
|
const Capsule2 & | c ) |
|
friend |