1 /* Copyright (c) 2013 Scott Lembcke and Howling Moon Software
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 /// @defgroup cpPolyShape cpPolyShape
25 /// Allocate a polygon shape.
26 CP_EXPORT cpPolyShape* cpPolyShapeAlloc(void);
27 /// Initialize a polygon shape with rounded corners.
28 /// A convex hull will be created from the vertexes.
29 CP_EXPORT cpPolyShape* cpPolyShapeInit(cpPolyShape *poly, cpBody *body, int count, const cpVect *verts, cpTransform transform, cpFloat radius);
30 /// Initialize a polygon shape with rounded corners.
31 /// The vertexes must be convex with a counter-clockwise winding.
32 CP_EXPORT cpPolyShape* cpPolyShapeInitRaw(cpPolyShape *poly, cpBody *body, int count, const cpVect *verts, cpFloat radius);
33 /// Allocate and initialize a polygon shape with rounded corners.
34 /// A convex hull will be created from the vertexes.
35 CP_EXPORT cpShape* cpPolyShapeNew(cpBody *body, int count, const cpVect *verts, cpTransform transform, cpFloat radius);
36 /// Allocate and initialize a polygon shape with rounded corners.
37 /// The vertexes must be convex with a counter-clockwise winding.
38 CP_EXPORT cpShape* cpPolyShapeNewRaw(cpBody *body, int count, const cpVect *verts, cpFloat radius);
40 /// Initialize a box shaped polygon shape with rounded corners.
41 CP_EXPORT cpPolyShape* cpBoxShapeInit(cpPolyShape *poly, cpBody *body, cpFloat width, cpFloat height, cpFloat radius);
42 /// Initialize an offset box shaped polygon shape with rounded corners.
43 CP_EXPORT cpPolyShape* cpBoxShapeInit2(cpPolyShape *poly, cpBody *body, cpBB box, cpFloat radius);
44 /// Allocate and initialize a box shaped polygon shape.
45 CP_EXPORT cpShape* cpBoxShapeNew(cpBody *body, cpFloat width, cpFloat height, cpFloat radius);
46 /// Allocate and initialize an offset box shaped polygon shape.
47 CP_EXPORT cpShape* cpBoxShapeNew2(cpBody *body, cpBB box, cpFloat radius);
49 /// Get the number of verts in a polygon shape.
50 CP_EXPORT int cpPolyShapeGetCount(const cpShape *shape);
51 /// Get the @c ith vertex of a polygon shape.
52 CP_EXPORT cpVect cpPolyShapeGetVert(const cpShape *shape, int index);
53 /// Get the radius of a polygon shape.
54 CP_EXPORT cpFloat cpPolyShapeGetRadius(const cpShape *shape);