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