|
Core 1.0
|
Axis aligned ellipses. More...
#include <ellipse.h>
Public Member Functions | |
| Ellipse2 () | |
| Empty. | |
| Ellipse2 (const Vector2 &, const double &, const double &, const Vector2 &=Vector2::X) | |
| Create an ellipse. | |
| Ellipse2 (const double &, const double &) | |
| Create an ellipse. | |
| Ellipse2 (const Matrix2 &A, const Vector2 ¢er) | |
| Create an ellipse : (p - center)^T . A . (p - center) | |
| ~Ellipse2 () | |
| Empty. | |
| Vector2 | Center () const |
| Gets the center. | |
| double | C () const |
| Return the half distance between the focus points of the ellipse. | |
| double | P () const |
| Return the parameter of the ellipse. | |
| Vector2 | Axis () const |
| Return the major axis. | |
| Vector2 | Focus (bool) const |
| Return the focus points of the ellipse. | |
| double | A () const |
| Return the major axis length. | |
| double | B () const |
| Return the minor axis length. | |
| Vector2 | Vertex (const double &) const |
| Compute a vertex on the ellipse. | |
| double | Curvature (const double &) const |
| Compute the curvature at a vertex on the ellipse. | |
| bool | Inside (const Vector2 &) const |
| Check if a point is inside the ellipse. | |
| double | R (const Vector2 &) const |
| Compute the squared distance between a point and the ellipse. | |
| double | Signed (const Vector2 &) const |
| Compute the signed distance between a point and the ellipse. | |
| Ellipse2 | Translated (const Vector2 &) const |
| Translate an ellipse. | |
| Ellipse2 | Scaled (const double &) const |
| Scales an ellipse. | |
| Ellipse2 | Scaled (const Vector2 &, bool=true) const |
| Scales an ellipse. | |
| Ellipse2 | Rotated (const double &) const |
| Rotates an ellipse. | |
| Ellipse2 | Rotated (const Matrix2 &) const |
| Rotates an ellipse. | |
| Ellipse2 | Transformed (const Frame2 &) const |
| Return a ellipse transformed by a frame. | |
| double | Eccentricity () const |
| Eccentricity. | |
| double | Focus () const |
| Focus of an ellipse. | |
| Box2 | GetBox () const |
| Compute the bounding box. | |
| Circle2 | GetCircle () const |
| Compute the bounding circle. | |
| double | Area () const |
| Area of an ellipse. | |
| double | Perimeter () const |
| Perimeter of an ellipse. | |
| Vector2 | RandomInside (Random &=Random::R239) const |
| Generate a random vector inside the circle. | |
| QVector< Vector2 > | Poisson (const double &, int, Random &=Random::R239) const |
| Compute a Poisson disc distribution inside the irregular octogon. | |
| void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
| Draw a circle. | |
| double | Value (const Vector2 &) const |
| Compute the field function value of an ellipse. | |
| Vector2 | Gradient (const Vector2 &) const |
| Compute the gradient of the field function. | |
Static Public Member Functions | |
| static Ellipse2 | Lerp (const double &, const Ellipse2 &, const Ellipse2 &) |
| Linear interpolation between two ellipses. | |
| static Ellipse2 | FromPoints (const std::vector< Vector2 > &points, double tolerance=0.05) |
| Builds a ellipse around a point cloud, using a Minium Volume Ellipsoid algorithm. | |
Protected Member Functions | |
| Matrix2 | MatrixForm () const |
| Compute the matrix form of the ellipse. | |
Protected Attributes | |
| Vector2 | c = Vector2::Null |
| Center of the ellipse. | |
| Vector2 | u = Vector2::X |
| Major axis. | |
| double | b = 1.0 |
| Axes lengths. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Ellipse2 &ellipse) |
| Overloaded. | |
Axis aligned ellipses.
|
explicit |
Create an ellipse.
| c | Center. |
| a,b | Axes lengths. |
| u | Major axis direction. |
|
explicit |
Create an ellipse.
| a,b | Axes lengths. |
Create an ellipse : (p - center)^T . A . (p - center)
| A | Ellipse matrix (symmetric positive-definite). |
| center | Ellipse center. |
| double Ellipse2::C | ( | ) | const |
Return the half distance between the focus points of the ellipse.
The focus points can be derived as:
| double Ellipse2::Curvature | ( | const double & | t | ) | const |
Compute the curvature at a vertex on the ellipse.
| t | Angle. |
| void Ellipse2::Draw | ( | QGraphicsScene & | scene, |
| const QPen & | pen = QPen(), | ||
| const QBrush & | brush = QBrush() ) const |
Draw a circle.
| scene | Graphics scene. |
| pen | The pen. |
| brush | The brush, should the ellipse be filled. |
| Vector2 Ellipse2::Focus | ( | bool | i | ) | const |
Return the focus points of the ellipse.
| i | Index of the focus point, true for focus in the direction of the axis, false for the point in the opposite direction. |
Builds a ellipse around a point cloud, using a Minium Volume Ellipsoid algorithm.
| p | Points. |
| t | Tolerance |
Compute the gradient of the field function.
| p | Point. |
| bool Ellipse2::Inside | ( | const Vector2 & | p | ) | const |
Check if a point is inside the ellipse.
| p | Point. |
| double Ellipse2::Perimeter | ( | ) | const |
Perimeter of an ellipse.
The exact perimeter of an ellipse is 4 a E(e) where e is the eccentricity, and the function E is the complete elliptic integral of the second kind.
Here we use an approximation proposed by Srinivasa Ramanujan, Modular Equations and Approximations to Pi.
| QVector< Vector2 > Ellipse2::Poisson | ( | const double & | r, |
| int | n, | ||
| Random & | random = Random::R239 ) const |
Compute a Poisson disc distribution inside the irregular octogon.
This function uses a simple dart throwing algorithm.
| r | Radius of the discs. |
| n | Number of candidate points. |
| random | Random number generator. |
| double Ellipse2::R | ( | const Vector2 & | p | ) | const |
Compute the squared distance between a point and the ellipse.
| p | Point. |
| Vector2 Ellipse2::RandomInside | ( | Random & | random = Random::R239 | ) | const |
Generate a random vector inside the circle.
| random | Random number generator. |
| Ellipse2 Ellipse2::Rotated | ( | const double & | a | ) | const |
Rotates an ellipse.
| a | Rotation angle. |
Rotates an ellipse.
| r | Rotation matrix. |
Scales an ellipse.
| s | Scaling vector. |
| local | Boolean, set to true if scaling occurs in the local frame of the ellipse (default), otherwise computations are performed in the world coordinate system. |
| double Ellipse2::Signed | ( | const Vector2 & | p | ) | const |
Compute the signed distance between a point and the ellipse.
| p | Point. |
Return a ellipse transformed by a frame.
| f | Transformation. |
Translate an ellipse.
| t | Translation vector. |
| double Ellipse2::Value | ( | const Vector2 & | p | ) | const |
Compute the field function value of an ellipse.
| p | Point. |
| Vector2 Ellipse2::Vertex | ( | const double & | t | ) | const |
Compute a vertex on the ellipse.
| t | Angle. |
|
friend |
Overloaded.
| s | Stream. |
| ellipse | The ellipse. |