|
Core 1.0
|
Flat topped pentagon in the plane. More...
#include <pentagon.h>
Public Member Functions | |
| Pentagon2 () | |
| Empty. | |
| Pentagon2 (const Vector2 &, const double &) | |
| Create a pentagon. | |
| Pentagon2 (const double &) | |
| Create an pentagon. | |
| void | Translate (const Vector2 &) |
| Translate a pentagon. | |
| void | Scale (const double &) |
| Scale a pentagon. | |
| bool | Inside (const Vector2 &) const |
| Test if a point is inside. | |
| double | R (const Vector2 &) const |
| Compute the squared Euclidean distance to the pentagon. | |
| double | Signed (const Vector2 &) const |
| Compute the signed Euclidean distance to the pentagon. | |
| Vector2 | Normal (const Vector2 &) const |
| Computes the distance vector between a pentagon and a point. | |
| bool | Intersect (const Ray2 &, double &, double &) const |
| Compute the intersection with a ray. | |
| Vector2 | Center () const |
| Return the center of the pentagon. | |
| double | Radius () const |
| Return the radius of the pentagon. | |
| double | InscribedRadius () const |
| Inscribed radius. | |
| Vector2 | Radial (int) const |
| Return the radial vector of the k-th vertex. | |
| Vector2 | Edge (int) const |
| Return the edge vector connecting vertexes k and k+1. | |
| Vector2 | Vertex (int) const |
| Return the coordinates of the k-th vertex. | |
| Box2 | GetBox () const |
| Computes the bounding box of a pentagon. | |
| double | Area () const |
| Area of the pentagon. | |
| double | Perimeter () const |
| Perimeter of the pentagon. | |
| double | Edge () const |
| Edge length. | |
| Vector2 | RandomInside (Random &=Random::R239) const |
| Generate a random vector inside the pentagon. | |
| QVector< Vector2 > | Poisson (const double &, int, Random &=Random::R239) const |
| Compute a Poisson disc distribution inside the pentagon. | |
| void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
| Draws an pentagon. | |
Static Protected Member Functions | |
| static int | Sector (const Vector2 &) |
| Compute the sector given an input direction. | |
Protected Attributes | |
| Vector2 | c = Vector::Null |
| Center. | |
| double | r = 1.0 |
| Radius. | |
Static Protected Attributes | |
| static const Vector2 | vertex [5] |
| Array of vertexes. | |
| static const Vector2 | normal [5] |
| Array of normal vectors to the edges. | |
| static const Vector2 | edge [5] |
| Unit edge vectors. | |
| static const double | Alpha = 1.0 / (2.0 * sqrt(5.0 - 2.0 * sqrt(5.0))) |
| Constant. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Pentagon2 &pentagon) |
| Overloaded. | |
Flat topped pentagon in the plane.
|
explicit |
Create a pentagon.
| c | Center. |
| r | Radius. |
|
explicit |
Create an pentagon.
| r | Radius. |
| void Pentagon2::Draw | ( | QGraphicsScene & | scene, |
| const QPen & | pen = QPen(), | ||
| const QBrush & | brush = QBrush() ) const |
Draws an pentagon.
| scene | Graphics scene. |
| pen | The pen. |
| brush | The brush. |
|
inline |
Return the edge vector connecting vertexes k and k+1.
| k | Index, should be in [0,4]. |
| bool Pentagon2::Inside | ( | const Vector2 & | p | ) | const |
Test if a point is inside.
| p | Point. |
| bool Pentagon2::Intersect | ( | const Ray2 & | ray, |
| double & | ta, | ||
| double & | tb ) const |
Compute the intersection with a ray.
| ray | The ray. |
| ta,tb | Intersection depths |
Computes the distance vector between a pentagon and a point.
| p | Point. |
| QVector< Vector2 > Pentagon2::Poisson | ( | const double & | r, |
| int | n, | ||
| Random & | random = Random::R239 ) const |
Compute a Poisson disc distribution inside the pentagon.
This function uses a simple dart throwing algorithm.
| r | Radius of the discs. |
| n | Number of candidate points. |
| random | Random number generator. |
| double Pentagon2::R | ( | const Vector2 & | p | ) | const |
Compute the squared Euclidean distance to the pentagon.
| p | Point. |
|
inline |
Return the radial vector of the k-th vertex.
| k | Index, should be in [0,4]. |
| Vector2 Pentagon2::RandomInside | ( | Random & | random = Random::R239 | ) | const |
Generate a random vector inside the pentagon.
| random | Random number generator. |
| void Pentagon2::Scale | ( | const double & | s | ) |
Scale a pentagon.
| s | Scaling factor. |
|
staticprotected |
Compute the sector given an input direction.
| d | Direction. |
| double Pentagon2::Signed | ( | const Vector2 & | p | ) | const |
Compute the signed Euclidean distance to the pentagon.
| p | Point. |
| void Pentagon2::Translate | ( | const Vector2 & | t | ) |
Translate a pentagon.
| t | Translation vector. |
|
inline |
Return the coordinates of the k-th vertex.
| k | Index, should be in [0,4]. |
|
friend |
Overloaded.
| s | Stream. |
| pentagon | The pentagon. |