|
Gin
|
Equations to calculate the shape of an ellipse and to calculate points on the edge of the ellipse and to see if points are inside or outside. More...
#include <gin_geometry.h>
Public Member Functions | |
| Ellipse (T x_, T y_, T a_, T b_) | |
| Creates a ellipse with a given centre and width / height. | |
| Ellipse (T a_, T b_) | |
| Creates an ellipse centred at (0,0) with the specified width and height. | |
| bool | isPointOn (Point< T > pt, T accuracy=0.00001) |
| Checks if a point lies on the ellipse boundary. | |
| bool | isPointOutside (Point< T > pt) |
| Checks if a point lies outside the ellipse. | |
| bool | isPointInside (Point< T > pt) |
| Checks if a point lies inside the ellipse. | |
| Point< T > | pointAtAngle (T angle) |
| Calculates the point on the ellipse at the specified angle. | |
Public Attributes | |
| T | x = 0 |
| T | y = 0 |
| Centre coordinates of the ellipse. | |
| T | a = 0 |
| T | b = 0 |
| Semi-major and semi-minor axes (half width and height) | |
Equations to calculate the shape of an ellipse and to calculate points on the edge of the ellipse and to see if points are inside or outside.
Creates a ellipse with a given centre and width / height.
Creates an ellipse centred at (0,0) with the specified width and height.
| a_ | Half the width of the ellipse (semi-major axis if a > b) |
| b_ | Half the height of the ellipse (semi-minor axis if b < a) |
Checks if a point lies on the ellipse boundary.
| pt | The point to test |
| accuracy | Tolerance for the test (default: 0.00001) |
References Ellipse< T >::a, Ellipse< T >::b, Point< T >::getX(), Point< T >::getY(), square, Ellipse< T >::x, Point< T >::x, Ellipse< T >::y, and Point< T >::y.
Checks if a point lies outside the ellipse.
| pt | The point to test |
References Ellipse< T >::a, Ellipse< T >::b, Point< T >::getX(), Point< T >::getY(), square, Ellipse< T >::x, Point< T >::x, Ellipse< T >::y, and Point< T >::y.
Checks if a point lies inside the ellipse.
| pt | The point to test |
References Ellipse< T >::a, Ellipse< T >::b, Point< T >::getX(), Point< T >::getY(), square, Ellipse< T >::x, Point< T >::x, Ellipse< T >::y, and Point< T >::y.
Calculates the point on the ellipse at the specified angle.
The angle is measured from the positive x-axis, going counter-clockwise.
| angle | The angle in radians |
References Ellipse< T >::a, Ellipse< T >::b, square, Ellipse< T >::x, and Ellipse< T >::y.
Centre coordinates of the ellipse.
Referenced by Ellipse< T >::isPointInside(), Ellipse< T >::isPointOn(), Ellipse< T >::isPointOutside(), and Ellipse< T >::pointAtAngle().
Semi-major and semi-minor axes (half width and height)
Referenced by Ellipse< T >::isPointInside(), Ellipse< T >::isPointOn(), Ellipse< T >::isPointOutside(), and Ellipse< T >::pointAtAngle().