Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Instance Methods | Properties | List of all members
ChipmunkPolyline Class Reference

Wrapper for the cpPolyline type. More...

#import <ChipmunkAutoGeometry.h>

Inherits NSObject.

Instance Methods

(cpFloat- momentForMass:offset:
 Calculates the moment of inertia for a closed polyline with the given mass and offset.
 
(ChipmunkPolyline *) - simplifyCurves:
 Returns a copy of a polyline simplified by using the Douglas-Peucker algorithm. More...
 
(ChipmunkPolyline *) - simplifyVertexes:
 Returns a copy of a polyline simplified by discarding "flat" vertexes. More...
 
(ChipmunkPolyline *) - toConvexHull
 Generate a convex hull that contains a polyline. (closed or not)
 
(ChipmunkPolyline *) - toConvexHull:
 Generate an approximate convex hull that contains a polyline. (closed or not)
 
(ChipmunkPolylineSet *) - toConvexHulls_BETA:
 Generate a set of convex hulls for a polyline. More...
 
(NSArray *) - asChipmunkSegmentsWithBody:radius:offset:
 Create an array of segments for each segment in this polyline.
 
(ChipmunkPolyShape *) - asChipmunkPolyShapeWithBody:transform:radius:
 Create a ChipmunkPolyShape from this polyline. (Must be convex!)
 

Properties

bool isClosed
 Returns true if the first and last vertex are equal.
 
cpFloat area
 Returns the signed area of the polyline calculated by cpAreaForPoly. More...
 
cpVect centroid
 Centroid of the polyline calculated by cpCentroidForPoly. More...
 
NSUInteger count
 Vertex count.
 
const cpVectverts
 Array of vertexes.
 

Detailed Description

Wrapper for the cpPolyline type.

Method Documentation

- (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.

- (ChipmunkPolylineSet *) toConvexHulls_BETA: (cpFloat tolerance

Generate a set of convex hulls for a polyline.

See the note on cpPolylineConvexDecomposition_BETA() for more information.

Property Documentation

- (cpFloat) area
readnonatomicassign

Returns the signed area of the polyline calculated by cpAreaForPoly.

Non-closed polylines return an area of 0.

- (cpVect) centroid
readnonatomicassign

Centroid of the polyline calculated by cpCentroidForPoly.

It is an error to call this on a non-closed polyline.


The documentation for this class was generated from the following file: