A Rectangle, a simpler way to define the polygon for square or rectangular shapes.
More...
#include <geomtypes.h>
|
| Rectangle (const Point &topLeft, const Point &bottomRight) |
| Constructs a rectangular polygon given two opposing corner points. More...
|
|
| Rectangle (const Point ¢re, const double width, const double height) |
| Constructs a rectangular polygon given the centre, width and height. More...
|
|
void | clear (void) |
| Resets this to the empty polygon.
|
|
bool | empty (void) const |
| Returns true if this polygon is empty.
|
|
size_t | size (void) const |
| Returns the number of points in this polygon.
|
|
int | id (void) const |
| Returns the ID value associated with this polygon.
|
|
const Point & | at (size_t index) const |
| Returns a specific point in the polygon. More...
|
|
Polygon | simplify (void) const |
| Returns a simplified Polyline, where all collinear line segments have been collapsed down into single line segments. More...
|
|
Polygon | curvedPolyline (const double curve_amount, const bool closed=false) const |
| Returns a curved approximation of this multi-segment PolyLine, with the corners replaced by smooth Bezier curves. More...
|
|
void | translate (const double xDist, const double yDist) |
| Translates the polygon position by a relative amount. More...
|
|
void | getBoundingRect (double *minX, double *minY, double *maxX, double *maxY) const |
| Returns the bounding rectangle that contains this polygon. More...
|
|
Polygon | boundingRect (void) const |
| Returns the bounding rectangle for this polygon. More...
|
|
|
int | _id |
| An ID for the polygon.
|
|
std::vector< Point > | ps |
| A vector of the points that make up the Polygon.
|
|
std::vector< char > | ts |
| If used, denotes whether the corresponding point in ps is a move-to operation or a Bezier curve-to. More...
|
|
A Rectangle, a simpler way to define the polygon for square or rectangular shapes.
Avoid::Rectangle::Rectangle |
( |
const Point & |
topLeft, |
|
|
const Point & |
bottomRight |
|
) |
| |
Constructs a rectangular polygon given two opposing corner points.
- Parameters
-
[in] | topLeft | The first corner point of the rectangle. |
[in] | bottomRight | The opposing corner point of the rectangle. |
Avoid::Rectangle::Rectangle |
( |
const Point & |
centre, |
|
|
const double |
width, |
|
|
const double |
height |
|
) |
| |
Constructs a rectangular polygon given the centre, width and height.
- Parameters
-
[in] | centre | The centre of the rectangle, specified as a point. |
[in] | width | The width of the rectangle. |
[in] | height | The height of the rectangle. |
const Point & Avoid::Polygon::at |
( |
size_t |
index | ) |
const |
|
virtualinherited |
Returns a specific point in the polygon.
- Parameters
-
[in] | index | The array index of the point to be returned. |
Implements Avoid::PolygonInterface.
Polygon Avoid::PolygonInterface::boundingRect |
( |
void |
| ) |
const |
|
inherited |
Returns the bounding rectangle for this polygon.
- Returns
- A new Rectangle representing the bounding box.
Polygon Avoid::Polygon::curvedPolyline |
( |
const double |
curve_amount, |
|
|
const bool |
closed = false |
|
) |
| const |
|
inherited |
Returns a curved approximation of this multi-segment PolyLine, with the corners replaced by smooth Bezier curves.
This function does not do any further obstacle avoidance with the curves produced. Hence, you would usually specify a curve_amount in similar size to the space buffer around obstacles in the scene. This way the curves will cut the corners around shapes but still run within this buffer space.
- Parameters
-
curve_amount | Describes the distance along the end of each line segment to turn into a curve. |
closed | Describes whether the Polygon should be treated as closed. Defaults to false. |
- Returns
- A new polyline (polygon) representing the curved path. Its points represent endpoints of line segments and Bezier spline control points. The Polygon::ts vector for this returned polygon is populated with a character for each point describing its type.
- See Also
- ts
void Avoid::PolygonInterface::getBoundingRect |
( |
double * |
minX, |
|
|
double * |
minY, |
|
|
double * |
maxX, |
|
|
double * |
maxY |
|
) |
| const |
|
inherited |
Returns the bounding rectangle that contains this polygon.
If a NULL pointer is passed for any of the arguments, then that value is ignored and not returned.
- Parameters
-
[out] | minX | The left hand side of the bounding box. |
[out] | minY | The top of the bounding box. |
[out] | maxX | The right hand side of the bounding box. |
[out] | maxY | The bottom of the bounding box. |
Polygon Avoid::Polygon::simplify |
( |
void |
| ) |
const |
|
inherited |
Returns a simplified Polyline, where all collinear line segments have been collapsed down into single line segments.
- Returns
- A new polyline with a simplified representation.
void Avoid::Polygon::translate |
( |
const double |
xDist, |
|
|
const double |
yDist |
|
) |
| |
|
inherited |
Translates the polygon position by a relative amount.
- Parameters
-
[in] | xDist | Distance to move polygon in the x dimension. |
[in] | yDist | Distance to move polygon in the y dimension. |
std::vector<char> Avoid::Polygon::ts |
|
inherited |
If used, denotes whether the corresponding point in ps is a move-to operation or a Bezier curve-to.
Each character describes the drawing operation for the corresponding point in the ps vector. Possible values are:
- 'M': A moveto operation, marks the first point;
- 'L': A lineto operation, is a line from the previous point to the current point; or
- 'C': A curveto operation, three consecutive 'C' points (along with the previous point) describe the control points of a Bezier curve.
- 'Z': Closes the path (used for cluster boundaries).
- Note
- This vector will currently only be populated for polygons returned by curvedPolyline().
The documentation for this class was generated from the following files: