CUGL 2.0
Cornell University Game Library
|
#include <CUPolyFactory.h>
Public Member Functions | |
PolyFactory () | |
PolyFactory (Geometry geom) | |
Geometry | getGeometry () const |
void | setGeometry (Geometry geom) |
Uint32 | getSegments () const |
void | setSegments (int segments) |
Poly2 | makeLine (const Vec2 origin, const Vec2 dest) const |
Poly2 | makeLine (float ox, float oy, float dx, float dy) const |
Poly2 * | makeLine (Poly2 *poly, const Vec2 origin, const Vec2 dest) const |
Poly2 * | makeLine (Poly2 *poly, float ox, float oy, float dx, float dy) const |
Poly2 | makeTraversal (const Poly2 &src, poly2::Traversal type) const |
Poly2 * | makeTraversal (Poly2 *poly, const Poly2 &src, poly2::Traversal type) const |
Poly2 | makeTriangle (const Vec2 a, const Vec2 b, const Vec2 c) const |
Poly2 | makeTriangle (float ax, float ay, float bx, float by, float cx, float cy) const |
Poly2 * | makeTriangle (Poly2 *poly, const Vec2 a, const Vec2 b, const Vec2 c) const |
Poly2 * | makeTriangle (Poly2 *poly, float ax, float ay, float bx, float by, float cx, float cy) const |
Poly2 | makeRect (const Vec2 origin, const Vec2 size) const |
Poly2 | makeRect (const Rect rect) const |
Poly2 | makeRect (float x, float y, float w, float h) const |
Poly2 * | makeRect (Poly2 *poly, const Vec2 origin, const Vec2 size) const |
Poly2 * | makeRect (Poly2 *poly, const Rect rect) const |
Poly2 * | makeRect (Poly2 *poly, float x, float y, float w, float h) const |
Poly2 | makeEllipse (const Vec2 center, const Vec2 size) const |
Poly2 | makeEllipse (float cx, float cy, float sx, float sy) const |
Poly2 * | makeEllipse (Poly2 *poly, const Vec2 center, const Vec2 size) const |
Poly2 * | makeEllipse (Poly2 *poly, float cx, float cy, float sx, float sy) const |
Poly2 | makeCircle (const Vec2 center, float radius) const |
Poly2 | makeCircle (float cx, float cy, float radius) const |
Poly2 * | makeCircle (Poly2 *poly, const Vec2 center, float radius) const |
Poly2 * | makeCircle (Poly2 *poly, float cx, float cy, float radius) const |
Poly2 | makeArc (const Vec2 center, float radius, float start, float degrees) const |
Poly2 | makeArc (float cx, float cy, float radius, float start, float degrees) const |
Poly2 * | makeArc (Poly2 *poly, const Vec2 center, float radius, float start, float degrees) const |
Poly2 * | makeArc (Poly2 *poly, float cx, float cy, float radius, float start, float degrees) const |
Poly2 | makeRoundedRect (const Vec2 origin, const Size size, float radius) const |
Poly2 | makeRoundedRect (const Rect rect, float radius) const |
Poly2 | makeRoundedRect (float x, float y, float w, float h, float r) const |
Poly2 * | makeRoundedRect (Poly2 *poly, const Vec2 origin, const Size size, float radius) const |
Poly2 * | makeRoundedRect (Poly2 *poly, const Rect rect, float radius) const |
Poly2 * | makeRoundedRect (Poly2 *poly, float x, float y, float w, float h, float r) const |
Poly2 | makeCapsule (const Vec2 origin, const Size size) const |
Poly2 | makeCapsule (const Rect rect) const |
Poly2 | makeCapsule (float x, float y, float w, float h) const |
Poly2 * | makeCapsule (Poly2 *poly, const Vec2 origin, const Size size) const |
Poly2 * | makeCapsule (Poly2 *poly, const Rect rect) const |
Poly2 * | makeCapsule (Poly2 *poly, float x, float y, float w, float h) const |
Poly2 | makeCapsule (poly2::Capsule shape, const Vec2 origin, const Size size) const |
Poly2 | makeCapsule (poly2::Capsule shape, const Rect rect) const |
Poly2 | makeCapsule (poly2::Capsule shape, float x, float y, float w, float h) const |
Poly2 * | makeCapsule (Poly2 *poly, poly2::Capsule shape, const Vec2 origin, const Size size) const |
Poly2 * | makeCapsule (Poly2 *poly, poly2::Capsule shape, const Rect rect) const |
Poly2 * | makeCapsule (Poly2 *poly, poly2::Capsule shape, float x, float y, float w, float h) const |
This class is a factory for generating common Poly2 objects.
Most of the time that we create a polygon, we are using it to approximate a common shape, like a circle, or a rounded rectangle. Instead of embedding all of this functionality into Poly2 (which already has enough to do on its own), we have factored this out into a a separate factory class. This factory can generate new polygons or reset existing ones (conserving memory).
This factory is much lighter weight than the triangulation or extrusion factories. In this factory, the calculation step and the materialization step are one in the same. That is because the calculations are short and do not need to be refactored for multithread calculation. Indeed, the only reason this factory is not a collection of simple functions is because that we have have some settings (like precision and geometry) that we want to set separately.
cugl::PolyFactory::PolyFactory | ( | ) |
Creates a PolyFactory for generating Geometry#SOLID shapes
cugl::PolyFactory::PolyFactory | ( | Geometry | geom | ) |
Creates a PolyFactory for generating shapes of the given geometry.
geom | The geometry to use when generating shapes |
|
inline |
Returns the current drawing geometry of this factory.
All shapes created by this factory will have the given geometry until it is set to be otherwise.
|
inline |
Returns the number of segments to be used for rounded shapes.
Rounded shapes include makeEllipse, makeCircle, makeArc, and makeRoundedRect.
|
inline |
Returns a polygon that represents an arc of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. All arc measurements are in degrees, not radians.
center | The arc center point (of the defining circle |
radius | The radius from the center point |
start | The starting angle in degrees |
degrees | The number of degrees to generate |
Poly2 cugl::PolyFactory::makeArc | ( | float | cx, |
float | cy, | ||
float | radius, | ||
float | start, | ||
float | degrees | ||
) | const |
Returns a polygon that represents an arc of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. All arc measurements are in degrees, not radians.
cx | The x-coordinate of the center point |
cy | The y-coordinate of the center point |
radius | The radius from the center point |
start | The starting angle in degrees |
degrees | The number of degrees to generate |
|
inline |
Stores an arc in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. All arc measurements are in degrees, not radians.
The arc will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
center | The arc center point (of the defining circle |
radius | The radius from the center point |
start | The starting angle in degrees |
degrees | The number of degrees to generate |
Poly2* cugl::PolyFactory::makeArc | ( | Poly2 * | poly, |
float | cx, | ||
float | cy, | ||
float | radius, | ||
float | start, | ||
float | degrees | ||
) | const |
Stores an arc in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. All arc measurements are in degrees, not radians.
The arc will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
cx | The x-coordinate of the center point |
cy | The y-coordinate of the center point |
radius | The radius from the center point |
start | The starting angle in degrees |
degrees | The number of degrees to generate |
Returns a polygon that represents a (full) capsule of the given dimensions.
A capsule is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
rect | The enclosing rectangle |
Returns a polygon that represents a (full) capsule of the given dimensions.
A capsule is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
origin | The enclosing rectangle origin |
size | The enclosing rectangle size |
Poly2 cugl::PolyFactory::makeCapsule | ( | float | x, |
float | y, | ||
float | w, | ||
float | h | ||
) | const |
Returns a polygon that represents a (full) capsule of the given dimensions.
A capsule is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
x | The x-coordinate of the bottom left corner of the bounding box |
y | The y-coordinate of the bottom left corner of the bounding box |
w | The capsule width |
h | The capsule height |
Stores a (full) capsule in the provided buffer.
A capsule is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The capsule will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
rect | The enclosing rectangle |
|
inline |
Stores a (full) capsule in the provided buffer.
A capsule is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The capsule will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
origin | The enclosing rectangle origin |
size | The enclosing rectangle size |
Stores a (full) capsule in the provided buffer.
A capsule is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom.Otherwise it will be oriented horizontally.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The capsule will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
x | The x-coordinate of the bottom left corner of the bounding box |
y | The y-coordinate of the bottom left corner of the bounding box |
w | The capsule width |
h | The capsule height |
|
inline |
Stores a capsule in the provided buffer.
A capsule typically is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
This method allows for the creation of half-capsules, simply by using the enumeration poly2::Capsule. The enumeration specifies which side should be rounded in case of a half-capsule. Half-capsules are sized so that the corresponding full capsule would fit in the bounding box.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The capsule will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
shape | The capsule shape |
rect | The enclosing rectangle |
|
inline |
Stores a capsule in the provided buffer.
A capsule typically is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
This method allows for the creation of half-capsules, simply by using the enumeration poly2::Capsule. The enumeration specifies which side should be rounded in case of a half-capsule. Half-capsules are sized so that the corresponding full capsule would fit in the bounding box.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The capsule will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
shape | The capsule shape |
origin | The enclosing rectangle origin |
size | The enclosing rectangle size |
Poly2* cugl::PolyFactory::makeCapsule | ( | Poly2 * | poly, |
poly2::Capsule | shape, | ||
float | x, | ||
float | y, | ||
float | w, | ||
float | h | ||
) | const |
Stores a capsule in the provided buffer.
A capsule typically is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
This method allows for the creation of half-capsules, simply by using the enumeration poly2::Capsule. The enumeration specifies which side should be rounded in case of a half-capsule. Half-capsules are sized so that the corresponding full capsule would fit in the bounding box.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The capsule will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
shape | The capsule shape |
x | The x-coordinate of the bottom left corner of the bounding box |
y | The y-coordinate of the bottom left corner of the bounding box |
w | The capsule width |
h | The capsule height |
|
inline |
Returns a polygon that represents a capsule of the given dimensions.
A capsule typically is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
This method allows for the creation of half-capsules, simply by using the enumeration poly2::Capsule. The enumeration specifies which side should be rounded in case of a half-capsule. Half-capsules are sized so that the corresponding full capsule would fit in the bounding box.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
shape | The capsule shape |
rect | The enclosing rectangle |
|
inline |
Returns a polygon that represents a capsule of the given dimensions.
A capsule typically is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
This method allows for the creation of half-capsules, simply by using the enumeration poly2::Capsule. The enumeration specifies which side should be rounded in case of a half-capsule. Half-capsules are sized so that the corresponding full capsule would fit in the bounding box.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
shape | The capsule shape |
origin | The enclosing rectangle origin |
size | The enclosing rectangle size |
Poly2 cugl::PolyFactory::makeCapsule | ( | poly2::Capsule | shape, |
float | x, | ||
float | y, | ||
float | w, | ||
float | h | ||
) | const |
Returns a polygon that represents a (full) capsule of the given dimensions.
A capsule typically is a pill-like shape that fits inside of given rectangle. If width < height, the capsule will be oriented vertically with the rounded portions at the top and bottom. Otherwise it will be oriented horizontally.
This method allows for the creation of half-capsules, simply by using the enumeration poly2::Capsule. The enumeration specifies which side should be rounded in case of a half-capsule. Half-capsules are sized so that the corresponding full capsule would fit in the bounding box.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
shape | The capsule shape |
x | The x-coordinate of the bottom left corner of the bounding box |
y | The y-coordinate of the bottom left corner of the bounding box |
w | The capsule width |
h | The capsule height |
Returns a polygon that represents a circle of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. This method can be used to generate regular, many-sided polygons by varying the value of setSegments.
center | The circle center point |
radius | The circle radius |
Poly2 cugl::PolyFactory::makeCircle | ( | float | cx, |
float | cy, | ||
float | radius | ||
) | const |
Returns a polygon that represents a circle of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. This method can be used to generate regular, many-sided polygons by varying the value of setSegments.
cx | The x-coordinate of the center point |
cy | The y-coordinate of the center point |
radius | The circle radius |
Stores a circle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. This method can be used to generate regular, many-sided polygons by varying the value of setSegments.
The circle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
center | The circle center point |
radius | The circle radius |
Stores a circle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. This method can be used to generate regular, many-sided polygons by varying the value of setSegments.
The circle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
cx | The x-coordinate of the center point |
cy | The y-coordinate of the center point |
radius | The circle radius |
Returns a polygon that represents an ellipse of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
center | The ellipse center point |
size | The size of the ellipse |
Poly2 cugl::PolyFactory::makeEllipse | ( | float | cx, |
float | cy, | ||
float | sx, | ||
float | sy | ||
) | const |
Returns a polygon that represents an ellipse of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
cx | The x-coordinate of the center point |
cy | The y-coordinate of the center point |
sx | The size (diameter) along the x-axis |
sy | The size (diameter) along the y-axis |
|
inline |
Stores an ellipse in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The ellipse will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
center | The ellipse center point |
size | The size of the ellipse |
Poly2* cugl::PolyFactory::makeEllipse | ( | Poly2 * | poly, |
float | cx, | ||
float | cy, | ||
float | sx, | ||
float | sy | ||
) | const |
Stores an ellipse in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid ellipse and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The ellipse will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
cx | The x-coordinate of the center point |
cy | The y-coordinate of the center point |
sx | The size (diameter) along the x-axis |
sy | The size (diameter) along the y-axis |
Returns a polygon that represents a line segment from origin to dest.
This method will do nothing if the geometry is Geometry#SOLID. However, it does support all other geometry types, including POINTS
and IMPLICIT
.
origin | The line origin |
dest | The line destination |
Poly2 cugl::PolyFactory::makeLine | ( | float | ox, |
float | oy, | ||
float | dx, | ||
float | dy | ||
) | const |
Returns a polygon that represents a line segment from origin to dest.
This method will do nothing if the geometry is Geometry#SOLID. However, it does support all other geometry types, including POINTS
and IMPLICIT
.
ox | The x-coordinate of the origin |
oy | The y-coordinate of the origin |
dx | The x-coordinate of the destination |
dy | The y-coordinate of the destination |
|
inline |
Stores a line segment from origin to dest in the provided buffer.
The line will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data. This method will do nothing if the current geometry is Geometry#SOLID. However, it does support all other geometry types, including POINTS
and IMPLICIT
.
poly | The polygon to store the result |
origin | The line origin |
dest | The line destination |
Stores a line segment from origin to dest in the provided buffer.
The line will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data. This method will do nothing if the current geometry is Geometry#SOLID. However, it does support all other geometry types, including POINTS
and IMPLICIT
.
poly | The polygon to store the result |
ox | The x-coordinate of the origin |
oy | The y-coordinate of the origin |
dx | The x-coordinate of the destination |
dy | The y-coordinate of the destination |
Returns a polygon that represents a rectangle
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid rectangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
rect | The rectangle |
Returns a polygon that represents a rectangle
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid rectangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
origin | The rectangle origin |
size | The rectangle size |
Poly2 cugl::PolyFactory::makeRect | ( | float | x, |
float | y, | ||
float | w, | ||
float | h | ||
) | const |
Returns a polygon that represents a rectangle
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid rectangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
x | The x-coordinate of the bottom left corner |
y | The y-coordinate of the bottom left corner |
w | The rectangle width |
h | The rectangle height |
Stores a rectangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid rectangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The rectangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
rect | The rectangle to create |
|
inline |
Stores a rectangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid rectangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The rectangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
origin | The rectangle origin |
size | The rectangle size |
Stores a rectangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid rectangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The rectangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
x | The x-coordinate of the bottom left corner |
y | The y-coordinate of the bottom left corner |
w | The rectangle width |
h | The rectangle height |
Returns a polygon that represents a rounded rectangle of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. The radius should not exceed either half the width or half the height.
rect | The enclosing rectangle |
radius | The radius of each corner |
|
inline |
Returns a polygon that represents a rounded rectangle of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. The radius should not exceed either half the width or half the height.
origin | The enclosing rectangle origin |
size | The enclosing rectangle size |
radius | The radius of each corner |
Poly2 cugl::PolyFactory::makeRoundedRect | ( | float | x, |
float | y, | ||
float | w, | ||
float | h, | ||
float | r | ||
) | const |
Returns a polygon that represents a rounded rectangle of the given dimensions.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. The radius should not exceed either half the width or half the height.
x | The x-coordinate of the bottom left corner of the bounding box |
y | The y-coordinate of the bottom left corner of the bounding box |
w | The rectangle width |
h | The rectangle height |
r | The radius of each corner |
|
inline |
Stores a rounded rectangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. The radius should not exceed either half the width or half the height.
The rounded rectangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
rect | The enclosing rectangle |
radius | The radius of each corner |
|
inline |
Stores a rounded rectangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. The radius should not exceed either half the width or half the height.
The rounded rectangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
origin | The enclosing rectangle origin |
size | The enclosing rectangle size |
radius | The radius of each corner |
Poly2* cugl::PolyFactory::makeRoundedRect | ( | Poly2 * | poly, |
float | x, | ||
float | y, | ||
float | w, | ||
float | h, | ||
float | r | ||
) | const |
Stores a rounded rectangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid arc and Geometry#PATH for an outline. Other geometries are supported as well, if necessary. The radius should not exceed either half the width or half the height.
The rounded rectangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
x | The x-coordinate of the bottom left corner of the bounding box |
y | The y-coordinate of the bottom left corner of the bounding box |
w | The rectangle width |
h | The rectangle height |
r | The radius of each corner |
Poly2 cugl::PolyFactory::makeTraversal | ( | const Poly2 & | src, |
poly2::Traversal | type | ||
) | const |
Returns a polygon representing a wire frame of an existing polygon.
This method provides four types of traversals: NONE
, OPEN
, CLOSED
and INTERIOR
. No traversal simply copies the given polygon. The open and closed traversals apply to the boundary of the polygon (as determined by Geometry#boundaries. If there is more than one boundary, then the closed traversal connects the boundaries together in a single loop.
Finally, the interior traversal creates a wire frame a polygon triangulation. This means that it can only be applied to a SOLID
polygon. An interior traversal is meaningless unless the polygon has an existing triangulation.
This method does nothing if the geometry is Geometry#SOLID. However, it does support all other geometry types, including POINTS
and IMPLICIT
.
src | The source polygon to traverse |
type | The traversal type |
Poly2* cugl::PolyFactory::makeTraversal | ( | Poly2 * | poly, |
const Poly2 & | src, | ||
poly2::Traversal | type | ||
) | const |
Stores a wire frame of an existing polygon in the provided buffer.
This method provides four types of traversals: NONE
, OPEN
, CLOSED
and INTERIOR
. No traversal simply copies the given polygon. The open and closed traversals apply to the boundary of the polygon (as determined by Geometry#boundaries. If there is more than one boundary, then the closed traversal connects the boundaries together in a single loop.
Finally, the interior traversal creates a wire frame a polygon triangulation. This means that it can only be applied to a SOLID
polygon. An interior traversal is meaningless unless the polygon has an existing triangulation.
This method does nothing if the geometry is Geometry#SOLID. However, it does support all other geometry types, including POINTS
and IMPLICIT
.
The traversal will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
src | The source polygon to traverse |
type | The traversal type |
Returns a polygon that represents a simple triangle.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid triangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
a | The first vertex. |
b | The second vertex. |
c | The third vertex. |
Poly2 cugl::PolyFactory::makeTriangle | ( | float | ax, |
float | ay, | ||
float | bx, | ||
float | by, | ||
float | cx, | ||
float | cy | ||
) | const |
Returns a polygon that represents a simple triangle.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid triangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
ax | The x-coordinate of the first vertex. |
ay | The y-coordinate of the first vertex. |
bx | The x-coordinate of the second vertex. |
by | The y-coordinate of the second vertex. |
cx | The x-coordinate of the third vertex. |
cy | The y-coordinate of the third vertex. |
|
inline |
Stores a simple triangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid triangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The triangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
a | The first vertex |
b | The second vertex |
c | The third vertex |
Poly2* cugl::PolyFactory::makeTriangle | ( | Poly2 * | poly, |
float | ax, | ||
float | ay, | ||
float | bx, | ||
float | by, | ||
float | cx, | ||
float | cy | ||
) | const |
Stores a simple triangle in the provided buffer.
The polygon will be generated by the current geometry. Use Geometry#SOLID for a solid triangle and Geometry#PATH for an outline. Other geometries are supported as well, if necessary.
The triangle will be appended to the buffer. You should clear the buffer first if you do not want to preserve the original data.
poly | The polygon to store the result |
ax | The x-coordinate of the first vertex |
ay | The y-coordinate of the first vertex |
bx | The x-coordinate of the second vertex |
by | The y-coordinate of the second vertex |
cx | The x-coordinate of the third vertex |
cy | The y-coordinate of the third vertex |
|
inline |
Sets the current drawing geometry of this factory.
Changing this value will alter the geometry to be used in all future shapes created by this factory.
geom | The current drawing geometry of this factory. |
|
inline |
Sets the number of segments to be used for rounded shapes.
Rounded shapes include makeEllipse, makeCircle, makeArc, and makeRoundedRect.
segments | The number of segments to be used for rounded shapes. |