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. More... | |
Pentagon2 (const double &) | |
Create an pentagon. More... | |
void | Translate (const Vector2 &) |
Translate a pentagon. More... | |
void | Scale (const double &) |
Scale a pentagon. More... | |
bool | Inside (const Vector2 &) const |
Test if a point is inside. More... | |
double | R (const Vector2 &) const |
Compute the squared Euclidean distance to the pentagon. More... | |
double | Signed (const Vector2 &) const |
Compute the signed Euclidean distance to the pentagon. More... | |
Vector2 | Normal (const Vector2 &) const |
Computes the distance vector between a pentagon and a point. More... | |
bool | Intersect (const Ray2 &, double &, double &) const |
Compute the intersection with a ray. More... | |
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. More... | |
Vector2 | Edge (int) const |
Return the edge vector connecting vertexes k and k+1. More... | |
Vector2 | Vertex (int) const |
Return the coordinates of the k-th vertex. More... | |
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. | |
void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
Draws an pentagon. More... | |
Static Protected Member Functions | |
static int | Sector (const Vector2 &) |
Compute the sector given an input direction. More... | |
Protected Attributes | |
Vector2 | c = Vector::Null |
Center. | |
double | r = 1.0 |
Radius. | |
Static Protected Attributes | |
static const Vector2 | vertex [5] |
Array of vertices. | |
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 &, const Pentagon2 &) |
Overloaded. More... | |
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. |
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]. |
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. |