Wrapper for the cpPolyline type. More...
#import <ChipmunkAutoGeometry.h>
Public Member Functions | |
(cpFloat) | - momentForMass:offset: |
Calculates the moment of inertia for a looped polyline with the given mass and offset. | |
(ChipmunkPolyline *) | - simplifyCurves: |
Returns a copy of a polyline simplified by using the Douglas-Peucker algorithm. | |
(ChipmunkPolyline *) | - simplifyVertexes: |
Returns a copy of a polyline simplified by discarding "flat" vertexes. | |
(NSArray *) | - asChipmunkSegmentsWithBody:radius:offset: |
Create an array of segments for each segment in this polyline. | |
(ChipmunkPolyShape *) | - asChipmunkPolyShapeWithBody:offset: |
Create a ChipmunkPolyShape from this polyline. (Must be convex!). | |
Properties | |
bool | isLooped |
Returns true if the first and last vertex are equal. | |
cpFloat | area |
Returns the signed area of the polyline calculated by cpAreaForPoly. | |
cpVect | centroid |
Centroid of the polyline calculated by cpCentroidForPoly. | |
NSUInteger | count |
Vertex count. | |
const cpVect * | verts |
Array of vertexes. |
Wrapper for the cpPolyline type.
- (ChipmunkPolyline *) simplifyCurves: | (cpFloat) | tolerance |
Returns a copy of a polyline simplified by using the Douglas-Peucker algorithm.
This works very well on smooth or gently curved shapes, but not well on straight edged or angular shapes.
- (ChipmunkPolyline *) simplifyVertexes: | (cpFloat) | tolerance |
Returns a copy of a polyline simplified by discarding "flat" vertexes.
This works well on straigt edged or angular shapes, not as well on smooth shapes.
- (cpFloat) area [read, assign] |
Returns the signed area of the polyline calculated by cpAreaForPoly.
Non-looped polylines return an area of 0.
- (cpVect) centroid [read, assign] |
Centroid of the polyline calculated by cpCentroidForPoly.
It is an error to call this on a non-looped polyline.