Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
ChipmunkShape.h
1 /* Copyright (c) 2013 Scott Lembcke and Howling Moon Software
2  *
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:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
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
19  * SOFTWARE.
20  */
21 
24 
25 
27 @interface ChipmunkShape : NSObject <ChipmunkBaseObject> {
28 @private
29  id _userData;
30 }
31 
34 +(ChipmunkShape *)shapeFromCPShape:(cpShape *)shape;
35 
37 @property(nonatomic, readonly) cpShape *shape;
38 
40 @property(nonatomic, retain) ChipmunkBody *body;
41 
42 // TODO doc
43 @property(nonatomic, assign) cpFloat mass;
44 @property(nonatomic, assign) cpFloat density;
45 @property(nonatomic, readonly) cpFloat moment;
46 @property(nonatomic, readonly) cpFloat area;
47 @property(nonatomic, readonly) cpVect centerOfGravity;
48 
50 @property(nonatomic, readonly) cpBB bb;
51 
53 @property(nonatomic, assign) BOOL sensor;
54 
56 @property(nonatomic, assign) cpFloat elasticity;
57 
59 @property(nonatomic, assign) cpFloat friction;
60 
65 @property(nonatomic, assign) cpVect surfaceVelocity;
66 
71 @property(nonatomic, assign) cpCollisionType collisionType;
72 
76 @property(nonatomic, assign) cpShapeFilter filter;
77 
79 @property(nonatomic, readonly) ChipmunkSpace *space;
80 
85 @property(nonatomic, assign) id userData;
86 
88 - (cpBB)cacheBB;
89 
90 - (ChipmunkPointQueryInfo *)pointQuery:(cpVect)point;
91 - (ChipmunkSegmentQueryInfo *)segmentQueryFrom:(cpVect)start to:(cpVect)end radius:(cpFloat)radius;
92 
93 @end
94 
95 
96 @interface ChipmunkPointQueryInfo : NSObject {
97  @private
98  cpPointQueryInfo _info;
99 }
100 
101 - (id)initWithInfo:(cpPointQueryInfo *)info;
102 
104 @property(nonatomic, readonly) cpPointQueryInfo *info;
105 
107 @property(nonatomic, readonly) ChipmunkShape *shape;
108 
110 @property(nonatomic, readonly) cpVect point;
111 
114 @property(nonatomic, readonly) cpFloat distance;
115 
118 @property(nonatomic, readonly) cpVect gradient;
119 
120 @end
121 
122 
124 @interface ChipmunkSegmentQueryInfo : NSObject {
125 @private
126  cpSegmentQueryInfo _info;
127  cpVect _start, _end;
128 }
129 
130 - (id)initWithInfo:(cpSegmentQueryInfo *)info start:(cpVect)start end:(cpVect)end;
131 
133 @property(nonatomic, readonly) cpSegmentQueryInfo *info;
134 
136 @property(nonatomic, readonly) ChipmunkShape *shape;
137 
139 @property(nonatomic, readonly) cpFloat t;
140 
142 @property(nonatomic, readonly) cpVect normal;
143 
145 @property(nonatomic, readonly) cpVect point;
146 
148 @property(nonatomic, readonly) cpFloat dist;
149 
151 @property(nonatomic, readonly) cpVect start;
152 
154 @property(nonatomic, readonly) cpVect end;
155 
156 @end
157 
158 
160 @interface ChipmunkShapeQueryInfo : NSObject {
161 @private
162  ChipmunkShape *_shape;
163  cpContactPointSet _contactPoints;
164 }
165 
166 - (id)initWithShape:(ChipmunkShape *)shape andPoints:(cpContactPointSet *)set;
167 
168 @property(nonatomic, readonly) ChipmunkShape *shape;
169 @property(nonatomic, readonly) cpContactPointSet *contactPoints;
170 
171 @end
172 
173 
176 
178 + (id)circleWithBody:(ChipmunkBody *)body radius:(cpFloat)radius offset:(cpVect)offset;
179 
181 - (id)initWithBody:(ChipmunkBody *)body radius:(cpFloat)radius offset:(cpVect)offset;
182 
184 @property(nonatomic, readonly) cpFloat radius;
185 
187 @property(nonatomic, readonly) cpVect offset;
188 
189 @end
190 
191 
194 
196 + (id)segmentWithBody:(ChipmunkBody *)body from:(cpVect)a to:(cpVect)b radius:(cpFloat)radius;
197 
199 - (id)initWithBody:(ChipmunkBody *)body from:(cpVect)a to:(cpVect)b radius:(cpFloat)radius;
200 
202 - (void)setPrevNeighbor:(cpVect)prev nextNeighbor:(cpVect)next;
203 
205 @property(nonatomic, readonly) cpVect a;
206 
208 @property(nonatomic, readonly) cpVect b;
209 
211 @property(nonatomic, readonly) cpVect normal;
212 
214 @property(nonatomic, readonly) cpFloat radius;
215 
216 @end
217 
218 
221 
223 + (id)polyWithBody:(ChipmunkBody *)body count:(int)count verts:(const cpVect *)verts transform:(cpTransform)transform radius:(cpFloat)radius;
224 
226 + (id)boxWithBody:(ChipmunkBody *)body width:(cpFloat)width height:(cpFloat)height radius:(cpFloat)radius;
227 
229 + (id)boxWithBody:(ChipmunkBody *)body bb:(cpBB)bb radius:(cpFloat)radius;
230 
232 - (id)initWithBody:(ChipmunkBody *)body count:(int)count verts:(const cpVect *)verts transform:(cpTransform)transform radius:(cpFloat)radius;
233 
235 - (id)initBoxWithBody:(ChipmunkBody *)body width:(cpFloat)width height:(cpFloat)height radius:(cpFloat)radius;
236 
238 - (id)initBoxWithBody:(ChipmunkBody *)body bb:(cpBB)bb radius:(cpFloat)radius;
239 
241 @property(nonatomic, readonly) int count;
242 
244 @property(nonatomic, readonly) cpFloat radius;
245 
247 - (cpVect)getVertex:(int)index;
248 
249 @end