Package pybox2d :: Module Box2D
[hide private]
[frames] | no frames]

Source Code for Module pybox2d.Box2D

   1  # This file was automatically generated by SWIG (http://www.swig.org). 
   2  # Version 1.3.38 
   3  # 
   4  # Do not make changes to this file unless you know what you are doing--modify 
   5  # the SWIG interface file instead. 
   6   
   7  from sys import version_info 
   8  if version_info >= (3,0,0): 
   9      new_instancemethod = lambda func, inst, cls: _Box2D.SWIG_PyInstanceMethod_New(func) 
  10  else: 
  11      from new import instancemethod as new_instancemethod 
  12  if version_info >= (2,6,0): 
13 - def swig_import_helper():
14 from os.path import dirname 15 import imp 16 try: 17 fp, pathname, description = imp.find_module('_Box2D', [dirname(__file__)]) 18 _mod = imp.load_module('_Box2D', fp, pathname, description) 19 finally: 20 if fp is not None: fp.close() 21 return _mod
22 _Box2D = swig_import_helper() 23 del swig_import_helper 24 else: 25 import _Box2D 26 del version_info 27 try: 28 _swig_property = property 29 except NameError: 30 pass # Python < 2.2 doesn't have 'property'.
31 -def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
32 if (name == "thisown"): return self.this.own(value) 33 if (name == "this"): 34 if type(value).__name__ == 'SwigPyObject': 35 self.__dict__[name] = value 36 return 37 method = class_type.__swig_setmethods__.get(name,None) 38 if method: return method(self,value) 39 if (not static) or hasattr(self,name): 40 self.__dict__[name] = value 41 else: 42 raise AttributeError("You cannot add attributes to %s" % self)
43
44 -def _swig_setattr(self,class_type,name,value):
45 return _swig_setattr_nondynamic(self,class_type,name,value,0)
46
47 -def _swig_getattr(self,class_type,name):
48 if (name == "thisown"): return self.this.own() 49 method = class_type.__swig_getmethods__.get(name,None) 50 if method: return method(self) 51 raise AttributeError(name)
52
53 -def _swig_repr(self):
54 try: strthis = "proxy of " + self.this.__repr__() 55 except: strthis = "" 56 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
57 58 try: 59 _object = object 60 _newclass = 1 61 except AttributeError:
62 - class _object : pass
63 _newclass = 0 64 65
66 -def _swig_setattr_nondynamic_method(set):
67 def set_attr(self,name,value): 68 if (name == "thisown"): return self.this.own(value) 69 if hasattr(self,name) or (name == "this"): 70 set(self,name,value) 71 else: 72 raise AttributeError("You cannot add attributes to %s" % self)
73 return set_attr 74 75 76 try: 77 import weakref 78 weakref_proxy = weakref.proxy 79 except: 80 weakref_proxy = lambda x: x 81 82 83
84 -def __b2PythonJointPointerEquals__(*args):
85 return _Box2D.__b2PythonJointPointerEquals__(*args)
86 __b2PythonJointPointerEquals__ = _Box2D.__b2PythonJointPointerEquals__ 87
88 -def __b2PythonBodyPointerEquals__(*args):
89 return _Box2D.__b2PythonBodyPointerEquals__(*args)
90 __b2PythonBodyPointerEquals__ = _Box2D.__b2PythonBodyPointerEquals__ 91
92 -def __b2PythonShapePointerEquals__(*args):
93 return _Box2D.__b2PythonShapePointerEquals__(*args)
94 __b2PythonShapePointerEquals__ = _Box2D.__b2PythonShapePointerEquals__ 95
96 -def __b2PythonControllerPointerEquals__(*args):
97 return _Box2D.__b2PythonControllerPointerEquals__(*args)
98 __b2PythonControllerPointerEquals__ = _Box2D.__b2PythonControllerPointerEquals__
99 -class b2PickleError (Exception): pass
100
101 -def _pickle_fix_value_load(lists, value):
102 """ 103 Returns the appropriate object (a b2Body, b2Shape, b2Joint, b2Controller) 104 based on the indices in the passed-in dictionary. 105 """ 106 bodyList, jointList, controllerList=lists 107 108 if not isinstance(value, dict): 109 return value 110 elif 'pickle_type' not in value: 111 return value 112 113 # Depending on the type, use the right list 114 if value['pickle_type']=='b2Body': 115 return bodyList[ value['body'] ] 116 117 elif value['pickle_type']=='b2Shape': 118 body = bodyList[ value['body'] ] 119 shape = body.shapeList[ value['shape'] ] 120 return shape 121 122 elif value['pickle_type']=='b2Joint': 123 return jointList[ value['joint'] ] 124 125 elif value['pickle_type']=='b2Controller': 126 return controllerList[ value['controller'] ] 127 128 return value
129
130 -def _pickle_fix_value_save(lists, value):
131 """ 132 Fixes: b2Body, b2Shape, b2Joint, b2Controller 133 134 In place of an unpicklable b2Body outside of a world, use a dictionary with 135 an index to the appropriate place in the world. 136 """ 137 bodyList, jointList, controllerList=lists 138 139 if isinstance(value, b2Body): 140 value = { 'pickle_type' : 'b2Body', 'body' : bodyList.index(value) } 141 elif isinstance(value, b2Shape): 142 body = value.GetBody() 143 shapeID = body.shapeList.index(value) 144 value = { 'pickle_type' : 'b2Shape', 'body': bodyList.index(body), 'shape' : shapeID} 145 elif isinstance(value, b2Joint): 146 value = { 'pickle_type' : 'b2Joint', 'joint': jointList.index(value) } 147 elif isinstance(value, b2Controller): 148 value = { 'pickle_type' : 'b2Controller', 'controller' : controllerList.index(value)} 149 150 return value
151
152 -def pickle_fix(world, var, func='save', lists=None):
153 """ 154 Fix variables so that they may be pickled (or loaded from a pickled state). 155 You cannot save a b2Body by itself, but if passed in with the world, it's possible 156 to pickle it. 157 158 So, be sure to use this on your box2d-related variables before and after pickling. 159 160 e.g., 161 + Save: 162 my_pickled_vars = box2d.pickle_fix(myworld, my_vars, 'save') 163 pickle.dump([myworld, my_pickled_vars], open(fn, 'wb')) 164 165 + Load 166 world, my_pickled_vars = pickle.load(open(fn, 'rb')) 167 myworld = world._pickle_finalize() 168 my_vars=box2d.pickle_fix(myworld, my_pickled_vars, 'load') 169 170 For an actual implementation of pickling, see the testbed (main test and test_pickle). 171 """ 172 if func=='save': 173 fix_function=_pickle_fix_value_save 174 elif func=='load': 175 fix_function=_pickle_fix_value_load 176 else: 177 raise ValueError, 'Expected func in ("save", "load")' 178 179 if not lists: 180 # these lists are all created dynamically, so do this once 181 lists=[world.bodyList, world.jointList, world.controllerList] 182 183 if isinstance(var, (list, tuple)): 184 # Create a new list/tuple and fix each item 185 new_list=[pickle_fix(world, value, func, lists) for value in var] 186 if isinstance(var, tuple): 187 # If it was originally a tuple, make this new list a tuple 188 new_list=tuple(new_list) 189 return new_list 190 elif isinstance(var, dict): 191 if func=='load' and 'pickle_type' in var: 192 # Loading a dictionary placeholder for an object 193 return fix_function(lists, var) 194 195 # Create a new dictionary and fix each item 196 new_dict={} 197 for var, value in var.items(): 198 new_dict[var]=pickle_fix(world, value, func, lists) 199 return new_dict 200 else: 201 # Not a dictionary/list, so it is probably just a normal value. 202 # Fix and return it. 203 ret= fix_function(lists, var) 204 return ret
205 206 # -- unpicklable object --
207 -def no_pickle(self):
208 raise b2PickleError, 'Cannot pickle this object. Pickle the typecasted object: object.getAsType()'
209 210 # -- generic get and set state --
211 -def _generic_setstate(self, dict):
212 """ 213 Takes each variable=value pair in the dictionary and 214 sets the attributes based on them 215 """ 216 self.__init__() 217 for key, value in dict.iteritems(): 218 setattr(self, key, value)
219
220 -def _generic_getstate(self, additional_ignore=[]):
221 """ 222 Returns a dictionary representation of self, with 223 dict(var=value [, ...]) 224 225 additional_ignore can be specified to ignore certain 226 properties. 227 """ 228 ignore_properties = ['thisown', 'this', 'next', 'prev', 229 'world', 'coreVertices', 'normals'] 230 if additional_ignore: 231 ignore_properties += additional_ignore 232 233 vars = [v for v in dir(self.__class__) 234 if isinstance(getattr(self.__class__, v), property) 235 and v not in ignore_properties] 236 return dict((var, getattr(self, var)) for var in vars)
237 238 # -- factory output -- (i.e., b2Body,
239 -def _pickle_factory_set(self, data):
240 """ 241 The factory output cannot be created just yet, 242 so store the necessary information to create it later. 243 """ 244 self.__pickle_data__ = data
245 246 # -- factory output finalizing (loading)
247 -def _pickle_finalize(self, world=None, body=None):
248 """ 249 Finalize one of the outputs that we previously set as a 250 dictionary. 251 """ 252 if not hasattr(self, '__pickle_data__'): 253 raise b2PickleError, "Invalid object passed to _pickle_finalize" 254 255 # At this point, 'self' is invalid on the SWIG-end of things. 256 # __init__ has not been called, so it only exists on the Python-end. 257 258 # The previously saved-data 259 data = self.__pickle_data__ 260 261 # These types are what are passed in: 262 # create_function output input 263 pairs = [ (lambda w,b,v: w.CreateBody(v) , b2Body , b2BodyDef), 264 (lambda w,b,v: b.CreateShape(v), b2PolygonShape, b2PolygonDef), 265 (lambda w,b,v: b.CreateShape(v), b2CircleShape , b2CircleDef), 266 (lambda w,b,v: b.CreateShape(v), b2EdgeChainDef, b2EdgeChainDef), 267 ] 268 269 createfcn = None 270 271 # Create a new instance of the definition so that it may re-create 272 # the object. 273 for fcn, output, input in pairs: 274 if isinstance(self, output): 275 self = input() 276 createfcn=fcn 277 break 278 279 if not createfcn: 280 raise b2PickleError, "Invalid object passed to _pickle_finalize" 281 282 # A few things exist that cannot be set in the definition and can only 283 # be set after the object is created. Check for these and then set them 284 # after if necessary. 285 do_after_classes=(b2Body, b2Shape, list) 286 do_after_props =['linearVelocity', 'angularVelocity', 'isSleeping'] 287 finalize_after = [] 288 289 if isinstance(self, (b2PolygonDef, b2EdgeChainDef)): 290 # Polygon/edge shape. Set their vertices first, as normally they would 291 # be put in the 'do after' section 292 self.vertices = data['vertices'] 293 del data['vertices'] 294 295 for var in data: 296 value = data[var] 297 if isinstance(value, do_after_classes) or var in do_after_props: 298 # Set these after creation 299 finalize_after.append( (var, value) ) 300 elif hasattr(self, var): 301 setattr(self, var, value) 302 303 # Create the actual object (not just the definition) 304 self = createfcn(world, body, self) 305 306 # If we just created a body, set that for the upcoming recursion. 307 # Finalizing the shape will require that this be set. 308 if isinstance(self, b2Body): 309 body = self 310 311 for var, value in finalize_after: 312 if var == 'shapeList': 313 # A shapelist is a special case, do it separately 314 _pickle_finalize_shapelist(world, body, value) 315 elif var == 'isSleeping': 316 # Sleeping is only modifiable by functions, and as such is a special case 317 if value: 318 self.PutToSleep() 319 else: 320 self.WakeUp() 321 elif hasattr(self, var): 322 # The attribute exists, so set it. 323 if hasattr(value, '_pickle_finalize'): 324 # But first finalize it if necessary. 325 value=_pickle_finalize(value,world,body) 326 setattr(self, var, value) 327 328 return self
329 330 # -- custom handlers --
331 -def _pickle_finalize_controller(data, world):
332 """ 333 Finalize a controller. It's mostly standard, just 334 requires a custom bodyList. 335 """ 336 defn = globals()["b2%sControllerDef" % data['_type']] () 337 338 bodyList = world.bodyList 339 for var in data: 340 value = data[var] 341 if hasattr(defn, var): 342 setattr(defn, var, value) 343 344 # Create the controller 345 controller = world.CreateController(defn) 346 347 # And now add the bodies to it 348 for body in data['bodyList']: 349 try: 350 real_body = bodyList[ int(body) ] 351 except: 352 raise b2PickleError, 'World not initialized properly; unable to create controller' 353 controller.AddBody(real_body) 354 355 return controller
356
357 -def _pickle_finalize_joint(data, world):
358 """ 359 Finalize a joint. 360 The bodies and joints need to be retrieved from the world list 361 in order to make the joint. 362 """ 363 364 defn = globals()["b2%sJointDef" % data['_type']] () 365 366 body_names = ['body1' , 'body2' ] 367 joint_names = ['joint1', 'joint2'] 368 369 bodyList = world.bodyList 370 jointList = world.jointList 371 372 for var in data: 373 value = data[var] 374 375 if var=='localXAxis1': 376 var = 'localAxis1' # single rename necessary 377 378 if not hasattr(defn, var): 379 continue 380 381 if var in body_names: 382 # Set the body based on the global body list 383 try: 384 value = bodyList[ int(value) ] 385 except: 386 raise b2PickleError, 'World not initialized properly; unable to create joint' 387 elif var in joint_names: 388 # Set the joint based on the global joint list 389 try: 390 value = jointList[ int(value) ] 391 except: 392 raise b2PickleError, 'World not initialized properly; unable to create joint' 393 394 # Set the value 395 setattr(defn, var, value) 396 397 return world.CreateJoint(defn)
398
399 -def _pickle_finalize_shapelist(world, body, shapelist):
400 """ 401 Finalize the shape list for a body. 402 Only reason this has to be implemented separately is because of the 403 way edge chains are implemented. 404 """ 405 for s in shapelist: 406 if isinstance(s, dict): 407 # Special case, an edge shape. pickled as a 408 # dictionary. Create a fake definition and finalize it. 409 temp=b2EdgeChainDef() 410 temp.__pickle_data__=s 411 _pickle_finalize(temp, world, body) 412 else: 413 s._pickle_finalize(world, body)
414
415 -def _pickle_finalize_world(self):
416 """ 417 Finalize a b2World. 418 """ 419 if not hasattr(self, '__pickle_data__'): 420 raise b2PickleError, 'Finalizing a world that was not loaded?' 421 422 data = self.__pickle_data__ 423 424 # Create the world. Only 3 parameters to deal with. 425 world = b2World(data['worldAABB'], data['gravity'], data['doSleep']) 426 427 # First, deal with the ground body. It cannot be taken care of as a 428 # normal body since we do not create it; the constructor of the world 429 # on the C++-side creates it. 430 gb_data = data['groundBody'].__pickle_data__ 431 432 # Finalize its shapelist 433 _pickle_finalize_shapelist(world, world.groundBody, gb_data['shapeList']) 434 435 # And then go through each variable, setting the properties 436 for var in gb_data.keys(): 437 value = gb_data[var] 438 if isinstance(value, (b2Shape)) or var=='shapeList': 439 pass 440 elif hasattr(world.groundBody, var): 441 try: 442 setattr(world.groundBody, var, value) 443 except AttributeError: 444 pass 445 446 # Finalize each body 447 for body in data['bodyList']: 448 body._pickle_finalize(world) 449 450 # Finalize each joint 451 for joint in data['jointList']: 452 _pickle_finalize_joint(joint, world) 453 454 # Finalize each controller 455 for controller in data['controllerList']: 456 _pickle_finalize_controller(controller, world) 457 458 # And that is it. :) 459 return world
460
461 -def _pickle_body_getstate(self):
462 """ 463 Everything is essentially generic_getstate, 464 except for edge shape handling. 465 466 TODO: I can see a possible issue in this if joints are used on 467 an edge shape or a body with edge shapes and other shapes. 468 The shape list order could be improperly recreated. We'll see 469 if anything happens... 470 """ 471 472 def get_edge_vertices_and_shapes(shape): 473 """ 474 Determine whether or not the edge is a loop. 475 Also, return each shape that this passes through. 476 Then return the vertices. 477 478 Returns is_loop, shapes, vertices 479 """ 480 481 vertices = [] 482 shapes = [] 483 edge = shape 484 while edge: 485 shapes.append(edge) 486 vertices.append( edge.vertex1 ) 487 last=edge.vertex2 488 489 # Go to the next edge 490 edge=edge.next 491 if edge==shape: # A loop 492 return True, shapes, vertices 493 494 # Not a loop 495 vertices.append( last ) 496 return False, shapes, vertices
497 498 # Get all the basic attributes except for shapeList 499 ret = _generic_getstate(self, ['shapeList']) 500 501 # Now check each shape in the list 502 ret['shapeList']=[] 503 handled_edges = [] 504 for shape in self.shapeList: 505 if isinstance(shape, b2EdgeShape): 506 if shape in handled_edges: 507 # This edge was already added from another one 508 # because they were linked together. 509 continue 510 511 is_loop, shapes, vertices=get_edge_vertices_and_shapes(shape) 512 handled_edges.extend(shapes) 513 514 # Create a dictionary for this edge shape 515 # (to be finalized in _pickle_finalize_shapelist when loaded) 516 shape_info = _generic_getstate(shape, ['vertices','length','coreVertex1','coreVertex2']) 517 shape_info['isALoop'] =is_loop 518 shape_info['vertices']=vertices 519 ret['shapeList'].append(shape_info) 520 else: 521 # Regular shapes need no extra processing 522 ret['shapeList'].append(shape) 523 return ret 524
525 -def _pickle_get_b2world(self):
526 """ 527 Get the state of the world. 528 """ 529 530 # The basic properties first 531 vars = ['worldAABB', 'gravity', 'doSleep', 'groundBody'] 532 data=dict((var, getattr(self, var)) for var in vars) 533 534 # Now the body list (excepting the ground body) 535 data['bodyList']=self.bodyList[1:] 536 537 # Add all joints, ensuring to downcast to the appropriate type 538 jointList = [] 539 for joint in self.jointList: 540 joint=joint.getAsType() 541 jointList.append( joint.__getstate__(self) ) 542 data['jointList']=jointList 543 544 # Add all controllers, ensuring to downcast to the appropriate type 545 controllerList = [] 546 for controller in self.controllerList: 547 controller=controller.getAsType() 548 controllerList.append( controller.__getstate__(self) ) 549 data['controllerList']=controllerList 550 551 return data
552
553 -def _pickle_get_controller(self, world=None):
554 """ 555 Get the state of a controller 556 """ 557 if not world: 558 raise b2PickleError, "Controllers can't be saved without the world itself" 559 560 ignore_prop =['thisown', 'this', 'bodyList'] 561 defn = globals()[ "%sDef" % self.__class__.__name__ ] 562 563 # Take the available variables in the _definition_ 564 # and then create a dictionary 565 vars = [v for v in dir(defn) 566 if isinstance(getattr(defn, v), property) 567 and v not in ignore_prop] 568 569 ret=dict((var, getattr(self, var)) for var in vars) 570 571 # Set the type, so we know how to recreate it 572 ret['_type'] = self.typeName() 573 574 # Then use indices into the world body list to store 575 # the bodies controlled by this controller 576 main_bodyList = world.bodyList 577 ctrl_bodyList = self.bodyList 578 ret['bodyList']=[main_bodyList.index(body) for body in ctrl_bodyList] 579 return ret
580
581 -def _pickle_get_joint(self, world=None):
582 """ 583 Get the state of a joint. 584 """ 585 if not world: 586 raise b2PickleError, "Joints can't be saved without the world itself" 587 588 # Take the available variables in the _definition_ 589 # and then create a dictionary 590 ignore_prop =['thisown', 'this', 'world', 'type'] 591 defn = globals()[ "%sDef" % self.__class__.__name__ ] 592 vars = [v for v in dir(defn) 593 if isinstance(getattr(defn, v), property) 594 and v not in ignore_prop] 595 596 # A single rename is necessary. If localAxis1 (definition) exists, 597 # rename it to localXAxis1 (joint) 598 if 'localAxis1' in vars: # prismatic, line joints 599 vars.remove('localAxis1') 600 vars.append('localXAxis1') 601 602 ret=dict((var, getattr(self, var)) for var in vars) 603 ret['_type'] = self.typeName() 604 605 # Recreate the body/joint lists. 606 bodyList = world.bodyList 607 jointList= world.jointList 608 for key, value in ret.iteritems(): 609 if isinstance(value, b2Body): 610 ret[key]=bodyList.index(value) 611 elif isinstance(value, b2Joint): 612 ret[key]=jointList.index(value) 613 614 return ret
615 616
617 -def b2ShapeCompare(a, b):
618 if not isinstance(a, b2Shape) or not isinstance(b, b2Shape): 619 return False 620 return __b2PythonShapePointerEquals__(a, b)
621 -def b2BodyCompare(a, b):
622 if not isinstance(a, b2Body) or not isinstance(b, b2Body): 623 return False 624 return __b2PythonBodyPointerEquals__(a, b)
625 -def b2JointCompare(a, b):
626 if not isinstance(a, b2Joint) or not isinstance(b, b2Joint): 627 return False 628 return __b2PythonJointPointerEquals__(a, b)
629 -def b2ControllerCompare(a, b):
630 if not isinstance(a, b2Controller) or not isinstance(b, b2Controller): 631 return False 632 return __b2PythonControllerPointerEquals__(a, b)
633 634
635 -def b2Alloc(*args):
636 """ 637 b2Alloc(int32 size) -> void 638 639 Implement this function to use your own memory allocator. 640 """ 641 return _Box2D.b2Alloc(*args)
642
643 -def b2Free(*args):
644 """ 645 b2Free(void mem) 646 647 If you implement b2Alloc, you should also implement this function. 648 """ 649 return _Box2D.b2Free(*args)
650 -class b2Version(object):
651 """Version numbering scheme. See http://en.wikipedia.org/wiki/Software_versioning""" 652 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 653 __repr__ = _swig_repr 654 major = _swig_property(_Box2D.b2Version_major_get, _Box2D.b2Version_major_set) 655 minor = _swig_property(_Box2D.b2Version_minor_get, _Box2D.b2Version_minor_set) 656 revision = _swig_property(_Box2D.b2Version_revision_get, _Box2D.b2Version_revision_set)
657 - def __repr__(self):
658 return """b2Version( 659 major = %s, 660 minor = %s, 661 revision = %s)"""% tuple(str(a) for a in\ 662 (self.major,self.minor,self.revision))
663 664 __getstate__=_generic_getstate 665 __setstate__=_generic_setstate 666
667 - def __init__(self):
668 """__init__(self) -> b2Version""" 669 _Box2D.b2Version_swiginit(self,_Box2D.new_b2Version())
670 __swig_destroy__ = _Box2D.delete_b2Version 671 b2Version_swigregister = _Box2D.b2Version_swigregister 672 b2Version_swigregister(b2Version) 673 cvar = _Box2D.cvar 674 b2_pi = cvar.b2_pi 675 b2_maxManifoldPoints = cvar.b2_maxManifoldPoints 676 b2_maxPolygonVertices = cvar.b2_maxPolygonVertices 677 b2_maxProxies = cvar.b2_maxProxies 678 b2_maxPairs = cvar.b2_maxPairs 679 b2_linearSlop = cvar.b2_linearSlop 680 b2_angularSlop = cvar.b2_angularSlop 681 b2_toiSlop = cvar.b2_toiSlop 682 b2_maxTOIContactsPerIsland = cvar.b2_maxTOIContactsPerIsland 683 b2_maxTOIJointsPerIsland = cvar.b2_maxTOIJointsPerIsland 684 b2_velocityThreshold = cvar.b2_velocityThreshold 685 b2_maxLinearCorrection = cvar.b2_maxLinearCorrection 686 b2_maxAngularCorrection = cvar.b2_maxAngularCorrection 687 b2_maxLinearVelocity = cvar.b2_maxLinearVelocity 688 b2_maxLinearVelocitySquared = cvar.b2_maxLinearVelocitySquared 689 b2_maxAngularVelocity = cvar.b2_maxAngularVelocity 690 b2_maxAngularVelocitySquared = cvar.b2_maxAngularVelocitySquared 691 b2_contactBaumgarte = cvar.b2_contactBaumgarte 692 b2_timeToSleep = cvar.b2_timeToSleep 693 b2_linearSleepTolerance = cvar.b2_linearSleepTolerance 694 b2_angularSleepTolerance = cvar.b2_angularSleepTolerance 695 696
697 -def b2MixFriction(*args):
698 """ 699 b2MixFriction(float32 friction1, float32 friction2) -> float32 700 701 Friction mixing law. Feel free to customize this. 702 """ 703 return _Box2D.b2MixFriction(*args)
704
705 -def b2MixRestitution(*args):
706 """ 707 b2MixRestitution(float32 restitution1, float32 restitution2) -> float32 708 709 Restitution mixing law. Feel free to customize this. 710 """ 711 return _Box2D.b2MixRestitution(*args)
712
713 -def b2IsValid(*args):
714 """ 715 b2IsValid(float32 x) -> bool 716 717 This function is used to ensure that a floating point number is not a NaN or infinity. 718 """ 719 return _Box2D.b2IsValid(*args)
720
721 -def b2InvSqrt(*args):
722 """ 723 b2InvSqrt(float32 x) -> float32 724 725 This is a approximate yet fast inverse square-root. 726 """ 727 return _Box2D.b2InvSqrt(*args)
728 -class b2Vec2(object):
729 """A 2D column vector.""" 730 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 731 __repr__ = _swig_repr
732 - def SetZero(self):
733 """ 734 SetZero(self) 735 736 Set this vector to all zeros. 737 """ 738 return _Box2D.b2Vec2_SetZero(self)
739
740 - def Set(self, *args):
741 """ 742 Set(self, float32 x_, float32 y_) 743 744 Set this vector to some specified coordinates. 745 """ 746 return _Box2D.b2Vec2_Set(self, *args)
747
748 - def __neg__(self):
749 """__neg__(self) -> b2Vec2""" 750 return _Box2D.b2Vec2___neg__(self)
751
752 - def add_vector(self, *args):
753 """add_vector(self, b2Vec2 v)""" 754 return _Box2D.b2Vec2_add_vector(self, *args)
755
756 - def sub_vector(self, *args):
757 """sub_vector(self, b2Vec2 v)""" 758 return _Box2D.b2Vec2_sub_vector(self, *args)
759
760 - def mul_float(self, *args):
761 """mul_float(self, float32 a)""" 762 return _Box2D.b2Vec2_mul_float(self, *args)
763
764 - def Length(self):
765 """ 766 Length(self) -> float32 767 768 Get the length of this vector (the norm). 769 """ 770 return _Box2D.b2Vec2_Length(self)
771
772 - def LengthSquared(self):
773 """ 774 LengthSquared(self) -> float32 775 776 Get the length squared. For performance, use this instead of b2Vec2::Length(if possible). 777 """ 778 return _Box2D.b2Vec2_LengthSquared(self)
779
780 - def Normalize(self):
781 """ 782 Normalize(self) -> float32 783 784 Convert this vector into a unit vector. Returns the length. 785 """ 786 return _Box2D.b2Vec2_Normalize(self)
787
788 - def IsValid(self):
789 """ 790 IsValid(self) -> bool 791 792 Does this vector contain finite coordinates? 793 """ 794 return _Box2D.b2Vec2_IsValid(self)
795 796 x = _swig_property(_Box2D.b2Vec2_x_get, _Box2D.b2Vec2_x_set) 797 y = _swig_property(_Box2D.b2Vec2_y_get, _Box2D.b2Vec2_y_set)
798 - def __repr__(self):
799 return """b2Vec2( 800 x = %s, 801 y = %s, 802 IsValid() = %s)"""% tuple(str(a) for a in\ 803 (self.x,self.y,self.IsValid()))
804 805 __getstate__=_generic_getstate 806 __setstate__=_generic_setstate 807
808 - def __init__(self, *args):
809 """ 810 __init__(self) -> b2Vec2 811 __init__(self, float32 x, float32 y) -> b2Vec2 812 __init__(self, b2Vec2 other) -> b2Vec2 813 814 Construct using coordinates. 815 """ 816 _Box2D.b2Vec2_swiginit(self,_Box2D.new_b2Vec2(*args))
817 - def __repr__(self):
818 return "b2Vec2(%g,%g)" % (self.x, self.y)
819 - def tuple(self):
820 """ 821 Return the vector as a tuple (x,y) 822 """ 823 return (self.x, self.y)
824 - def fromTuple(self, tuple):
825 """ 826 Set the vector to the values found in the tuple (x,y) 827 You can also use: 828 value = b2Vec2(*tuple) 829 """ 830 self.x, self.y = tuple 831 return self
832 - def copy(self):
833 """ 834 Return a copy of the vector. 835 Remember that the following: 836 a = b2Vec2() 837 b = a 838 Does not copy the vector itself, but b now refers to a. 839 """ 840 return b2Vec2(self.x, self.y)
841 - def __iadd__(self, other):
842 self.add_vector(other) 843 return self
844 - def __isub__(self, other):
845 self.sub_vector(other) 846 return self
847 - def __imul__(self, a):
848 self.mul_float(a) 849 return self
850 - def __idiv__(self, a):
851 self.div_float(a) 852 return self
853 - def dot(self, v):
854 """ 855 Dot product with v (list/tuple or b2Vec2) 856 """ 857 if isinstance(v, (list, tuple)): 858 return self.x*v[0] + self.y*v[1] 859 else: 860 return self.x*v.x + self.y*v.y
861 862
863 - def __div__(self, *args):
864 """__div__(self, float32 a) -> b2Vec2""" 865 return _Box2D.b2Vec2___div__(self, *args)
866
867 - def __mul__(self, *args):
868 """__mul__(self, float32 a) -> b2Vec2""" 869 return _Box2D.b2Vec2___mul__(self, *args)
870
871 - def __add__(self, *args):
872 """__add__(self, b2Vec2 other) -> b2Vec2""" 873 return _Box2D.b2Vec2___add__(self, *args)
874
875 - def __sub__(self, *args):
876 """__sub__(self, b2Vec2 other) -> b2Vec2""" 877 return _Box2D.b2Vec2___sub__(self, *args)
878
879 - def __rmul__(self, *args):
880 """__rmul__(self, float32 a) -> b2Vec2""" 881 return _Box2D.b2Vec2___rmul__(self, *args)
882
883 - def __rdiv__(self, *args):
884 """__rdiv__(self, float32 a) -> b2Vec2""" 885 return _Box2D.b2Vec2___rdiv__(self, *args)
886
887 - def div_float(self, *args):
888 """div_float(self, float32 a)""" 889 return _Box2D.b2Vec2_div_float(self, *args)
890 891 __swig_destroy__ = _Box2D.delete_b2Vec2 892 b2Vec2.SetZero = new_instancemethod(_Box2D.b2Vec2_SetZero,None,b2Vec2) 893 b2Vec2.Set = new_instancemethod(_Box2D.b2Vec2_Set,None,b2Vec2) 894 b2Vec2.__neg__ = new_instancemethod(_Box2D.b2Vec2___neg__,None,b2Vec2) 895 b2Vec2.add_vector = new_instancemethod(_Box2D.b2Vec2_add_vector,None,b2Vec2) 896 b2Vec2.sub_vector = new_instancemethod(_Box2D.b2Vec2_sub_vector,None,b2Vec2) 897 b2Vec2.mul_float = new_instancemethod(_Box2D.b2Vec2_mul_float,None,b2Vec2) 898 b2Vec2.Length = new_instancemethod(_Box2D.b2Vec2_Length,None,b2Vec2) 899 b2Vec2.LengthSquared = new_instancemethod(_Box2D.b2Vec2_LengthSquared,None,b2Vec2) 900 b2Vec2.Normalize = new_instancemethod(_Box2D.b2Vec2_Normalize,None,b2Vec2) 901 b2Vec2.IsValid = new_instancemethod(_Box2D.b2Vec2_IsValid,None,b2Vec2) 902 b2Vec2.__div__ = new_instancemethod(_Box2D.b2Vec2___div__,None,b2Vec2) 903 b2Vec2.__mul__ = new_instancemethod(_Box2D.b2Vec2___mul__,None,b2Vec2) 904 b2Vec2.__add__ = new_instancemethod(_Box2D.b2Vec2___add__,None,b2Vec2) 905 b2Vec2.__sub__ = new_instancemethod(_Box2D.b2Vec2___sub__,None,b2Vec2) 906 b2Vec2.__rmul__ = new_instancemethod(_Box2D.b2Vec2___rmul__,None,b2Vec2) 907 b2Vec2.__rdiv__ = new_instancemethod(_Box2D.b2Vec2___rdiv__,None,b2Vec2) 908 b2Vec2.div_float = new_instancemethod(_Box2D.b2Vec2_div_float,None,b2Vec2) 909 b2Vec2_swigregister = _Box2D.b2Vec2_swigregister 910 b2Vec2_swigregister(b2Vec2) 911
912 -class b2Vec3(object):
913 """A 2D column vector with 3 elements.""" 914 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 915 __repr__ = _swig_repr
916 - def __init__(self, *args):
917 """ 918 __init__(self) -> b2Vec3 919 __init__(self, float32 x, float32 y, float32 z) -> b2Vec3 920 921 Construct using coordinates. 922 """ 923 _Box2D.b2Vec3_swiginit(self,_Box2D.new_b2Vec3(*args))
924 - def SetZero(self):
925 """ 926 SetZero(self) 927 928 Set this vector to all zeros. 929 """ 930 return _Box2D.b2Vec3_SetZero(self)
931
932 - def Set(self, *args):
933 """ 934 Set(self, float32 x_, float32 y_, float32 z_) 935 936 Set this vector to some specified coordinates. 937 """ 938 return _Box2D.b2Vec3_Set(self, *args)
939
940 - def __neg__(self):
941 """__neg__(self) -> b2Vec3""" 942 return _Box2D.b2Vec3___neg__(self)
943
944 - def __iadd__(self, *args):
945 """__iadd__(self, b2Vec3 v)""" 946 return _Box2D.b2Vec3___iadd__(self, *args)
947
948 - def __isub__(self, *args):
949 """__isub__(self, b2Vec3 v)""" 950 return _Box2D.b2Vec3___isub__(self, *args)
951
952 - def __imul__(self, *args):
953 """__imul__(self, float32 s)""" 954 return _Box2D.b2Vec3___imul__(self, *args)
955 956 x = _swig_property(_Box2D.b2Vec3_x_get, _Box2D.b2Vec3_x_set) 957 y = _swig_property(_Box2D.b2Vec3_y_get, _Box2D.b2Vec3_y_set) 958 z = _swig_property(_Box2D.b2Vec3_z_get, _Box2D.b2Vec3_z_set)
959 - def __repr__(self):
960 return """b2Vec3( 961 x = %s, 962 y = %s, 963 z = %s)"""% tuple(str(a) for a in\ 964 (self.x,self.y,self.z))
965 966 __getstate__=_generic_getstate 967 __setstate__=_generic_setstate 968 969 __swig_destroy__ = _Box2D.delete_b2Vec3 970 b2Vec3.SetZero = new_instancemethod(_Box2D.b2Vec3_SetZero,None,b2Vec3) 971 b2Vec3.Set = new_instancemethod(_Box2D.b2Vec3_Set,None,b2Vec3) 972 b2Vec3.__neg__ = new_instancemethod(_Box2D.b2Vec3___neg__,None,b2Vec3) 973 b2Vec3.__iadd__ = new_instancemethod(_Box2D.b2Vec3___iadd__,None,b2Vec3) 974 b2Vec3.__isub__ = new_instancemethod(_Box2D.b2Vec3___isub__,None,b2Vec3) 975 b2Vec3.__imul__ = new_instancemethod(_Box2D.b2Vec3___imul__,None,b2Vec3) 976 b2Vec3_swigregister = _Box2D.b2Vec3_swigregister 977 b2Vec3_swigregister(b2Vec3) 978
979 -class b2Mat22(object):
980 """A 2-by-2 matrix. Stored in column-major order.""" 981 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 982 __repr__ = _swig_repr
983 - def __init__(self, *args):
984 """ 985 __init__(self) -> b2Mat22 986 __init__(self, b2Vec2 c1, b2Vec2 c2) -> b2Mat22 987 __init__(self, float32 a11, float32 a12, float32 a21, float32 a22) -> b2Mat22 988 __init__(self, float32 angle) -> b2Mat22 989 990 Construct this matrix using an angle. This matrix becomes an orthonormal rotation matrix. 991 """ 992 _Box2D.b2Mat22_swiginit(self,_Box2D.new_b2Mat22(*args))
993 - def Set(self, *args):
994 """ 995 Set(self, b2Vec2 c1, b2Vec2 c2) 996 Set(self, float32 angle) 997 998 Initialize this matrix using an angle. This matrix becomes an orthonormal rotation matrix. 999 """ 1000 return _Box2D.b2Mat22_Set(self, *args)
1001
1002 - def SetIdentity(self):
1003 """ 1004 SetIdentity(self) 1005 1006 Set this to the identity matrix. 1007 """ 1008 return _Box2D.b2Mat22_SetIdentity(self)
1009
1010 - def SetZero(self):
1011 """ 1012 SetZero(self) 1013 1014 Set this matrix to all zeros. 1015 """ 1016 return _Box2D.b2Mat22_SetZero(self)
1017
1018 - def GetAngle(self):
1019 """ 1020 GetAngle(self) -> float32 1021 1022 Extract the angle from this matrix (assumed to be a rotation matrix). 1023 """ 1024 return _Box2D.b2Mat22_GetAngle(self)
1025
1026 - def GetInverse(self):
1027 """GetInverse(self) -> b2Mat22""" 1028 return _Box2D.b2Mat22_GetInverse(self)
1029
1030 - def Solve(self, *args):
1031 """ 1032 Solve(self, b2Vec2 b) -> b2Vec2 1033 1034 Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. 1035 """ 1036 return _Box2D.b2Mat22_Solve(self, *args)
1037 1038 col1 = _swig_property(_Box2D.b2Mat22_col1_get, _Box2D.b2Mat22_col1_set) 1039 col2 = _swig_property(_Box2D.b2Mat22_col2_get, _Box2D.b2Mat22_col2_set)
1040 - def __repr__(self):
1041 return """b2Mat22( 1042 col1 = %s, 1043 col2 = %s, 1044 GetAngle() = %s)"""% tuple(str(a) for a in\ 1045 (self.col1,self.col2,self.GetAngle()))
1046 1047 __getstate__=_generic_getstate 1048 __setstate__=_generic_setstate 1049 1050 __swig_destroy__ = _Box2D.delete_b2Mat22 1051 b2Mat22.Set = new_instancemethod(_Box2D.b2Mat22_Set,None,b2Mat22) 1052 b2Mat22.SetIdentity = new_instancemethod(_Box2D.b2Mat22_SetIdentity,None,b2Mat22) 1053 b2Mat22.SetZero = new_instancemethod(_Box2D.b2Mat22_SetZero,None,b2Mat22) 1054 b2Mat22.GetAngle = new_instancemethod(_Box2D.b2Mat22_GetAngle,None,b2Mat22) 1055 b2Mat22.GetInverse = new_instancemethod(_Box2D.b2Mat22_GetInverse,None,b2Mat22) 1056 b2Mat22.Solve = new_instancemethod(_Box2D.b2Mat22_Solve,None,b2Mat22) 1057 b2Mat22_swigregister = _Box2D.b2Mat22_swigregister 1058 b2Mat22_swigregister(b2Mat22) 1059
1060 -class b2Mat33(object):
1061 """A 3-by-3 matrix. Stored in column-major order.""" 1062 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1063 __repr__ = _swig_repr
1064 - def __init__(self, *args):
1065 """ 1066 __init__(self) -> b2Mat33 1067 __init__(self, b2Vec3 c1, b2Vec3 c2, b2Vec3 c3) -> b2Mat33 1068 1069 Construct this matrix using columns. 1070 """ 1071 _Box2D.b2Mat33_swiginit(self,_Box2D.new_b2Mat33(*args))
1072 - def SetZero(self):
1073 """ 1074 SetZero(self) 1075 1076 Set this matrix to all zeros. 1077 """ 1078 return _Box2D.b2Mat33_SetZero(self)
1079
1080 - def Solve33(self, *args):
1081 """ 1082 Solve33(self, b2Vec3 b) -> b2Vec3 1083 1084 Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. 1085 1086 Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. 1087 """ 1088 return _Box2D.b2Mat33_Solve33(self, *args)
1089
1090 - def Solve22(self, *args):
1091 """ 1092 Solve22(self, b2Vec2 b) -> b2Vec2 1093 1094 Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. Solve only the upper 2-by-2 matrix equation. 1095 1096 Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. 1097 """ 1098 return _Box2D.b2Mat33_Solve22(self, *args)
1099 1100 col1 = _swig_property(_Box2D.b2Mat33_col1_get, _Box2D.b2Mat33_col1_set) 1101 col2 = _swig_property(_Box2D.b2Mat33_col2_get, _Box2D.b2Mat33_col2_set) 1102 col3 = _swig_property(_Box2D.b2Mat33_col3_get, _Box2D.b2Mat33_col3_set)
1103 - def __repr__(self):
1104 return """b2Mat33( 1105 col1 = %s, 1106 col2 = %s, 1107 col3 = %s)"""% tuple(str(a) for a in\ 1108 (self.col1,self.col2,self.col3))
1109 1110 __getstate__=_generic_getstate 1111 __setstate__=_generic_setstate 1112 1113 __swig_destroy__ = _Box2D.delete_b2Mat33 1114 b2Mat33.SetZero = new_instancemethod(_Box2D.b2Mat33_SetZero,None,b2Mat33) 1115 b2Mat33.Solve33 = new_instancemethod(_Box2D.b2Mat33_Solve33,None,b2Mat33) 1116 b2Mat33.Solve22 = new_instancemethod(_Box2D.b2Mat33_Solve22,None,b2Mat33) 1117 b2Mat33_swigregister = _Box2D.b2Mat33_swigregister 1118 b2Mat33_swigregister(b2Mat33) 1119
1120 -class b2XForm(object):
1121 """A transform contains translation and rotation. It is used to represent the position and orientation of rigid frames.""" 1122 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1123 __repr__ = _swig_repr
1124 - def __init__(self, *args):
1125 """ 1126 __init__(self) -> b2XForm 1127 __init__(self, b2Vec2 position, b2Mat22 R) -> b2XForm 1128 1129 Initialize using a position vector and a rotation matrix. 1130 """ 1131 _Box2D.b2XForm_swiginit(self,_Box2D.new_b2XForm(*args))
1132 - def SetIdentity(self):
1133 """ 1134 SetIdentity(self) 1135 1136 Set this to the identity transform. 1137 """ 1138 return _Box2D.b2XForm_SetIdentity(self)
1139 1140 position = _swig_property(_Box2D.b2XForm_position_get, _Box2D.b2XForm_position_set) 1141 R = _swig_property(_Box2D.b2XForm_R_get, _Box2D.b2XForm_R_set)
1142 - def __repr__(self):
1143 return """b2XForm( 1144 R = %s, 1145 position = %s)"""% tuple(str(a) for a in\ 1146 (self.R,self.position))
1147 1148 __getstate__=_generic_getstate 1149 __setstate__=_generic_setstate 1150 1151 __swig_destroy__ = _Box2D.delete_b2XForm 1152 b2XForm.SetIdentity = new_instancemethod(_Box2D.b2XForm_SetIdentity,None,b2XForm) 1153 b2XForm_swigregister = _Box2D.b2XForm_swigregister 1154 b2XForm_swigregister(b2XForm) 1155
1156 -class b2Sweep(object):
1157 """This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may no coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.""" 1158 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1159 __repr__ = _swig_repr
1160 - def GetXForm(self, *args):
1161 """ 1162 GetXForm(self, b2XForm xf, float32 t) 1163 1164 Get the interpolated transform at a specific time. 1165 1166 Parameters: 1167 ----------- 1168 1169 t: the normalized time in [0,1]. 1170 """ 1171 return _Box2D.b2Sweep_GetXForm(self, *args)
1172
1173 - def Advance(self, *args):
1174 """ 1175 Advance(self, float32 t) 1176 1177 Advance the sweep forward, yielding a new initial state. 1178 1179 Parameters: 1180 ----------- 1181 1182 t: the new initial time. 1183 """ 1184 return _Box2D.b2Sweep_Advance(self, *args)
1185 1186 localCenter = _swig_property(_Box2D.b2Sweep_localCenter_get, _Box2D.b2Sweep_localCenter_set) 1187 c0 = _swig_property(_Box2D.b2Sweep_c0_get, _Box2D.b2Sweep_c0_set) 1188 c = _swig_property(_Box2D.b2Sweep_c_get, _Box2D.b2Sweep_c_set) 1189 a0 = _swig_property(_Box2D.b2Sweep_a0_get, _Box2D.b2Sweep_a0_set) 1190 a = _swig_property(_Box2D.b2Sweep_a_get, _Box2D.b2Sweep_a_set) 1191 t0 = _swig_property(_Box2D.b2Sweep_t0_get, _Box2D.b2Sweep_t0_set)
1192 - def __repr__(self):
1193 return """b2Sweep( 1194 a = %s, 1195 a0 = %s, 1196 c = %s, 1197 c0 = %s, 1198 localCenter = %s, 1199 t0 = %s)"""% tuple(str(a) for a in\ 1200 (self.a,self.a0,self.c,self.c0,self.localCenter,self.t0))
1201 1202 __getstate__=_generic_getstate 1203 __setstate__=_generic_setstate 1204
1205 - def __init__(self):
1206 """__init__(self) -> b2Sweep""" 1207 _Box2D.b2Sweep_swiginit(self,_Box2D.new_b2Sweep())
1208 __swig_destroy__ = _Box2D.delete_b2Sweep 1209 b2Sweep.GetXForm = new_instancemethod(_Box2D.b2Sweep_GetXForm,None,b2Sweep) 1210 b2Sweep.Advance = new_instancemethod(_Box2D.b2Sweep_Advance,None,b2Sweep) 1211 b2Sweep_swigregister = _Box2D.b2Sweep_swigregister 1212 b2Sweep_swigregister(b2Sweep) 1213 1214
1215 -def b2equ(*args):
1216 """b2equ(b2Vec2 a, b2Vec2 b) -> bool""" 1217 return _Box2D.b2equ(*args)
1218
1219 -def b2DistanceSquared(*args):
1220 """b2DistanceSquared(b2Vec2 a, b2Vec2 b) -> float32""" 1221 return _Box2D.b2DistanceSquared(*args)
1222
1223 -def b2Min(*args):
1224 """b2Min(b2Vec2 a, b2Vec2 b) -> b2Vec2""" 1225 return _Box2D.b2Min(*args)
1226
1227 -def b2Max(*args):
1228 """b2Max(b2Vec2 a, b2Vec2 b) -> b2Vec2""" 1229 return _Box2D.b2Max(*args)
1230
1231 -def b2Clamp(*args):
1232 """b2Clamp(b2Vec2 a, b2Vec2 low, b2Vec2 high) -> b2Vec2""" 1233 return _Box2D.b2Clamp(*args)
1234
1235 -def b2NextPowerOfTwo(*args):
1236 """ 1237 b2NextPowerOfTwo(uint32 x) -> uint32 1238 1239 "Next Largest Power of 2 Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2. For a 32-bit value:" 1240 """ 1241 return _Box2D.b2NextPowerOfTwo(*args)
1242
1243 -def b2IsPowerOfTwo(*args):
1244 """b2IsPowerOfTwo(uint32 x) -> bool""" 1245 return _Box2D.b2IsPowerOfTwo(*args)
1246 e_unknownJoint = _Box2D.e_unknownJoint 1247 e_revoluteJoint = _Box2D.e_revoluteJoint 1248 e_prismaticJoint = _Box2D.e_prismaticJoint 1249 e_distanceJoint = _Box2D.e_distanceJoint 1250 e_pulleyJoint = _Box2D.e_pulleyJoint 1251 e_mouseJoint = _Box2D.e_mouseJoint 1252 e_gearJoint = _Box2D.e_gearJoint 1253 e_lineJoint = _Box2D.e_lineJoint 1254 e_inactiveLimit = _Box2D.e_inactiveLimit 1255 e_atLowerLimit = _Box2D.e_atLowerLimit 1256 e_atUpperLimit = _Box2D.e_atUpperLimit 1257 e_equalLimits = _Box2D.e_equalLimits
1258 -class b2Jacobian(object):
1259 """Proxy of C++ b2Jacobian class""" 1260 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1261 __repr__ = _swig_repr 1262 linear1 = _swig_property(_Box2D.b2Jacobian_linear1_get, _Box2D.b2Jacobian_linear1_set) 1263 angular1 = _swig_property(_Box2D.b2Jacobian_angular1_get, _Box2D.b2Jacobian_angular1_set) 1264 linear2 = _swig_property(_Box2D.b2Jacobian_linear2_get, _Box2D.b2Jacobian_linear2_set) 1265 angular2 = _swig_property(_Box2D.b2Jacobian_angular2_get, _Box2D.b2Jacobian_angular2_set)
1266 - def SetZero(self):
1267 """SetZero(self)""" 1268 return _Box2D.b2Jacobian_SetZero(self)
1269
1270 - def Set(self, *args):
1271 """Set(self, b2Vec2 x1, float32 a1, b2Vec2 x2, float32 a2)""" 1272 return _Box2D.b2Jacobian_Set(self, *args)
1273
1274 - def Compute(self, *args):
1275 """Compute(self, b2Vec2 x1, float32 a1, b2Vec2 x2, float32 a2) -> float32""" 1276 return _Box2D.b2Jacobian_Compute(self, *args)
1277
1278 - def __repr__(self):
1279 return """b2Jacobian( 1280 angular1 = %s, 1281 angular2 = %s, 1282 linear1 = %s, 1283 linear2 = %s)"""% tuple(str(a) for a in\ 1284 (self.angular1,self.angular2,self.linear1,self.linear2))
1285 1286 __getstate__=_generic_getstate 1287 __setstate__=_generic_setstate 1288
1289 - def __init__(self):
1290 """__init__(self) -> b2Jacobian""" 1291 _Box2D.b2Jacobian_swiginit(self,_Box2D.new_b2Jacobian())
1292 __swig_destroy__ = _Box2D.delete_b2Jacobian 1293 b2Jacobian.SetZero = new_instancemethod(_Box2D.b2Jacobian_SetZero,None,b2Jacobian) 1294 b2Jacobian.Set = new_instancemethod(_Box2D.b2Jacobian_Set,None,b2Jacobian) 1295 b2Jacobian.Compute = new_instancemethod(_Box2D.b2Jacobian_Compute,None,b2Jacobian) 1296 b2Jacobian_swigregister = _Box2D.b2Jacobian_swigregister 1297 b2Jacobian_swigregister(b2Jacobian) 1298 b2Vec2_zero = cvar.b2Vec2_zero 1299 b2Mat22_identity = cvar.b2Mat22_identity 1300 b2XForm_identity = cvar.b2XForm_identity 1301
1302 -def b2mul(*args):
1303 """ 1304 b2mul(float32 s, b2Vec2 a) -> b2Vec2 1305 b2mul(float32 s, b2Vec3 a) -> b2Vec3 1306 """ 1307 return _Box2D.b2mul(*args)
1308
1309 -def b2sub(*args):
1310 """ 1311 b2sub(b2Vec2 a, b2Vec2 b) -> b2Vec2 1312 b2sub(b2Vec3 a, b2Vec3 b) -> b2Vec3 1313 """ 1314 return _Box2D.b2sub(*args)
1315
1316 -def b2Dot(*args):
1317 """ 1318 b2Dot(b2Vec2 a, b2Vec2 b) -> float32 1319 b2Dot(b2Vec3 a, b2Vec3 b) -> float32 1320 1321 Perform the dot product on two vectors. 1322 """ 1323 return _Box2D.b2Dot(*args)
1324
1325 -def b2Cross(*args):
1326 """ 1327 b2Cross(b2Vec2 a, b2Vec2 b) -> float32 1328 b2Cross(b2Vec2 a, float32 s) -> b2Vec2 1329 b2Cross(float32 s, b2Vec2 a) -> b2Vec2 1330 b2Cross(b2Vec3 a, b2Vec3 b) -> b2Vec3 1331 1332 Perform the cross product on two vectors. 1333 """ 1334 return _Box2D.b2Cross(*args)
1335
1336 -def b2add(*args):
1337 """ 1338 b2add(b2Vec2 a, b2Vec2 b) -> b2Vec2 1339 b2add(b2Vec3 a, b2Vec3 b) -> b2Vec3 1340 b2add(b2Mat22 A, b2Mat22 B) -> b2Mat22 1341 """ 1342 return _Box2D.b2add(*args)
1343
1344 -def b2Mul(*args):
1345 """ 1346 b2Mul(b2Mat22 A, b2Vec2 v) -> b2Vec2 1347 b2Mul(b2Mat22 A, b2Mat22 B) -> b2Mat22 1348 b2Mul(b2Mat33 A, b2Vec3 v) -> b2Vec3 1349 b2Mul(b2XForm T, b2Vec2 v) -> b2Vec2 1350 1351 Multiply a matrix times a vector. 1352 """ 1353 return _Box2D.b2Mul(*args)
1354
1355 -def b2MulT(*args):
1356 """ 1357 b2MulT(b2Mat22 A, b2Vec2 v) -> b2Vec2 1358 b2MulT(b2Mat22 A, b2Mat22 B) -> b2Mat22 1359 b2MulT(b2XForm T, b2Vec2 v) -> b2Vec2 1360 1361 Multiply a matrix transpose times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another (inverse transform). 1362 """ 1363 return _Box2D.b2MulT(*args)
1364
1365 -def b2Abs(*args):
1366 """ 1367 b2Abs(float32 a) -> float32 1368 b2Abs(b2Vec2 a) -> b2Vec2 1369 b2Abs(b2Mat22 A) -> b2Mat22 1370 """ 1371 return _Box2D.b2Abs(*args)
1372
1373 -class b2JointEdge(object):
1374 """A joint edge is used to connect bodies and joints together in a joint graph where each body is a node and each joint is an edge. A joint edge belongs to a doubly linked list maintained in each attached body. Each joint has two joint nodes, one for each attached body.""" 1375 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1376 __repr__ = _swig_repr 1377 other = _swig_property(_Box2D.b2JointEdge_other_get, _Box2D.b2JointEdge_other_set) 1378 joint = _swig_property(_Box2D.b2JointEdge_joint_get, _Box2D.b2JointEdge_joint_set) 1379 prev = _swig_property(_Box2D.b2JointEdge_prev_get, _Box2D.b2JointEdge_prev_set) 1380 next = _swig_property(_Box2D.b2JointEdge_next_get, _Box2D.b2JointEdge_next_set)
1381 - def __repr__(self):
1382 return """b2JointEdge( 1383 joint = %s, 1384 other = %s)"""% tuple(str(a) for a in\ 1385 (self.joint,self.other))
1386 1387 __getstate__=_generic_getstate 1388 __setstate__=_generic_setstate 1389
1390 - def __init__(self):
1391 """__init__(self) -> b2JointEdge""" 1392 _Box2D.b2JointEdge_swiginit(self,_Box2D.new_b2JointEdge())
1393 __swig_destroy__ = _Box2D.delete_b2JointEdge 1394 b2JointEdge_swigregister = _Box2D.b2JointEdge_swigregister 1395 b2JointEdge_swigregister(b2JointEdge) 1396
1397 -class b2JointDef(object):
1398 """Joint definitions are used to construct joints.""" 1399 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1400 __repr__ = _swig_repr
1401 - def __init__(self):
1402 """ 1403 __init__(self) -> b2JointDef 1404 1405 Joint definitions are used to construct joints. 1406 """ 1407 _Box2D.b2JointDef_swiginit(self,_Box2D.new_b2JointDef())
1408 type = _swig_property(_Box2D.b2JointDef_type_get, _Box2D.b2JointDef_type_set) 1409 body1 = _swig_property(_Box2D.b2JointDef_body1_get, _Box2D.b2JointDef_body1_set) 1410 body2 = _swig_property(_Box2D.b2JointDef_body2_get, _Box2D.b2JointDef_body2_set) 1411 collideConnected = _swig_property(_Box2D.b2JointDef_collideConnected_get, _Box2D.b2JointDef_collideConnected_set)
1412 - def __repr__(self):
1413 return """b2JointDef( 1414 body1 = %s, 1415 body2 = %s, 1416 collideConnected = %s, 1417 type = %s, 1418 userData = %s)"""% tuple(str(a) for a in\ 1419 (self.body1,self.body2,self.collideConnected,self.type,self.userData))
1420 1421 __getstate__=_generic_getstate 1422 __setstate__=_generic_setstate 1423
1424 - def GetUserData(self):
1425 """GetUserData(self) -> PyObject""" 1426 return _Box2D.b2JointDef_GetUserData(self)
1427
1428 - def SetUserData(self, *args):
1429 """SetUserData(self, PyObject data)""" 1430 return _Box2D.b2JointDef_SetUserData(self, *args)
1431
1432 - def ClearUserData(self):
1433 """ClearUserData(self)""" 1434 return _Box2D.b2JointDef_ClearUserData(self)
1435 1436 userData = property(GetUserData, SetUserData)
1437 - def __del__(self):
1438 self.ClearUserData()
1439
1440 - def typeName(self):
1441 """ 1442 Return the name of the joint from: 1443 Unknown, Mouse, Gear, Distance, Prismatic, Pulley, Revolute 1444 """ 1445 types = { e_unknownJoint : "Unknown", 1446 e_mouseJoint : "Mouse", 1447 e_gearJoint : "Gear", 1448 e_distanceJoint : "Distance", 1449 e_prismaticJoint: "Prismatic", 1450 e_pulleyJoint : "Pulley", 1451 e_revoluteJoint : "Revolute" } 1452 return types[self.type]
1453 1454 __swig_destroy__ = _Box2D.delete_b2JointDef 1455 b2JointDef.GetUserData = new_instancemethod(_Box2D.b2JointDef_GetUserData,None,b2JointDef) 1456 b2JointDef.SetUserData = new_instancemethod(_Box2D.b2JointDef_SetUserData,None,b2JointDef) 1457 b2JointDef.ClearUserData = new_instancemethod(_Box2D.b2JointDef_ClearUserData,None,b2JointDef) 1458 b2JointDef_swigregister = _Box2D.b2JointDef_swigregister 1459 b2JointDef_swigregister(b2JointDef) 1460
1461 -class b2Joint(object):
1462 """The base joint class. Joints are used to constraint two bodies together in various fashions. Some joints also feature limits and motors.""" 1463 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
1464 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
1465 __repr__ = _swig_repr
1466 - def GetType(self):
1467 """ 1468 GetType(self) -> b2JointType 1469 1470 Get the type of the concrete joint. 1471 """ 1472 return _Box2D.b2Joint_GetType(self)
1473
1474 - def GetBody1(self):
1475 """ 1476 GetBody1(self) -> b2Body 1477 1478 Get the first body attached to this joint. 1479 """ 1480 return _Box2D.b2Joint_GetBody1(self)
1481
1482 - def GetBody2(self):
1483 """ 1484 GetBody2(self) -> b2Body 1485 1486 Get the second body attached to this joint. 1487 """ 1488 return _Box2D.b2Joint_GetBody2(self)
1489
1490 - def GetAnchor1(self):
1491 """ 1492 GetAnchor1(self) -> b2Vec2 1493 1494 Get the anchor point on body1 in world coordinates. 1495 """ 1496 return _Box2D.b2Joint_GetAnchor1(self)
1497
1498 - def GetAnchor2(self):
1499 """ 1500 GetAnchor2(self) -> b2Vec2 1501 1502 Get the anchor point on body2 in world coordinates. 1503 """ 1504 return _Box2D.b2Joint_GetAnchor2(self)
1505
1506 - def GetReactionForce(self, *args):
1507 """ 1508 GetReactionForce(self, float32 inv_dt) -> b2Vec2 1509 1510 Get the reaction force on body2 at the joint anchor. 1511 """ 1512 return _Box2D.b2Joint_GetReactionForce(self, *args)
1513
1514 - def GetReactionTorque(self, *args):
1515 """ 1516 GetReactionTorque(self, float32 inv_dt) -> float32 1517 1518 Get the reaction torque on body2. 1519 """ 1520 return _Box2D.b2Joint_GetReactionTorque(self, *args)
1521
1522 - def GetNext(self):
1523 """ 1524 GetNext(self) -> b2Joint 1525 1526 Get the next joint the world joint list. 1527 """ 1528 return _Box2D.b2Joint_GetNext(self)
1529
1530 - def GetCollideConnected(self):
1531 """ 1532 GetCollideConnected(self) -> bool 1533 1534 Get whether or not joint bodies can collide. 1535 """ 1536 return _Box2D.b2Joint_GetCollideConnected(self)
1537
1538 - def __repr__(self):
1539 return """b2Joint( 1540 body1 = %s, 1541 body2 = %s, 1542 collideConnected = %s, 1543 type = %s, 1544 userData = %s, 1545 GetAnchor1() = %s, 1546 GetAnchor2() = %s)"""% tuple(str(a) for a in\ 1547 (self.body1,self.body2,self.collideConnected,self.type,self.userData,self.GetAnchor1(),self.GetAnchor2()))
1548 1549 __getstate__=no_pickle 1550 __setstate__=_generic_setstate 1551
1552 - def GetUserData(self):
1553 """ 1554 GetUserData(self) -> PyObject 1555 1556 Get the user data pointer. 1557 """ 1558 return _Box2D.b2Joint_GetUserData(self)
1559
1560 - def SetUserData(self, *args):
1561 """ 1562 SetUserData(self, PyObject data) 1563 1564 Set the user data pointer. 1565 """ 1566 return _Box2D.b2Joint_SetUserData(self, *args)
1567
1568 - def ClearUserData(self):
1569 """ClearUserData(self)""" 1570 return _Box2D.b2Joint_ClearUserData(self)
1571 1572 userData = property(GetUserData, SetUserData) 1573
1574 - def __hash__(self):
1575 """__hash__(self) -> int32""" 1576 return _Box2D.b2Joint___hash__(self)
1577 1578 __eq__ = b2JointCompare 1579 __ne__ = lambda self,other: not b2JointCompare(self,other) 1580 type =property(GetType , None) 1581 body1 =property(GetBody1 , None) 1582 body2 =property(GetBody2 , None) 1583 collideConnected=property(GetCollideConnected, None)
1584 - def typeName(self):
1585 """ 1586 Return the name of the joint from: 1587 Unknown, Mouse, Gear, Distance, Prismatic, Pulley, Revolute 1588 """ 1589 types = { e_unknownJoint : "Unknown", 1590 e_mouseJoint : "Mouse", 1591 e_gearJoint : "Gear", 1592 e_distanceJoint : "Distance", 1593 e_prismaticJoint: "Prismatic", 1594 e_pulleyJoint : "Pulley", 1595 e_revoluteJoint : "Revolute", 1596 e_lineJoint : "Line" } 1597 return types[self.GetType()]
1598 - def getAsType(self):
1599 """ 1600 Return a typecasted version of the joint 1601 """ 1602 return (getattr(self, "as%sJoint" % self.typeName())) ()
1603
1604 - def asMouseJoint(self):
1605 """asMouseJoint(self) -> b2MouseJoint""" 1606 return _Box2D.b2Joint_asMouseJoint(self)
1607
1608 - def asGearJoint(self):
1609 """asGearJoint(self) -> b2GearJoint""" 1610 return _Box2D.b2Joint_asGearJoint(self)
1611
1612 - def asDistanceJoint(self):
1613 """asDistanceJoint(self) -> b2DistanceJoint""" 1614 return _Box2D.b2Joint_asDistanceJoint(self)
1615
1616 - def asPrismaticJoint(self):
1617 """asPrismaticJoint(self) -> b2PrismaticJoint""" 1618 return _Box2D.b2Joint_asPrismaticJoint(self)
1619
1620 - def asPulleyJoint(self):
1621 """asPulleyJoint(self) -> b2PulleyJoint""" 1622 return _Box2D.b2Joint_asPulleyJoint(self)
1623
1624 - def asRevoluteJoint(self):
1625 """asRevoluteJoint(self) -> b2RevoluteJoint""" 1626 return _Box2D.b2Joint_asRevoluteJoint(self)
1627
1628 - def asLineJoint(self):
1629 """asLineJoint(self) -> b2LineJoint""" 1630 return _Box2D.b2Joint_asLineJoint(self)
1631 1632 b2Joint.GetType = new_instancemethod(_Box2D.b2Joint_GetType,None,b2Joint) 1633 b2Joint.GetBody1 = new_instancemethod(_Box2D.b2Joint_GetBody1,None,b2Joint) 1634 b2Joint.GetBody2 = new_instancemethod(_Box2D.b2Joint_GetBody2,None,b2Joint) 1635 b2Joint.GetAnchor1 = new_instancemethod(_Box2D.b2Joint_GetAnchor1,None,b2Joint) 1636 b2Joint.GetAnchor2 = new_instancemethod(_Box2D.b2Joint_GetAnchor2,None,b2Joint) 1637 b2Joint.GetReactionForce = new_instancemethod(_Box2D.b2Joint_GetReactionForce,None,b2Joint) 1638 b2Joint.GetReactionTorque = new_instancemethod(_Box2D.b2Joint_GetReactionTorque,None,b2Joint) 1639 b2Joint.GetNext = new_instancemethod(_Box2D.b2Joint_GetNext,None,b2Joint) 1640 b2Joint.GetCollideConnected = new_instancemethod(_Box2D.b2Joint_GetCollideConnected,None,b2Joint) 1641 b2Joint.GetUserData = new_instancemethod(_Box2D.b2Joint_GetUserData,None,b2Joint) 1642 b2Joint.SetUserData = new_instancemethod(_Box2D.b2Joint_SetUserData,None,b2Joint) 1643 b2Joint.ClearUserData = new_instancemethod(_Box2D.b2Joint_ClearUserData,None,b2Joint) 1644 b2Joint.__hash__ = new_instancemethod(_Box2D.b2Joint___hash__,None,b2Joint) 1645 b2Joint.asMouseJoint = new_instancemethod(_Box2D.b2Joint_asMouseJoint,None,b2Joint) 1646 b2Joint.asGearJoint = new_instancemethod(_Box2D.b2Joint_asGearJoint,None,b2Joint) 1647 b2Joint.asDistanceJoint = new_instancemethod(_Box2D.b2Joint_asDistanceJoint,None,b2Joint) 1648 b2Joint.asPrismaticJoint = new_instancemethod(_Box2D.b2Joint_asPrismaticJoint,None,b2Joint) 1649 b2Joint.asPulleyJoint = new_instancemethod(_Box2D.b2Joint_asPulleyJoint,None,b2Joint) 1650 b2Joint.asRevoluteJoint = new_instancemethod(_Box2D.b2Joint_asRevoluteJoint,None,b2Joint) 1651 b2Joint.asLineJoint = new_instancemethod(_Box2D.b2Joint_asLineJoint,None,b2Joint) 1652 b2Joint_swigregister = _Box2D.b2Joint_swigregister 1653 b2Joint_swigregister(b2Joint) 1654 1655
1656 -def __b2ComputeCentroid(*args):
1657 """__b2ComputeCentroid(b2Vec2 vs, int32 count) -> b2Vec2""" 1658 return _Box2D.__b2ComputeCentroid(*args)
1659
1660 -def __b2ComputeOBB(*args):
1661 """__b2ComputeOBB(b2OBB obb, b2Vec2 vs, int32 count) -> bool""" 1662 return _Box2D.__b2ComputeOBB(*args)
1663 RAND_LIMIT = _Box2D.RAND_LIMIT 1664 B2_FLT_EPSILON = 1.192092896e-07 1665 FLT_EPSILON = B2_FLT_EPSILON 1666 B2_FLT_MAX = 3.402823466e+38 1667 cvars = ('b2_minPulleyLength','b2Contact_s_initialized','b2Contact_s_registers','b2_maxStackEntries','b2_stackSize', 1668 'b2_chunkArrayIncrement','b2_blockSizes','b2_maxBlockSize','b2_chunkSize','b2_defaultFilter','b2BroadPhase_s_validate', 1669 'b2_nullEdge','b2_invalid','b2_tableMask','b2_tableCapacity','b2_nullProxy','b2_nullPair','b2_nullFeature','b2XForm_identity', 1670 'b2Mat22_identity','b2Vec2_zero','b2_version','b2_byteCount','b2_angularSleepTolerance','b2_linearSleepTolerance', 1671 'b2_timeToSleep','b2_contactBaumgarte','b2_maxAngularVelocitySquared','b2_maxAngularVelocity','b2_maxLinearVelocitySquared', 1672 'b2_maxLinearVelocity','b2_maxAngularCorrection','b2_maxLinearCorrection','b2_velocityThreshold','b2_maxTOIJointsPerIsland', 1673 'b2_maxTOIContactsPerIsland','b2_toiSlop','b2_angularSlop','b2_linearSlop','b2_maxPairs','b2_maxProxies','b2_maxPolygonVertices', 1674 'b2_maxManifoldPoints','b2_pi') 1675
1676 -def b2PythonComputeCentroid(pd):
1677 """ 1678 Computes the centroid of the polygon shape definition, pd. 1679 Raises ValueError on an invalid vertex count or a small area. 1680 1681 Ported from the Box2D C++ code. 1682 """ 1683 count = pd.vertexCount 1684 1685 if count < 3: 1686 raise ValueError, "ComputeCentroid: vertex count < 3" 1687 1688 c = b2Vec2(0.0, 0.0) 1689 area = 0.0 1690 1691 # pRef is the reference point for forming triangles. 1692 # It's location doesn't change the result (except for rounding error). 1693 pRef = b2Vec2(0.0, 0.0) 1694 1695 inv3 = 1.0 / 3.0 1696 1697 for i in range(count): 1698 # Triangle vertices. 1699 p1 = pRef 1700 p2 = pd.getVertex(i) 1701 if i + 1 < count: 1702 p3 = pd.getVertex(i+1) 1703 else: p3 = pd.getVertex(0) 1704 1705 e1 = p2 - p1 1706 e2 = p3 - p1 1707 1708 D = b2Cross(e1, e2) 1709 1710 triangleArea = 0.5 * D 1711 area += triangleArea 1712 1713 # Area weighted centroid 1714 c += triangleArea * inv3 * (p1 + p2 + p3) 1715 1716 # Centroid 1717 if area <= FLT_EPSILON: 1718 raise ValueError, "ComputeCentroid: area <= FLT_EPSILON" 1719 1720 return c / area
1721 1722
1723 -def collideCircleParticle(*args):
1724 """ 1725 collideCircleParticle(b2CircleShape circle, b2Vec2 ppos) -> PyObject 1726 1727 For liquid simulation. Checks if a particle 1728 would collide with the specified circle. 1729 1730 """ 1731 return _Box2D.collideCircleParticle(*args)
1732
1733 -def b2CollidePolyParticle(*args):
1734 """ 1735 b2CollidePolyParticle(b2PolygonShape polygon, b2Vec2 ppos, float32 pradius) -> PyObject 1736 1737 For liquid simulation. Checks if a particle 1738 would collide with the specified polygon. 1739 1740 """ 1741 return _Box2D.b2CollidePolyParticle(*args)
1742 -def b2PythonCheckPolygonDef(pd):
1743 """ 1744 Checks the Polygon definition to see if upon creation it will cause an assertion. 1745 Raises ValueError if an assertion would be raised. 1746 1747 Ported from the Box2D C++ code for CreateShape(). The C++ version is now 1748 included as it's more accurate, please use b2CheckPolygonDef instead. 1749 """ 1750 1751 if pd.vertexCount < 3 or pd.vertexCount >= b2_maxPolygonVertices: 1752 raise ValueError, "Invalid vertexCount" 1753 1754 threshold = FLT_EPSILON * FLT_EPSILON 1755 verts = pd.getVertices_b2Vec2() 1756 normals = [] 1757 v0 = verts[0] 1758 for i in range(pd.vertexCount): 1759 if i == pd.vertexCount-1: 1760 v1 = verts[0] 1761 else: v1 = verts[i+1] 1762 edge=v1 - v0 1763 if edge.LengthSquared() < threshold: 1764 raise ValueError, "edge.LengthSquared < FLT_EPSILON**2" 1765 normals.append( b2Cross(edge, 1.0) ) 1766 normals[-1].Normalize() 1767 v0=v1 1768 1769 centroid = b2PythonComputeCentroid(pd) 1770 1771 d=b2Vec2() 1772 for i in range(pd.vertexCount): 1773 i1 = i - 1 1774 if i1 < 0: i1 = pd.vertexCount - 1 1775 i2 = i 1776 n1 = normals[i1] 1777 n2 = normals[i2] 1778 v = verts[i] - centroid 1779 1780 d.x = b2Dot(n1, v) - b2_toiSlop 1781 d.y = b2Dot(n2, v) - b2_toiSlop 1782 1783 # Shifting the edge inward by b2_toiSlop should 1784 # not cause the plane to pass the centroid. 1785 1786 # Your shape has a radius/extent less than b2_toiSlop. 1787 if d.x < 0.0 or d.y <= 0.0: 1788 raise ValueError, "Your shape has a radius/extent less than b2_toiSlop." 1789 1790 A = b2Mat22() 1791 A.col1.x = n1.x; A.col2.x = n1.y 1792 A.col1.y = n2.x; A.col2.y = n2.y 1793 #coreVertices[i] = A.Solve(d) + m_centroid 1794 1795 return True
1796 1797
1798 -class b2ContactID(object):
1799 """Proxy of C++ b2ContactID class""" 1800 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1801 __repr__ = _swig_repr 1802 key = _swig_property(_Box2D.b2ContactID_key_get, _Box2D.b2ContactID_key_set)
1803 - def __repr__(self):
1804 return """b2ContactID( 1805 features = %s, 1806 key = %s)"""% tuple(str(a) for a in\ 1807 (self.features,self.key))
1808 1809 __getstate__=_generic_getstate 1810 __setstate__=_generic_setstate 1811 1812 features = _swig_property(_Box2D.b2ContactID_features_get)
1813 - def __init__(self):
1814 """__init__(self) -> b2ContactID""" 1815 _Box2D.b2ContactID_swiginit(self,_Box2D.new_b2ContactID())
1816 __swig_destroy__ = _Box2D.delete_b2ContactID 1817 b2ContactID_swigregister = _Box2D.b2ContactID_swigregister 1818 b2ContactID_swigregister(b2ContactID) 1819
1820 -def b2Distance(*args):
1821 """ 1822 b2Distance(b2Vec2 a, b2Vec2 b) -> float32 1823 b2Distance(b2Shape shape1, b2XForm xf1, b2Shape shape2, b2XForm xf2) -> PyObject 1824 1825 Compute the distance between two shapes and the closest points. 1826 the distance between the shapes or zero if they are overlapped/touching. 1827 """ 1828 return _Box2D.b2Distance(*args)
1829
1830 -def b2AABBOverlaps(*args):
1831 """ 1832 b2AABBOverlaps(b2AABB aabb, b2Vec2 point) -> bool 1833 b2AABBOverlaps(b2AABB aabb, b2AABB aabb2) -> bool 1834 1835 Checks if two AABBs overlap, or if a point 1836 lies in an AABB 1837 1838 b2AABBOverlaps(AABB1, [AABB2/point]) 1839 1840 """ 1841 return _Box2D.b2AABBOverlaps(*args)
1842
1843 -def b2CheckPolygonDef(*args):
1844 """ 1845 b2CheckPolygonDef(b2PolygonDef poly, bool additional_checks = True) -> bool 1846 b2CheckPolygonDef(b2PolygonDef poly) -> bool 1847 1848 Checks the Polygon definition to see if upon creation it will cause an assertion. 1849 Raises ValueError if an assertion would be raised. 1850 1851 b2PolygonDef* poly - the polygon definition 1852 bool additional_checks - whether or not to run additional checks 1853 1854 Additional checking: usually only in DEBUG mode on the C++ code. 1855 1856 While shapes that pass this test can be created without assertions, 1857 they will ultimately create unexpected behavior. It's recommended 1858 to _not_ use any polygon that fails this test. 1859 1860 """ 1861 return _Box2D.b2CheckPolygonDef(*args)
1862
1863 -def b2Random(*args):
1864 """ 1865 b2Random() -> float32 1866 b2Random(float32 lo, float32 hi) -> float32 1867 1868 Random floating point number in range [lo, hi]. With no arguments, returns one in -1,1. 1869 """ 1870 return _Box2D.b2Random(*args)
1871 b2_nullFeature = cvar.b2_nullFeature 1872
1873 -class b2ContactID_features(object):
1874 """Proxy of C++ b2ContactID_features class""" 1875 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1876 __repr__ = _swig_repr
1877 - def __repr__(self):
1878 return """b2ContactID_features( 1879 flip = %s, 1880 incidentEdge = %s, 1881 incidentVertex = %s, 1882 referenceEdge = %s)"""% tuple(str(a) for a in\ 1883 (self.flip,self.incidentEdge,self.incidentVertex,self.referenceEdge))
1884 1885 __getstate__=_generic_getstate 1886 __setstate__=_generic_setstate 1887 1888 referenceEdge = _swig_property(_Box2D.b2ContactID_features_referenceEdge_get, _Box2D.b2ContactID_features_referenceEdge_set) 1889 incidentEdge = _swig_property(_Box2D.b2ContactID_features_incidentEdge_get, _Box2D.b2ContactID_features_incidentEdge_set) 1890 incidentVertex = _swig_property(_Box2D.b2ContactID_features_incidentVertex_get, _Box2D.b2ContactID_features_incidentVertex_set) 1891 flip = _swig_property(_Box2D.b2ContactID_features_flip_get, _Box2D.b2ContactID_features_flip_set)
1892 - def __init__(self):
1893 """__init__(self) -> b2ContactID_features""" 1894 _Box2D.b2ContactID_features_swiginit(self,_Box2D.new_b2ContactID_features())
1895 __swig_destroy__ = _Box2D.delete_b2ContactID_features 1896 b2ContactID_features_swigregister = _Box2D.b2ContactID_features_swigregister 1897 b2ContactID_features_swigregister(b2ContactID_features) 1898
1899 -class b2ManifoldPoint(object):
1900 """A manifold point is a contact point belonging to a contact manifold. It holds details related to the geometry and dynamics of the contact points. The point is stored in local coordinates because CCD requires sub-stepping in which the separation is stale.""" 1901 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1902 __repr__ = _swig_repr 1903 localPoint1 = _swig_property(_Box2D.b2ManifoldPoint_localPoint1_get, _Box2D.b2ManifoldPoint_localPoint1_set) 1904 localPoint2 = _swig_property(_Box2D.b2ManifoldPoint_localPoint2_get, _Box2D.b2ManifoldPoint_localPoint2_set) 1905 separation = _swig_property(_Box2D.b2ManifoldPoint_separation_get, _Box2D.b2ManifoldPoint_separation_set) 1906 normalImpulse = _swig_property(_Box2D.b2ManifoldPoint_normalImpulse_get, _Box2D.b2ManifoldPoint_normalImpulse_set) 1907 tangentImpulse = _swig_property(_Box2D.b2ManifoldPoint_tangentImpulse_get, _Box2D.b2ManifoldPoint_tangentImpulse_set) 1908 id = _swig_property(_Box2D.b2ManifoldPoint_id_get, _Box2D.b2ManifoldPoint_id_set)
1909 - def __repr__(self):
1910 return """b2ManifoldPoint( 1911 id = %s, 1912 localPoint1 = %s, 1913 localPoint2 = %s, 1914 normalImpulse = %s, 1915 separation = %s, 1916 tangentImpulse = %s)"""% tuple(str(a) for a in\ 1917 (self.id,self.localPoint1,self.localPoint2,self.normalImpulse,self.separation,self.tangentImpulse))
1918 1919 __getstate__=_generic_getstate 1920 __setstate__=_generic_setstate 1921
1922 - def __init__(self):
1923 """__init__(self) -> b2ManifoldPoint""" 1924 _Box2D.b2ManifoldPoint_swiginit(self,_Box2D.new_b2ManifoldPoint())
1925 __swig_destroy__ = _Box2D.delete_b2ManifoldPoint 1926 b2ManifoldPoint_swigregister = _Box2D.b2ManifoldPoint_swigregister 1927 b2ManifoldPoint_swigregister(b2ManifoldPoint) 1928
1929 -class b2Manifold(object):
1930 """A manifold for two touching convex shapes.""" 1931 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1932 __repr__ = _swig_repr 1933 points = _swig_property(_Box2D.b2Manifold_points_get, _Box2D.b2Manifold_points_set) 1934 normal = _swig_property(_Box2D.b2Manifold_normal_get, _Box2D.b2Manifold_normal_set) 1935 pointCount = _swig_property(_Box2D.b2Manifold_pointCount_get, _Box2D.b2Manifold_pointCount_set)
1936 - def __repr__(self):
1937 return """b2Manifold( 1938 normal = %s, 1939 pointCount = %s, 1940 points = %s)"""% tuple(str(a) for a in\ 1941 (self.normal,self.pointCount,self.points))
1942 1943 __getstate__=_generic_getstate 1944 __setstate__=_generic_setstate 1945
1946 - def __init__(self):
1947 """__init__(self) -> b2Manifold""" 1948 _Box2D.b2Manifold_swiginit(self,_Box2D.new_b2Manifold())
1949 __swig_destroy__ = _Box2D.delete_b2Manifold 1950 b2Manifold_swigregister = _Box2D.b2Manifold_swigregister 1951 b2Manifold_swigregister(b2Manifold) 1952
1953 -class b2Segment(object):
1954 """A line segment.""" 1955 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1956 __repr__ = _swig_repr
1957 - def TestSegment(self, *args):
1958 """ 1959 TestSegment(self, float32 _lambda, b2Vec2 normal, b2Segment segment, 1960 float32 maxLambda) -> bool 1961 1962 Ray cast against this segment with another segment. 1963 """ 1964 return _Box2D.b2Segment_TestSegment(self, *args)
1965 1966 p1 = _swig_property(_Box2D.b2Segment_p1_get, _Box2D.b2Segment_p1_set) 1967 p2 = _swig_property(_Box2D.b2Segment_p2_get, _Box2D.b2Segment_p2_set)
1968 - def __repr__(self):
1969 return """b2Segment( 1970 p1 = %s, 1971 p2 = %s)"""% tuple(str(a) for a in\ 1972 (self.p1,self.p2))
1973 1974 __getstate__=_generic_getstate 1975 __setstate__=_generic_setstate 1976
1977 - def __init__(self):
1978 """__init__(self) -> b2Segment""" 1979 _Box2D.b2Segment_swiginit(self,_Box2D.new_b2Segment())
1980 __swig_destroy__ = _Box2D.delete_b2Segment 1981 b2Segment.TestSegment = new_instancemethod(_Box2D.b2Segment_TestSegment,None,b2Segment) 1982 b2Segment_swigregister = _Box2D.b2Segment_swigregister 1983 b2Segment_swigregister(b2Segment) 1984
1985 -class b2AABB(object):
1986 """An axis aligned bounding box.""" 1987 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 1988 __repr__ = _swig_repr
1989 - def IsValid(self):
1990 """ 1991 IsValid(self) -> bool 1992 1993 Verify that the bounds are sorted. 1994 """ 1995 return _Box2D.b2AABB_IsValid(self)
1996 1997 lowerBound = _swig_property(_Box2D.b2AABB_lowerBound_get, _Box2D.b2AABB_lowerBound_set) 1998 upperBound = _swig_property(_Box2D.b2AABB_upperBound_get, _Box2D.b2AABB_upperBound_set)
1999 - def __repr__(self):
2000 return """b2AABB( 2001 lowerBound = %s, 2002 upperBound = %s, 2003 IsValid() = %s)"""% tuple(str(a) for a in\ 2004 (self.lowerBound,self.upperBound,self.IsValid()))
2005 2006 __getstate__=_generic_getstate 2007 __setstate__=_generic_setstate 2008
2009 - def __init__(self):
2010 """__init__(self) -> b2AABB""" 2011 _Box2D.b2AABB_swiginit(self,_Box2D.new_b2AABB())
2012 __swig_destroy__ = _Box2D.delete_b2AABB 2013 b2AABB.IsValid = new_instancemethod(_Box2D.b2AABB_IsValid,None,b2AABB) 2014 b2AABB_swigregister = _Box2D.b2AABB_swigregister 2015 b2AABB_swigregister(b2AABB) 2016
2017 -class b2OBB(object):
2018 """An oriented bounding box.""" 2019 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2020 __repr__ = _swig_repr 2021 R = _swig_property(_Box2D.b2OBB_R_get, _Box2D.b2OBB_R_set) 2022 center = _swig_property(_Box2D.b2OBB_center_get, _Box2D.b2OBB_center_set) 2023 extents = _swig_property(_Box2D.b2OBB_extents_get, _Box2D.b2OBB_extents_set)
2024 - def __repr__(self):
2025 return """b2OBB( 2026 R = %s, 2027 center = %s, 2028 extents = %s)"""% tuple(str(a) for a in\ 2029 (self.R,self.center,self.extents))
2030 2031 __getstate__=_generic_getstate 2032 __setstate__=_generic_setstate 2033
2034 - def __init__(self):
2035 """__init__(self) -> b2OBB""" 2036 _Box2D.b2OBB_swiginit(self,_Box2D.new_b2OBB())
2037 __swig_destroy__ = _Box2D.delete_b2OBB 2038 b2OBB_swigregister = _Box2D.b2OBB_swigregister 2039 b2OBB_swigregister(b2OBB) 2040 2041
2042 -def b2CollideCircles(*args):
2043 """ 2044 b2CollideCircles(b2Manifold manifold, b2CircleShape circle1, b2XForm xf1, 2045 b2CircleShape circle2, b2XForm xf2) 2046 2047 Compute the collision manifold between two circles. 2048 """ 2049 return _Box2D.b2CollideCircles(*args)
2050
2051 -def b2CollidePolygonAndCircle(*args):
2052 """ 2053 b2CollidePolygonAndCircle(b2Manifold manifold, b2PolygonShape polygon, b2XForm xf1, 2054 b2CircleShape circle, b2XForm xf2) 2055 2056 Compute the collision manifold between a polygon and a circle. 2057 """ 2058 return _Box2D.b2CollidePolygonAndCircle(*args)
2059
2060 -def b2CollidePolygons(*args):
2061 """ 2062 b2CollidePolygons(b2Manifold manifold, b2PolygonShape polygon1, b2XForm xf1, 2063 b2PolygonShape polygon2, b2XForm xf2) 2064 2065 Compute the collision manifold between two circles. 2066 """ 2067 return _Box2D.b2CollidePolygons(*args)
2068
2069 -def __b2Distance__(*args):
2070 """ 2071 __b2Distance__(b2Vec2 x1, b2Vec2 x2, b2Shape shape1, b2XForm xf1, 2072 b2Shape shape2, b2XForm xf2) -> float32 2073 2074 Compute the distance between two shapes and the closest points. 2075 the distance between the shapes or zero if they are overlapped/touching. 2076 """ 2077 return _Box2D.__b2Distance__(*args)
2078
2079 -def b2TimeOfImpact(*args):
2080 """ 2081 b2TimeOfImpact(b2Shape shape1, b2Sweep sweep1, b2Shape shape2, b2Sweep sweep2) -> float32 2082 2083 Compute the time when two shapes begin to touch or touch at a closer distance. 2084 WARNING: 2085 the sweeps must have the same time interval. 2086 2087 the fraction between [0,1] in which the shapes first touch. fraction=0 means the shapes begin touching/overlapped, and fraction=1 means the shapes don't touch. 2088 """ 2089 return _Box2D.b2TimeOfImpact(*args)
2090
2091 -def b2TestOverlap(*args):
2092 """b2TestOverlap(b2AABB a, b2AABB b) -> bool""" 2093 return _Box2D.b2TestOverlap(*args)
2094 -class b2MassData(object):
2095 """This holds the mass data computed for a shape.""" 2096 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2097 __repr__ = _swig_repr 2098 mass = _swig_property(_Box2D.b2MassData_mass_get, _Box2D.b2MassData_mass_set) 2099 center = _swig_property(_Box2D.b2MassData_center_get, _Box2D.b2MassData_center_set) 2100 I = _swig_property(_Box2D.b2MassData_I_get, _Box2D.b2MassData_I_set)
2101 - def __repr__(self):
2102 return """b2MassData( 2103 I = %s, 2104 center = %s, 2105 mass = %s)"""% tuple(str(a) for a in\ 2106 (self.I,self.center,self.mass))
2107 2108 __getstate__=_generic_getstate 2109 __setstate__=_generic_setstate 2110
2111 - def __init__(self):
2112 """__init__(self) -> b2MassData""" 2113 _Box2D.b2MassData_swiginit(self,_Box2D.new_b2MassData())
2114 __swig_destroy__ = _Box2D.delete_b2MassData 2115 b2MassData_swigregister = _Box2D.b2MassData_swigregister 2116 b2MassData_swigregister(b2MassData) 2117
2118 -class b2FilterData(object):
2119 """This holds contact filtering data.""" 2120 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2121 __repr__ = _swig_repr 2122 categoryBits = _swig_property(_Box2D.b2FilterData_categoryBits_get, _Box2D.b2FilterData_categoryBits_set) 2123 maskBits = _swig_property(_Box2D.b2FilterData_maskBits_get, _Box2D.b2FilterData_maskBits_set) 2124 groupIndex = _swig_property(_Box2D.b2FilterData_groupIndex_get, _Box2D.b2FilterData_groupIndex_set)
2125 - def __repr__(self):
2126 return """b2FilterData( 2127 categoryBits = %s, 2128 groupIndex = %s, 2129 maskBits = %s)"""% tuple(str(a) for a in\ 2130 (self.categoryBits,self.groupIndex,self.maskBits))
2131 2132 __getstate__=_generic_getstate 2133 __setstate__=_generic_setstate 2134
2135 - def __init__(self):
2136 """__init__(self) -> b2FilterData""" 2137 _Box2D.b2FilterData_swiginit(self,_Box2D.new_b2FilterData())
2138 __swig_destroy__ = _Box2D.delete_b2FilterData 2139 b2FilterData_swigregister = _Box2D.b2FilterData_swigregister 2140 b2FilterData_swigregister(b2FilterData) 2141 2142 e_unknownShape = _Box2D.e_unknownShape 2143 e_circleShape = _Box2D.e_circleShape 2144 e_polygonShape = _Box2D.e_polygonShape 2145 e_edgeShape = _Box2D.e_edgeShape 2146 e_shapeTypeCount = _Box2D.e_shapeTypeCount 2147 e_startsInsideCollide = _Box2D.e_startsInsideCollide 2148 e_missCollide = _Box2D.e_missCollide 2149 e_hitCollide = _Box2D.e_hitCollide
2150 -class b2ShapeDef(object):
2151 """A shape definition is used to construct a shape. This class defines an abstract shape definition. You can reuse shape definitions safely.""" 2152 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2153 __repr__ = _swig_repr
2154 - def __init__(self):
2155 """ 2156 __init__(self) -> b2ShapeDef 2157 2158 The constructor sets the default shape definition values. 2159 """ 2160 _Box2D.b2ShapeDef_swiginit(self,_Box2D.new_b2ShapeDef())
2161 __swig_destroy__ = _Box2D.delete_b2ShapeDef 2162 type = _swig_property(_Box2D.b2ShapeDef_type_get, _Box2D.b2ShapeDef_type_set) 2163 friction = _swig_property(_Box2D.b2ShapeDef_friction_get, _Box2D.b2ShapeDef_friction_set) 2164 restitution = _swig_property(_Box2D.b2ShapeDef_restitution_get, _Box2D.b2ShapeDef_restitution_set) 2165 density = _swig_property(_Box2D.b2ShapeDef_density_get, _Box2D.b2ShapeDef_density_set) 2166 isSensor = _swig_property(_Box2D.b2ShapeDef_isSensor_get, _Box2D.b2ShapeDef_isSensor_set) 2167 filter = _swig_property(_Box2D.b2ShapeDef_filter_get, _Box2D.b2ShapeDef_filter_set)
2168 - def __repr__(self):
2169 return """b2ShapeDef( 2170 density = %s, 2171 filter = %s, 2172 friction = %s, 2173 isSensor = %s, 2174 restitution = %s, 2175 type = %s, 2176 userData = %s)"""% tuple(str(a) for a in\ 2177 (self.density,self.filter,self.friction,self.isSensor,self.restitution,self.type,self.userData))
2178 2179 __getstate__=_generic_getstate 2180 __setstate__=_generic_setstate 2181
2182 - def GetUserData(self):
2183 """GetUserData(self) -> PyObject""" 2184 return _Box2D.b2ShapeDef_GetUserData(self)
2185
2186 - def SetUserData(self, *args):
2187 """SetUserData(self, PyObject data)""" 2188 return _Box2D.b2ShapeDef_SetUserData(self, *args)
2189
2190 - def ClearUserData(self):
2191 """ClearUserData(self)""" 2192 return _Box2D.b2ShapeDef_ClearUserData(self)
2193 2194 userData = property(GetUserData, SetUserData)
2195 - def __del__(self):
2196 self.ClearUserData()
2197 2198 b2ShapeDef.GetUserData = new_instancemethod(_Box2D.b2ShapeDef_GetUserData,None,b2ShapeDef) 2199 b2ShapeDef.SetUserData = new_instancemethod(_Box2D.b2ShapeDef_SetUserData,None,b2ShapeDef) 2200 b2ShapeDef.ClearUserData = new_instancemethod(_Box2D.b2ShapeDef_ClearUserData,None,b2ShapeDef) 2201 b2ShapeDef_swigregister = _Box2D.b2ShapeDef_swigregister 2202 b2ShapeDef_swigregister(b2ShapeDef) 2203
2204 -class b2Shape(object):
2205 """ 2206 A shape is used for collision detection. Shapes are created in b2World. You can use shape for collision detection before they are attached to the world. 2207 WARNING: 2208 you cannot reuse shapes. 2209 """ 2210 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
2211 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
2212 __repr__ = _swig_repr
2213 - def GetType(self):
2214 """ 2215 GetType(self) -> b2ShapeType 2216 2217 Get the type of this shape. You can use this to down cast to the concrete shape. 2218 the shape type. 2219 """ 2220 return _Box2D.b2Shape_GetType(self)
2221
2222 - def IsSensor(self):
2223 """ 2224 IsSensor(self) -> bool 2225 2226 Is this shape a sensor (non-solid)? 2227 the true if the shape is a sensor. 2228 """ 2229 return _Box2D.b2Shape_IsSensor(self)
2230
2231 - def SetFilterData(self, *args):
2232 """ 2233 SetFilterData(self, b2FilterData filter) 2234 2235 Set the contact filtering data. You must call b2World::Refilterto correct existing contacts/non-contacts. 2236 """ 2237 return _Box2D.b2Shape_SetFilterData(self, *args)
2238
2239 - def GetFilterData(self):
2240 """ 2241 GetFilterData(self) -> b2FilterData 2242 2243 Get the contact filtering data. 2244 """ 2245 return _Box2D.b2Shape_GetFilterData(self)
2246
2247 - def GetBody(self):
2248 """ 2249 GetBody(self) -> b2Body 2250 2251 Get the parent body of this shape. This is NULL if the shape is not attached. 2252 the parent body. 2253 """ 2254 return _Box2D.b2Shape_GetBody(self)
2255
2256 - def GetNext(self):
2257 """ 2258 GetNext(self) -> b2Shape 2259 2260 Get the next shape in the parent body's shape list. 2261 the next shape. 2262 """ 2263 return _Box2D.b2Shape_GetNext(self)
2264
2265 - def TestPoint(self, *args):
2266 """ 2267 TestPoint(self, b2XForm xf, b2Vec2 p) -> bool 2268 2269 Test a point for containment in this shape. This only works for convex shapes. 2270 2271 Parameters: 2272 ----------- 2273 2274 xf: the shape world transform. 2275 2276 p: a point in world coordinates. 2277 """ 2278 return _Box2D.b2Shape_TestPoint(self, *args)
2279
2280 - def ComputeAABB(self, *args):
2281 """ 2282 ComputeAABB(self, b2AABB aabb, b2XForm xf) 2283 2284 Given a transform, compute the associated axis aligned bounding box for this shape. 2285 2286 Parameters: 2287 ----------- 2288 2289 aabb: returns the axis aligned box. 2290 2291 xf: the world transform of the shape. 2292 """ 2293 return _Box2D.b2Shape_ComputeAABB(self, *args)
2294
2295 - def ComputeSweptAABB(self, *args):
2296 """ 2297 ComputeSweptAABB(self, b2AABB aabb, b2XForm xf1, b2XForm xf2) 2298 2299 Given two transforms, compute the associated swept axis aligned bounding box for this shape. 2300 2301 Parameters: 2302 ----------- 2303 2304 aabb: returns the axis aligned box. 2305 2306 xf1: the starting shape world transform. 2307 2308 xf2: the ending shape world transform. 2309 """ 2310 return _Box2D.b2Shape_ComputeSweptAABB(self, *args)
2311
2312 - def ComputeMass(self, *args):
2313 """ 2314 ComputeMass(self, b2MassData massData) 2315 2316 Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid. 2317 2318 Parameters: 2319 ----------- 2320 2321 massData: returns the mass data for this shape. 2322 """ 2323 return _Box2D.b2Shape_ComputeMass(self, *args)
2324
2325 - def ComputeSubmergedArea(self, *args):
2326 """ 2327 ComputeSubmergedArea(self, b2Vec2 normal, float32 offset, b2XForm xf, b2Vec2 c) -> float32 2328 2329 Compute the volume and centroid of this shape intersected with a half plane 2330 2331 Parameters: 2332 ----------- 2333 2334 normal: the surface normal 2335 2336 offset: the surface offset along normal 2337 2338 xf: the shape transform 2339 2340 c: returns the centroid 2341 2342 the total volume less than offset along normal 2343 """ 2344 return _Box2D.b2Shape_ComputeSubmergedArea(self, *args)
2345
2346 - def GetSweepRadius(self):
2347 """ 2348 GetSweepRadius(self) -> float32 2349 2350 Get the maximum radius about the parent body's center of mass. 2351 """ 2352 return _Box2D.b2Shape_GetSweepRadius(self)
2353
2354 - def GetFriction(self):
2355 """ 2356 GetFriction(self) -> float32 2357 2358 Get the coefficient of friction. 2359 """ 2360 return _Box2D.b2Shape_GetFriction(self)
2361
2362 - def SetFriction(self, *args):
2363 """ 2364 SetFriction(self, float32 friction) 2365 2366 Set the coefficient of friction. 2367 """ 2368 return _Box2D.b2Shape_SetFriction(self, *args)
2369
2370 - def GetRestitution(self):
2371 """ 2372 GetRestitution(self) -> float32 2373 2374 Get the coefficient of restitution. 2375 """ 2376 return _Box2D.b2Shape_GetRestitution(self)
2377
2378 - def SetRestitution(self, *args):
2379 """ 2380 SetRestitution(self, float32 restitution) 2381 2382 Set the coefficient of restitution. 2383 """ 2384 return _Box2D.b2Shape_SetRestitution(self, *args)
2385
2386 - def GetDensity(self):
2387 """ 2388 GetDensity(self) -> float32 2389 2390 Get the density of the shape. 2391 """ 2392 return _Box2D.b2Shape_GetDensity(self)
2393
2394 - def SetDensity(self, *args):
2395 """ 2396 SetDensity(self, float32 density) 2397 2398 Set the density of the shape. 2399 """ 2400 return _Box2D.b2Shape_SetDensity(self, *args)
2401
2402 - def __repr__(self):
2403 return """b2Shape( 2404 density = %s, 2405 filter = %s, 2406 friction = %s, 2407 restitution = %s, 2408 userData = %s, 2409 GetBody() = %s, 2410 GetFilterData() = %s, 2411 GetSweepRadius() = %s, 2412 GetType() = %s, 2413 IsSensor() = %s)"""% tuple(str(a) for a in\ 2414 (self.density,self.filter,self.friction,self.restitution,self.userData,self.GetBody(),self.GetFilterData(),self.GetSweepRadius(),self.GetType(),self.IsSensor()))
2415 2416 __getstate__=no_pickle 2417 __setstate__=_generic_setstate 2418
2419 - def GetUserData(self):
2420 """ 2421 GetUserData(self) -> PyObject 2422 2423 Get the user data that was assigned in the shape definition. Use this to store your application specific data. 2424 """ 2425 return _Box2D.b2Shape_GetUserData(self)
2426
2427 - def SetUserData(self, *args):
2428 """ 2429 SetUserData(self, PyObject data) 2430 2431 Set the user data. Use this to store your application specific data. 2432 """ 2433 return _Box2D.b2Shape_SetUserData(self, *args)
2434
2435 - def ClearUserData(self):
2436 """ClearUserData(self)""" 2437 return _Box2D.b2Shape_ClearUserData(self)
2438 2439 userData = property(GetUserData, SetUserData) 2440
2441 - def __hash__(self):
2442 """__hash__(self) -> int32""" 2443 return _Box2D.b2Shape___hash__(self)
2444
2445 - def TestSegment(self, *args):
2446 """ 2447 TestSegment(self, b2XForm xf, float32 _lambda, b2Vec2 normal, b2Segment segment, 2448 float32 maxLambda) -> b2SegmentCollide 2449 TestSegment(self, b2XForm xf, b2Segment segment, float32 maxLambda) -> PyObject 2450 2451 Perform a ray cast against this shape. 2452 2453 Parameters: 2454 ----------- 2455 2456 xf: 2457 the shape world transform. 2458 2459 lambda: 2460 returns the hit fraction. You can use this to compute the contact point p = (1 - lambda) * segment.p1 + lambda * segment.p2. 2461 2462 normal: 2463 returns the normal at the contact point. If there is no intersection, the normal is not set. 2464 2465 segment: 2466 defines the begin and end point of the ray cast. 2467 2468 maxLambda: 2469 a number typically in the range [0,1]. 2470 """ 2471 return _Box2D.b2Shape_TestSegment(self, *args)
2472 2473 filter = property(GetFilterData, SetFilterData) 2474 friction = property(GetFriction, SetFriction) 2475 restitution= property(GetRestitution, SetRestitution) 2476 density = property(GetDensity, SetDensity) 2477 isSensor = property(IsSensor, None) # for symmetry with defn + pickling 2478 __eq__ = b2ShapeCompare 2479 __ne__ = lambda self,other: not b2ShapeCompare(self,other)
2480 - def typeName(self):
2481 types = { e_unknownShape : "Unknown", 2482 e_circleShape : "Circle", 2483 e_polygonShape : "Polygon", 2484 e_edgeShape : "Edge", 2485 e_shapeTypeCount: "ShapeType" } 2486 return types[self.GetType()]
2487 - def getAsType(self):
2488 """Return a typecasted version of the shape""" 2489 return (getattr(self, "as%s" % self.typeName())) ()
2490
2491 - def asCircle(self):
2492 """asCircle(self) -> b2CircleShape""" 2493 return _Box2D.b2Shape_asCircle(self)
2494
2495 - def asPolygon(self):
2496 """asPolygon(self) -> b2PolygonShape""" 2497 return _Box2D.b2Shape_asPolygon(self)
2498
2499 - def asEdge(self):
2500 """asEdge(self) -> b2EdgeShape""" 2501 return _Box2D.b2Shape_asEdge(self)
2502 2503 b2Shape.GetType = new_instancemethod(_Box2D.b2Shape_GetType,None,b2Shape) 2504 b2Shape.IsSensor = new_instancemethod(_Box2D.b2Shape_IsSensor,None,b2Shape) 2505 b2Shape.SetFilterData = new_instancemethod(_Box2D.b2Shape_SetFilterData,None,b2Shape) 2506 b2Shape.GetFilterData = new_instancemethod(_Box2D.b2Shape_GetFilterData,None,b2Shape) 2507 b2Shape.GetBody = new_instancemethod(_Box2D.b2Shape_GetBody,None,b2Shape) 2508 b2Shape.GetNext = new_instancemethod(_Box2D.b2Shape_GetNext,None,b2Shape) 2509 b2Shape.TestPoint = new_instancemethod(_Box2D.b2Shape_TestPoint,None,b2Shape) 2510 b2Shape.ComputeAABB = new_instancemethod(_Box2D.b2Shape_ComputeAABB,None,b2Shape) 2511 b2Shape.ComputeSweptAABB = new_instancemethod(_Box2D.b2Shape_ComputeSweptAABB,None,b2Shape) 2512 b2Shape.ComputeMass = new_instancemethod(_Box2D.b2Shape_ComputeMass,None,b2Shape) 2513 b2Shape.ComputeSubmergedArea = new_instancemethod(_Box2D.b2Shape_ComputeSubmergedArea,None,b2Shape) 2514 b2Shape.GetSweepRadius = new_instancemethod(_Box2D.b2Shape_GetSweepRadius,None,b2Shape) 2515 b2Shape.GetFriction = new_instancemethod(_Box2D.b2Shape_GetFriction,None,b2Shape) 2516 b2Shape.SetFriction = new_instancemethod(_Box2D.b2Shape_SetFriction,None,b2Shape) 2517 b2Shape.GetRestitution = new_instancemethod(_Box2D.b2Shape_GetRestitution,None,b2Shape) 2518 b2Shape.SetRestitution = new_instancemethod(_Box2D.b2Shape_SetRestitution,None,b2Shape) 2519 b2Shape.GetDensity = new_instancemethod(_Box2D.b2Shape_GetDensity,None,b2Shape) 2520 b2Shape.SetDensity = new_instancemethod(_Box2D.b2Shape_SetDensity,None,b2Shape) 2521 b2Shape.GetUserData = new_instancemethod(_Box2D.b2Shape_GetUserData,None,b2Shape) 2522 b2Shape.SetUserData = new_instancemethod(_Box2D.b2Shape_SetUserData,None,b2Shape) 2523 b2Shape.ClearUserData = new_instancemethod(_Box2D.b2Shape_ClearUserData,None,b2Shape) 2524 b2Shape.__hash__ = new_instancemethod(_Box2D.b2Shape___hash__,None,b2Shape) 2525 b2Shape.TestSegment = new_instancemethod(_Box2D.b2Shape_TestSegment,None,b2Shape) 2526 b2Shape.asCircle = new_instancemethod(_Box2D.b2Shape_asCircle,None,b2Shape) 2527 b2Shape.asPolygon = new_instancemethod(_Box2D.b2Shape_asPolygon,None,b2Shape) 2528 b2Shape.asEdge = new_instancemethod(_Box2D.b2Shape_asEdge,None,b2Shape) 2529 b2Shape_swigregister = _Box2D.b2Shape_swigregister 2530 b2Shape_swigregister(b2Shape) 2531
2532 -class b2CircleDef(b2ShapeDef):
2533 """This structure is used to build circle shapes.""" 2534 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2535 __repr__ = _swig_repr
2536 - def __init__(self):
2537 """ 2538 __init__(self) -> b2CircleDef 2539 2540 This structure is used to build circle shapes. 2541 """ 2542 _Box2D.b2CircleDef_swiginit(self,_Box2D.new_b2CircleDef())
2543 localPosition = _swig_property(_Box2D.b2CircleDef_localPosition_get, _Box2D.b2CircleDef_localPosition_set) 2544 radius = _swig_property(_Box2D.b2CircleDef_radius_get, _Box2D.b2CircleDef_radius_set)
2545 - def __repr__(self):
2546 return """b2CircleDef( 2547 density = %s, 2548 filter = %s, 2549 friction = %s, 2550 isSensor = %s, 2551 localPosition = %s, 2552 radius = %s, 2553 restitution = %s, 2554 type = %s, 2555 userData = %s)"""% tuple(str(a) for a in\ 2556 (self.density,self.filter,self.friction,self.isSensor,self.localPosition,self.radius,self.restitution,self.type,self.userData))
2557 2558 __getstate__=_generic_getstate 2559 __setstate__=_generic_setstate 2560 2561 __swig_destroy__ = _Box2D.delete_b2CircleDef 2562 b2CircleDef_swigregister = _Box2D.b2CircleDef_swigregister 2563 b2CircleDef_swigregister(b2CircleDef) 2564
2565 -class b2CircleShape(b2Shape):
2566 """A circle shape.""" 2567 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
2568 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
2569 __repr__ = _swig_repr
2570 - def GetLocalPosition(self):
2571 """ 2572 GetLocalPosition(self) -> b2Vec2 2573 2574 Get the local position of this circle in its parent body. 2575 """ 2576 return _Box2D.b2CircleShape_GetLocalPosition(self)
2577
2578 - def GetRadius(self):
2579 """ 2580 GetRadius(self) -> float32 2581 2582 Get the radius of this circle. 2583 """ 2584 return _Box2D.b2CircleShape_GetRadius(self)
2585
2586 - def __repr__(self):
2587 return """b2CircleShape( 2588 density = %s, 2589 filter = %s, 2590 friction = %s, 2591 localPosition = %s, 2592 radius = %s, 2593 restitution = %s, 2594 userData = %s, 2595 GetBody() = %s, 2596 GetFilterData() = %s, 2597 GetSweepRadius() = %s, 2598 GetType() = %s, 2599 IsSensor() = %s)"""% tuple(str(a) for a in\ 2600 (self.density,self.filter,self.friction,self.localPosition,self.radius,self.restitution,self.userData,self.GetBody(),self.GetFilterData(),self.GetSweepRadius(),self.GetType(),self.IsSensor()))
2601 2602 __getstate__=_generic_getstate 2603 __setstate__=_pickle_factory_set 2604 _pickle_finalize=_pickle_finalize 2605 2606 __eq__ = b2ShapeCompare 2607 __ne__ = lambda self,other: not b2ShapeCompare(self,other) 2608 radius = property(GetRadius, None) 2609 localPosition = property(GetLocalPosition, None) 2610 2611 __swig_destroy__ = _Box2D.delete_b2CircleShape
2612 b2CircleShape.GetLocalPosition = new_instancemethod(_Box2D.b2CircleShape_GetLocalPosition,None,b2CircleShape) 2613 b2CircleShape.GetRadius = new_instancemethod(_Box2D.b2CircleShape_GetRadius,None,b2CircleShape) 2614 b2CircleShape_swigregister = _Box2D.b2CircleShape_swigregister 2615 b2CircleShape_swigregister(b2CircleShape) 2616
2617 -class b2PolygonDef(b2ShapeDef):
2618 """Convex polygon. The vertices must be in CCW order for a right-handed coordinate system with the z-axis coming out of the screen.""" 2619 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2620 __repr__ = _swig_repr
2621 - def __init__(self):
2622 """ 2623 __init__(self) -> b2PolygonDef 2624 2625 Convex polygon. The vertices must be in CCW order for a right-handed coordinate system with the z-axis coming out of the screen. 2626 """ 2627 _Box2D.b2PolygonDef_swiginit(self,_Box2D.new_b2PolygonDef())
2628 - def SetAsBox(self, *args):
2629 """ 2630 SetAsBox(self, float32 hx, float32 hy) 2631 SetAsBox(self, float32 hx, float32 hy, b2Vec2 center, float32 angle) 2632 2633 Build vertices to represent an oriented box. 2634 2635 Parameters: 2636 ----------- 2637 2638 hx: the half-width. 2639 2640 hy: the half-height. 2641 2642 center: 2643 the center of the box in local coordinates. 2644 2645 angle: 2646 the rotation of the box in local coordinates. 2647 """ 2648 return _Box2D.b2PolygonDef_SetAsBox(self, *args)
2649 2650 vertexCount = _swig_property(_Box2D.b2PolygonDef_vertexCount_get, _Box2D.b2PolygonDef_vertexCount_set)
2651 - def __repr__(self):
2652 return """b2PolygonDef( 2653 density = %s, 2654 filter = %s, 2655 friction = %s, 2656 isSensor = %s, 2657 restitution = %s, 2658 type = %s, 2659 userData = %s, 2660 vertexCount = %s, 2661 vertices = %s)"""% tuple(str(a) for a in\ 2662 (self.density,self.filter,self.friction,self.isSensor,self.restitution,self.type,self.userData,self.vertexCount,self.vertices))
2663 2664 __getstate__=_generic_getstate 2665 __setstate__=_generic_setstate 2666
2667 - def __repr__(self):
2668 return "b2PolygonDef(vertices: %s count: %d)" % (self.vertices, self.vertexCount)
2669 - def checkValues(self):
2670 return b2PythonCheckPolygonDef(self)
2671 - def getVertices_tuple(self):
2672 """Returns all of the vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2673 vertices = [] 2674 for i in range(0, self.vertexCount): 2675 vertices.append( (self.getVertex(i).x, self.getVertex(i).y ) ) 2676 return vertices
2677 - def getVertices_b2Vec2(self):
2678 """Returns all of the vertices as a list of b2Vec2's [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2679 vertices = [] 2680 for i in range(0, self.vertexCount): 2681 vertices.append(self.getVertex(i)) 2682 return vertices
2683 - def setVertices(self, vertices):
2684 """Sets all of the vertices given a tuple 2685 in the format ( (x1,y1), (x2,y2) ... (xN,yN) ) 2686 where each vertex is a list/tuple/b2Vec2""" 2687 if len(vertices) > b2_maxPolygonVertices: 2688 raise ValueError 2689 self.vertexCount = len(vertices) 2690 for i in range(0, self.vertexCount): 2691 self.setVertex(i, vertices[i]) # possible on pyBox2D >= r2.0.2b1
2692 setVertices_tuple = setVertices # pre 202b1 compatibility 2693 setVertices_b2Vec2 = setVertices # pre 202b1 compatibility 2694 vertices = property(getVertices_tuple, setVertices) 2695 2696
2697 - def getVertex(self, *args):
2698 """getVertex(self, uint16 vnum) -> b2Vec2""" 2699 return _Box2D.b2PolygonDef_getVertex(self, *args)
2700
2701 - def setVertex(self, *args):
2702 """ 2703 setVertex(self, uint16 vnum, b2Vec2 value) 2704 setVertex(self, uint16 vnum, float32 x, float32 y) 2705 """ 2706 return _Box2D.b2PolygonDef_setVertex(self, *args)
2707 2708 __swig_destroy__ = _Box2D.delete_b2PolygonDef 2709 b2PolygonDef.SetAsBox = new_instancemethod(_Box2D.b2PolygonDef_SetAsBox,None,b2PolygonDef) 2710 b2PolygonDef.getVertex = new_instancemethod(_Box2D.b2PolygonDef_getVertex,None,b2PolygonDef) 2711 b2PolygonDef.setVertex = new_instancemethod(_Box2D.b2PolygonDef_setVertex,None,b2PolygonDef) 2712 b2PolygonDef_swigregister = _Box2D.b2PolygonDef_swigregister 2713 b2PolygonDef_swigregister(b2PolygonDef) 2714
2715 -class b2PolygonShape(b2Shape):
2716 """A convex polygon.""" 2717 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
2718 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
2719 __repr__ = _swig_repr
2720 - def GetOBB(self):
2721 """ 2722 GetOBB(self) -> b2OBB 2723 2724 Get the oriented bounding box relative to the parent body. 2725 """ 2726 return _Box2D.b2PolygonShape_GetOBB(self)
2727
2728 - def GetCentroid(self):
2729 """ 2730 GetCentroid(self) -> b2Vec2 2731 2732 Get local centroid relative to the parent body. 2733 """ 2734 return _Box2D.b2PolygonShape_GetCentroid(self)
2735
2736 - def GetVertexCount(self):
2737 """ 2738 GetVertexCount(self) -> int32 2739 2740 Get the vertex count. 2741 """ 2742 return _Box2D.b2PolygonShape_GetVertexCount(self)
2743
2744 - def GetCoreVertices(self):
2745 """ 2746 GetCoreVertices(self) -> b2Vec2 2747 2748 Get the core vertices in local coordinates. These vertices represent a smaller polygon that is used for time of impact computations. 2749 """ 2750 return _Box2D.b2PolygonShape_GetCoreVertices(self)
2751
2752 - def GetFirstVertex(self, *args):
2753 """ 2754 GetFirstVertex(self, b2XForm xf) -> b2Vec2 2755 2756 Get the first vertex and apply the supplied transform. 2757 """ 2758 return _Box2D.b2PolygonShape_GetFirstVertex(self, *args)
2759
2760 - def Centroid(self, *args):
2761 """ 2762 Centroid(self, b2XForm xf) -> b2Vec2 2763 2764 Get the centroid and apply the supplied transform. 2765 """ 2766 return _Box2D.b2PolygonShape_Centroid(self, *args)
2767
2768 - def Support(self, *args):
2769 """ 2770 Support(self, b2XForm xf, b2Vec2 d) -> b2Vec2 2771 2772 Get the support point in the given world direction. Use the supplied transform. 2773 """ 2774 return _Box2D.b2PolygonShape_Support(self, *args)
2775
2776 - def __repr__(self):
2777 return """b2PolygonShape( 2778 coreVertices = %s, 2779 density = %s, 2780 filter = %s, 2781 friction = %s, 2782 normals = %s, 2783 restitution = %s, 2784 userData = %s, 2785 vertices = %s, 2786 GetBody() = %s, 2787 GetCentroid() = %s, 2788 GetFilterData() = %s, 2789 GetOBB() = %s, 2790 GetSweepRadius() = %s, 2791 GetType() = %s, 2792 GetVertexCount() = %s, 2793 IsSensor() = %s)"""% tuple(str(a) for a in\ 2794 (self.coreVertices,self.density,self.filter,self.friction,self.normals,self.restitution,self.userData,self.vertices,self.GetBody(),self.GetCentroid(),self.GetFilterData(),self.GetOBB(),self.GetSweepRadius(),self.GetType(),self.GetVertexCount(),self.IsSensor()))
2795 2796 __getstate__=_generic_getstate 2797 __setstate__=_pickle_factory_set 2798 _pickle_finalize=_pickle_finalize 2799 2800 __eq__ = b2ShapeCompare 2801 __ne__ = lambda self,other: not b2ShapeCompare(self,other)
2802 - def __repr__(self):
2803 return "b2PolygonShape(vertices: %s count: %d)" % (self.getVertices_tuple(), self.GetVertexCount())
2804 - def getCoreVertices_tuple(self):
2805 """Returns all of the core vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2806 vertices = [] 2807 for i in range(0, self.GetVertexCount()): 2808 vertices.append( (self.getCoreVertex(i).x, self.getCoreVertex(i).y ) ) 2809 return vertices
2810 - def getCoreVertices_b2Vec2(self):
2811 """Returns all of the core vertices as a list of b2Vec2's [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2812 vertices = [] 2813 for i in range(0, self.GetVertexCount()): 2814 vertices.append(self.getCoreVertex(i)) 2815 return vertices
2816 - def getVertices_tuple(self):
2817 """Returns all of the vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2818 vertices = [] 2819 for i in range(0, self.GetVertexCount()): 2820 vertices.append( (self.getVertex(i).x, self.getVertex(i).y ) ) 2821 return vertices
2822 - def getVertices_b2Vec2(self):
2823 """Returns all of the vertices as a list of b2Vec2's [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2824 vertices = [] 2825 for i in range(0, self.GetVertexCount()): 2826 vertices.append(self.getVertex(i)) 2827 return vertices
2828 - def getNormals_tuple(self):
2829 """Returns all of the normals as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2830 vertices = [] 2831 for i in range(0, self.GetVertexCount()): 2832 vertices.append( (self.getNormal(i).x, self.getNormal(i).y ) ) 2833 return vertices
2834 - def getNormals_b2Vec2(self):
2835 """Returns all of the normals as a list of b2Vec2's [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2836 vertices = [] 2837 for i in range(0, self.GetVertexCount()): 2838 vertices.append(self.getNormal(i)) 2839 return vertices
2840 - def __iter__(self):
2841 """ 2842 Iterates over the vertices in the polygon 2843 """ 2844 for v in self.vertices: 2845 yield v
2846 2847 vertices = property(getVertices_tuple, None) 2848 coreVertices = property(getCoreVertices_tuple, None) 2849 normals = property(getNormals_tuple, None) 2850
2851 - def getVertex(self, *args):
2852 """getVertex(self, uint16 vnum) -> b2Vec2""" 2853 return _Box2D.b2PolygonShape_getVertex(self, *args)
2854
2855 - def getCoreVertex(self, *args):
2856 """getCoreVertex(self, uint16 vnum) -> b2Vec2""" 2857 return _Box2D.b2PolygonShape_getCoreVertex(self, *args)
2858
2859 - def getNormal(self, *args):
2860 """getNormal(self, uint16 vnum) -> b2Vec2""" 2861 return _Box2D.b2PolygonShape_getNormal(self, *args)
2862 2863 __swig_destroy__ = _Box2D.delete_b2PolygonShape
2864 b2PolygonShape.GetOBB = new_instancemethod(_Box2D.b2PolygonShape_GetOBB,None,b2PolygonShape) 2865 b2PolygonShape.GetCentroid = new_instancemethod(_Box2D.b2PolygonShape_GetCentroid,None,b2PolygonShape) 2866 b2PolygonShape.GetVertexCount = new_instancemethod(_Box2D.b2PolygonShape_GetVertexCount,None,b2PolygonShape) 2867 b2PolygonShape.GetCoreVertices = new_instancemethod(_Box2D.b2PolygonShape_GetCoreVertices,None,b2PolygonShape) 2868 b2PolygonShape.GetFirstVertex = new_instancemethod(_Box2D.b2PolygonShape_GetFirstVertex,None,b2PolygonShape) 2869 b2PolygonShape.Centroid = new_instancemethod(_Box2D.b2PolygonShape_Centroid,None,b2PolygonShape) 2870 b2PolygonShape.Support = new_instancemethod(_Box2D.b2PolygonShape_Support,None,b2PolygonShape) 2871 b2PolygonShape.getVertex = new_instancemethod(_Box2D.b2PolygonShape_getVertex,None,b2PolygonShape) 2872 b2PolygonShape.getCoreVertex = new_instancemethod(_Box2D.b2PolygonShape_getCoreVertex,None,b2PolygonShape) 2873 b2PolygonShape.getNormal = new_instancemethod(_Box2D.b2PolygonShape_getNormal,None,b2PolygonShape) 2874 b2PolygonShape_swigregister = _Box2D.b2PolygonShape_swigregister 2875 b2PolygonShape_swigregister(b2PolygonShape) 2876
2877 -class b2EdgeChainDef(b2ShapeDef):
2878 """This structure is used to build edge shapes.""" 2879 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 2880 __repr__ = _swig_repr
2881 - def __init__(self):
2882 """ 2883 __init__(self) -> b2EdgeChainDef 2884 2885 This structure is used to build edge shapes. 2886 """ 2887 _Box2D.b2EdgeChainDef_swiginit(self,_Box2D.new_b2EdgeChainDef())
2888 vertexCount = _swig_property(_Box2D.b2EdgeChainDef_vertexCount_get, _Box2D.b2EdgeChainDef_vertexCount_set) 2889 isALoop = _swig_property(_Box2D.b2EdgeChainDef_isALoop_get, _Box2D.b2EdgeChainDef_isALoop_set)
2890 - def __repr__(self):
2891 return """b2EdgeChainDef( 2892 density = %s, 2893 filter = %s, 2894 friction = %s, 2895 isALoop = %s, 2896 isSensor = %s, 2897 restitution = %s, 2898 type = %s, 2899 userData = %s, 2900 vertexCount = %s, 2901 vertices = %s)"""% tuple(str(a) for a in\ 2902 (self.density,self.filter,self.friction,self.isALoop,self.isSensor,self.restitution,self.type,self.userData,self.vertexCount,self.vertices))
2903 2904 __getstate__=_generic_getstate 2905 __setstate__=_generic_setstate 2906
2907 - def __repr__(self):
2908 return "b2EdgeDef(vertices: %s count: %d)" % (self.getVertices_tuple(), self.vertexCount)
2909 - def __del__(self):
2910 """Cleans up by freeing the allocated vertex array""" 2911 super(b2EdgeChainDef, self).__del__() 2912 self._cleanUp()
2913 - def getVertices_tuple(self):
2914 """Returns all of the vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2915 vertices = [] 2916 for i in range(0, self.vertexCount): 2917 vertices.append( (self.getVertex(i).x, self.getVertex(i).y ) ) 2918 return vertices
2919 - def getVertices_b2Vec2(self):
2920 """Returns all of the vertices as a list of b2Vec2's [ (x1,y1), (x2,y2) ... (xN,yN) ]""" 2921 vertices = [] 2922 for i in range(0, self.vertexCount): 2923 vertices.append(self.getVertex(i)) 2924 return vertices
2925 - def setVertices(self, vertices):
2926 """Sets all of the vertices given a tuple 2927 in the format ( (x1,y1), (x2,y2) ... (xN,yN) ) 2928 where each vertex is either a list/tuple/b2Vec2""" 2929 self._allocateVertices(len(vertices)) 2930 for i in range(0, self.vertexCount): 2931 self.setVertex(i, vertices[i])
2932 setVertices_tuple = setVertices # pre 202b1 compatibility 2933 setVertices_b2Vec2 = setVertices # pre 202b1 compatibility 2934 vertices = property(getVertices_tuple, setVertices) 2935 2936
2937 - def _cleanUp(self):
2938 """_cleanUp(self)""" 2939 return _Box2D.b2EdgeChainDef__cleanUp(self)
2940
2941 - def _allocateVertices(self, *args):
2942 """_allocateVertices(self, uint16 _count)""" 2943 return _Box2D.b2EdgeChainDef__allocateVertices(self, *args)
2944
2945 - def getVertex(self, *args):
2946 """getVertex(self, uint16 vnum) -> b2Vec2""" 2947 return _Box2D.b2EdgeChainDef_getVertex(self, *args)
2948
2949 - def setVertex(self, *args):
2950 """ 2951 setVertex(self, uint16 vnum, b2Vec2 value) 2952 setVertex(self, uint16 vnum, float32 x, float32 y) 2953 """ 2954 return _Box2D.b2EdgeChainDef_setVertex(self, *args)
2955 2956 __swig_destroy__ = _Box2D.delete_b2EdgeChainDef 2957 b2EdgeChainDef._cleanUp = new_instancemethod(_Box2D.b2EdgeChainDef__cleanUp,None,b2EdgeChainDef) 2958 b2EdgeChainDef._allocateVertices = new_instancemethod(_Box2D.b2EdgeChainDef__allocateVertices,None,b2EdgeChainDef) 2959 b2EdgeChainDef.getVertex = new_instancemethod(_Box2D.b2EdgeChainDef_getVertex,None,b2EdgeChainDef) 2960 b2EdgeChainDef.setVertex = new_instancemethod(_Box2D.b2EdgeChainDef_setVertex,None,b2EdgeChainDef) 2961 b2EdgeChainDef_swigregister = _Box2D.b2EdgeChainDef_swigregister 2962 b2EdgeChainDef_swigregister(b2EdgeChainDef) 2963
2964 -class b2EdgeShape(b2Shape):
2965 """The edge shape.""" 2966 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
2967 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
2968 __repr__ = _swig_repr
2969 - def GetLength(self):
2970 """ 2971 GetLength(self) -> float32 2972 2973 Linear distance from vertex1 to vertex2:. 2974 """ 2975 return _Box2D.b2EdgeShape_GetLength(self)
2976
2977 - def GetVertex1(self):
2978 """ 2979 GetVertex1(self) -> b2Vec2 2980 2981 Local position of vertex in parent body. 2982 """ 2983 return _Box2D.b2EdgeShape_GetVertex1(self)
2984
2985 - def GetVertex2(self):
2986 """ 2987 GetVertex2(self) -> b2Vec2 2988 2989 Local position of vertex in parent body. 2990 """ 2991 return _Box2D.b2EdgeShape_GetVertex2(self)
2992
2993 - def GetCoreVertex1(self):
2994 """ 2995 GetCoreVertex1(self) -> b2Vec2 2996 2997 "Core" vertex with TOI slop for b2Distance functions: 2998 """ 2999 return _Box2D.b2EdgeShape_GetCoreVertex1(self)
3000
3001 - def GetCoreVertex2(self):
3002 """ 3003 GetCoreVertex2(self) -> b2Vec2 3004 3005 "Core" vertex with TOI slop for b2Distance functions: 3006 """ 3007 return _Box2D.b2EdgeShape_GetCoreVertex2(self)
3008
3009 - def GetNormalVector(self):
3010 """ 3011 GetNormalVector(self) -> b2Vec2 3012 3013 Perpendicular unit vector point, pointing from the solid side to the empty side:. 3014 """ 3015 return _Box2D.b2EdgeShape_GetNormalVector(self)
3016
3017 - def GetDirectionVector(self):
3018 """ 3019 GetDirectionVector(self) -> b2Vec2 3020 3021 Parallel unit vector, pointing from vertex1 to vertex2:. 3022 """ 3023 return _Box2D.b2EdgeShape_GetDirectionVector(self)
3024
3025 - def GetCorner1Vector(self):
3026 """GetCorner1Vector(self) -> b2Vec2""" 3027 return _Box2D.b2EdgeShape_GetCorner1Vector(self)
3028
3029 - def GetCorner2Vector(self):
3030 """GetCorner2Vector(self) -> b2Vec2""" 3031 return _Box2D.b2EdgeShape_GetCorner2Vector(self)
3032
3033 - def Corner1IsConvex(self):
3034 """Corner1IsConvex(self) -> bool""" 3035 return _Box2D.b2EdgeShape_Corner1IsConvex(self)
3036
3037 - def Corner2IsConvex(self):
3038 """Corner2IsConvex(self) -> bool""" 3039 return _Box2D.b2EdgeShape_Corner2IsConvex(self)
3040
3041 - def GetFirstVertex(self, *args):
3042 """GetFirstVertex(self, b2XForm xf) -> b2Vec2""" 3043 return _Box2D.b2EdgeShape_GetFirstVertex(self, *args)
3044
3045 - def Support(self, *args):
3046 """Support(self, b2XForm xf, b2Vec2 d) -> b2Vec2""" 3047 return _Box2D.b2EdgeShape_Support(self, *args)
3048
3049 - def GetNextEdge(self):
3050 """ 3051 GetNextEdge(self) -> b2EdgeShape 3052 3053 Get the next edge in the chain. 3054 """ 3055 return _Box2D.b2EdgeShape_GetNextEdge(self)
3056
3057 - def GetPrevEdge(self):
3058 """ 3059 GetPrevEdge(self) -> b2EdgeShape 3060 3061 Get the previous edge in the chain. 3062 """ 3063 return _Box2D.b2EdgeShape_GetPrevEdge(self)
3064
3065 - def SetPrevEdge(self, *args):
3066 """SetPrevEdge(self, b2EdgeShape edge, b2Vec2 core, b2Vec2 cornerDir, bool convex)""" 3067 return _Box2D.b2EdgeShape_SetPrevEdge(self, *args)
3068
3069 - def SetNextEdge(self, *args):
3070 """SetNextEdge(self, b2EdgeShape edge, b2Vec2 core, b2Vec2 cornerDir, bool convex)""" 3071 return _Box2D.b2EdgeShape_SetNextEdge(self, *args)
3072
3073 - def __repr__(self):
3074 return """b2EdgeShape( 3075 density = %s, 3076 filter = %s, 3077 friction = %s, 3078 restitution = %s, 3079 userData = %s, 3080 GetBody() = %s, 3081 GetCoreVertex1() = %s, 3082 GetCoreVertex2() = %s, 3083 GetCorner1Vector() = %s, 3084 GetCorner2Vector() = %s, 3085 GetDirectionVector() = %s, 3086 GetFilterData() = %s, 3087 GetLength() = %s, 3088 GetNormalVector() = %s, 3089 GetSweepRadius() = %s, 3090 GetType() = %s, 3091 GetVertex1() = %s, 3092 GetVertex2() = %s, 3093 IsSensor() = %s)"""% tuple(str(a) for a in\ 3094 (self.density,self.filter,self.friction,self.restitution,self.userData,self.GetBody(),self.GetCoreVertex1(),self.GetCoreVertex2(),self.GetCorner1Vector(),self.GetCorner2Vector(),self.GetDirectionVector(),self.GetFilterData(),self.GetLength(),self.GetNormalVector(),self.GetSweepRadius(),self.GetType(),self.GetVertex1(),self.GetVertex2(),self.IsSensor()))
3095 3096 __getstate__=_generic_getstate 3097 __setstate__=_pickle_factory_set 3098 _pickle_finalize=_pickle_finalize 3099
3100 - def GetVertices(self):
3101 vertices = [] 3102 edge = self 3103 while edge: 3104 vertices.append( edge.vertex1 ) 3105 last = edge.vertex2 3106 edge=edge.next 3107 if edge==self: # a loop 3108 vertices.extend( [edge.vertex1, edge.vertex2] ) 3109 return vertices 3110 vertices.append( last ) 3111 return vertices
3112 3113 length = property(GetLength, None) 3114 vertex1 = property(GetVertex1, None) 3115 vertex2 = property(GetVertex2, None) 3116 coreVertex1 = property(GetCoreVertex1, None) 3117 coreVertex2 = property(GetCoreVertex2, None) 3118 next = property(GetNextEdge, None) 3119 prev = property(GetPrevEdge, None) 3120 3121 __swig_destroy__ = _Box2D.delete_b2EdgeShape
3122 b2EdgeShape.GetLength = new_instancemethod(_Box2D.b2EdgeShape_GetLength,None,b2EdgeShape) 3123 b2EdgeShape.GetVertex1 = new_instancemethod(_Box2D.b2EdgeShape_GetVertex1,None,b2EdgeShape) 3124 b2EdgeShape.GetVertex2 = new_instancemethod(_Box2D.b2EdgeShape_GetVertex2,None,b2EdgeShape) 3125 b2EdgeShape.GetCoreVertex1 = new_instancemethod(_Box2D.b2EdgeShape_GetCoreVertex1,None,b2EdgeShape) 3126 b2EdgeShape.GetCoreVertex2 = new_instancemethod(_Box2D.b2EdgeShape_GetCoreVertex2,None,b2EdgeShape) 3127 b2EdgeShape.GetNormalVector = new_instancemethod(_Box2D.b2EdgeShape_GetNormalVector,None,b2EdgeShape) 3128 b2EdgeShape.GetDirectionVector = new_instancemethod(_Box2D.b2EdgeShape_GetDirectionVector,None,b2EdgeShape) 3129 b2EdgeShape.GetCorner1Vector = new_instancemethod(_Box2D.b2EdgeShape_GetCorner1Vector,None,b2EdgeShape) 3130 b2EdgeShape.GetCorner2Vector = new_instancemethod(_Box2D.b2EdgeShape_GetCorner2Vector,None,b2EdgeShape) 3131 b2EdgeShape.Corner1IsConvex = new_instancemethod(_Box2D.b2EdgeShape_Corner1IsConvex,None,b2EdgeShape) 3132 b2EdgeShape.Corner2IsConvex = new_instancemethod(_Box2D.b2EdgeShape_Corner2IsConvex,None,b2EdgeShape) 3133 b2EdgeShape.GetFirstVertex = new_instancemethod(_Box2D.b2EdgeShape_GetFirstVertex,None,b2EdgeShape) 3134 b2EdgeShape.Support = new_instancemethod(_Box2D.b2EdgeShape_Support,None,b2EdgeShape) 3135 b2EdgeShape.GetNextEdge = new_instancemethod(_Box2D.b2EdgeShape_GetNextEdge,None,b2EdgeShape) 3136 b2EdgeShape.GetPrevEdge = new_instancemethod(_Box2D.b2EdgeShape_GetPrevEdge,None,b2EdgeShape) 3137 b2EdgeShape.SetPrevEdge = new_instancemethod(_Box2D.b2EdgeShape_SetPrevEdge,None,b2EdgeShape) 3138 b2EdgeShape.SetNextEdge = new_instancemethod(_Box2D.b2EdgeShape_SetNextEdge,None,b2EdgeShape) 3139 b2EdgeShape_swigregister = _Box2D.b2EdgeShape_swigregister 3140 b2EdgeShape_swigregister(b2EdgeShape) 3141
3142 -class b2Pair(object):
3143 """Proxy of C++ b2Pair class""" 3144 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3145 __repr__ = _swig_repr 3146 e_pairBuffered = _Box2D.b2Pair_e_pairBuffered 3147 e_pairRemoved = _Box2D.b2Pair_e_pairRemoved 3148 e_pairFinal = _Box2D.b2Pair_e_pairFinal
3149 - def SetBuffered(self):
3150 """SetBuffered(self)""" 3151 return _Box2D.b2Pair_SetBuffered(self)
3152
3153 - def ClearBuffered(self):
3154 """ClearBuffered(self)""" 3155 return _Box2D.b2Pair_ClearBuffered(self)
3156
3157 - def IsBuffered(self):
3158 """IsBuffered(self) -> bool""" 3159 return _Box2D.b2Pair_IsBuffered(self)
3160
3161 - def SetRemoved(self):
3162 """SetRemoved(self)""" 3163 return _Box2D.b2Pair_SetRemoved(self)
3164
3165 - def ClearRemoved(self):
3166 """ClearRemoved(self)""" 3167 return _Box2D.b2Pair_ClearRemoved(self)
3168
3169 - def IsRemoved(self):
3170 """IsRemoved(self) -> bool""" 3171 return _Box2D.b2Pair_IsRemoved(self)
3172
3173 - def SetFinal(self):
3174 """SetFinal(self)""" 3175 return _Box2D.b2Pair_SetFinal(self)
3176
3177 - def IsFinal(self):
3178 """IsFinal(self) -> bool""" 3179 return _Box2D.b2Pair_IsFinal(self)
3180 3181 proxyId1 = _swig_property(_Box2D.b2Pair_proxyId1_get, _Box2D.b2Pair_proxyId1_set) 3182 proxyId2 = _swig_property(_Box2D.b2Pair_proxyId2_get, _Box2D.b2Pair_proxyId2_set) 3183 next = _swig_property(_Box2D.b2Pair_next_get, _Box2D.b2Pair_next_set) 3184 status = _swig_property(_Box2D.b2Pair_status_get, _Box2D.b2Pair_status_set)
3185 - def __repr__(self):
3186 return """b2Pair( 3187 proxyId1 = %s, 3188 proxyId2 = %s, 3189 status = %s, 3190 userData = %s, 3191 IsBuffered() = %s, 3192 IsFinal() = %s, 3193 IsRemoved() = %s, 3194 e_pairBuffered = %s, 3195 e_pairFinal = %s, 3196 e_pairRemoved = %s)"""% tuple(str(a) for a in\ 3197 (self.proxyId1,self.proxyId2,self.status,self.userData,self.IsBuffered(),self.IsFinal(),self.IsRemoved(),self.e_pairBuffered,self.e_pairFinal,self.e_pairRemoved))
3198 3199 __getstate__=_generic_getstate 3200 __setstate__=_generic_setstate 3201
3202 - def __init__(self):
3203 """__init__(self) -> b2Pair""" 3204 _Box2D.b2Pair_swiginit(self,_Box2D.new_b2Pair())
3205 __swig_destroy__ = _Box2D.delete_b2Pair 3206 b2Pair.SetBuffered = new_instancemethod(_Box2D.b2Pair_SetBuffered,None,b2Pair) 3207 b2Pair.ClearBuffered = new_instancemethod(_Box2D.b2Pair_ClearBuffered,None,b2Pair) 3208 b2Pair.IsBuffered = new_instancemethod(_Box2D.b2Pair_IsBuffered,None,b2Pair) 3209 b2Pair.SetRemoved = new_instancemethod(_Box2D.b2Pair_SetRemoved,None,b2Pair) 3210 b2Pair.ClearRemoved = new_instancemethod(_Box2D.b2Pair_ClearRemoved,None,b2Pair) 3211 b2Pair.IsRemoved = new_instancemethod(_Box2D.b2Pair_IsRemoved,None,b2Pair) 3212 b2Pair.SetFinal = new_instancemethod(_Box2D.b2Pair_SetFinal,None,b2Pair) 3213 b2Pair.IsFinal = new_instancemethod(_Box2D.b2Pair_IsFinal,None,b2Pair) 3214 b2Pair_swigregister = _Box2D.b2Pair_swigregister 3215 b2Pair_swigregister(b2Pair) 3216 b2_nullPair = cvar.b2_nullPair 3217 b2_nullProxy = cvar.b2_nullProxy 3218 b2_tableCapacity = cvar.b2_tableCapacity 3219 b2_tableMask = cvar.b2_tableMask 3220
3221 -class b2BufferedPair(object):
3222 """Proxy of C++ b2BufferedPair class""" 3223 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3224 __repr__ = _swig_repr 3225 proxyId1 = _swig_property(_Box2D.b2BufferedPair_proxyId1_get, _Box2D.b2BufferedPair_proxyId1_set) 3226 proxyId2 = _swig_property(_Box2D.b2BufferedPair_proxyId2_get, _Box2D.b2BufferedPair_proxyId2_set)
3227 - def __repr__(self):
3228 return """b2BufferedPair( 3229 proxyId1 = %s, 3230 proxyId2 = %s)"""% tuple(str(a) for a in\ 3231 (self.proxyId1,self.proxyId2))
3232 3233 __getstate__=_generic_getstate 3234 __setstate__=_generic_setstate 3235
3236 - def __init__(self):
3237 """__init__(self) -> b2BufferedPair""" 3238 _Box2D.b2BufferedPair_swiginit(self,_Box2D.new_b2BufferedPair())
3239 __swig_destroy__ = _Box2D.delete_b2BufferedPair 3240 b2BufferedPair_swigregister = _Box2D.b2BufferedPair_swigregister 3241 b2BufferedPair_swigregister(b2BufferedPair) 3242
3243 -class b2PairCallback(object):
3244 """Proxy of C++ b2PairCallback class""" 3245 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
3246 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
3247 __repr__ = _swig_repr 3248 __swig_destroy__ = _Box2D.delete_b2PairCallback
3249 - def PairAdded(self, *args):
3250 """PairAdded(self, void proxyUserData1, void proxyUserData2) -> void""" 3251 return _Box2D.b2PairCallback_PairAdded(self, *args)
3252
3253 - def PairRemoved(self, *args):
3254 """PairRemoved(self, void proxyUserData1, void proxyUserData2, void pairUserData)""" 3255 return _Box2D.b2PairCallback_PairRemoved(self, *args)
3256
3257 - def __repr__(self):
3258 return "b2PairCallback()"
3259 3260 __getstate__=_generic_getstate 3261 __setstate__=_generic_setstate
3262 3263 b2PairCallback.PairAdded = new_instancemethod(_Box2D.b2PairCallback_PairAdded,None,b2PairCallback) 3264 b2PairCallback.PairRemoved = new_instancemethod(_Box2D.b2PairCallback_PairRemoved,None,b2PairCallback) 3265 b2PairCallback_swigregister = _Box2D.b2PairCallback_swigregister 3266 b2PairCallback_swigregister(b2PairCallback) 3267
3268 -class b2PairManager(object):
3269 """Proxy of C++ b2PairManager class""" 3270 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3271 __repr__ = _swig_repr
3272 - def __init__(self):
3273 """__init__(self) -> b2PairManager""" 3274 _Box2D.b2PairManager_swiginit(self,_Box2D.new_b2PairManager())
3275 - def Initialize(self, *args):
3276 """Initialize(self, b2BroadPhase broadPhase, b2PairCallback callback)""" 3277 return _Box2D.b2PairManager_Initialize(self, *args)
3278
3279 - def AddBufferedPair(self, *args):
3280 """AddBufferedPair(self, int32 proxyId1, int32 proxyId2)""" 3281 return _Box2D.b2PairManager_AddBufferedPair(self, *args)
3282
3283 - def RemoveBufferedPair(self, *args):
3284 """RemoveBufferedPair(self, int32 proxyId1, int32 proxyId2)""" 3285 return _Box2D.b2PairManager_RemoveBufferedPair(self, *args)
3286
3287 - def Commit(self):
3288 """Commit(self)""" 3289 return _Box2D.b2PairManager_Commit(self)
3290 3291 broadPhase = _swig_property(_Box2D.b2PairManager_broadPhase_get, _Box2D.b2PairManager_broadPhase_set) 3292 callback = _swig_property(_Box2D.b2PairManager_callback_get, _Box2D.b2PairManager_callback_set) 3293 pairs = _swig_property(_Box2D.b2PairManager_pairs_get, _Box2D.b2PairManager_pairs_set) 3294 freePair = _swig_property(_Box2D.b2PairManager_freePair_get, _Box2D.b2PairManager_freePair_set) 3295 pairCount = _swig_property(_Box2D.b2PairManager_pairCount_get, _Box2D.b2PairManager_pairCount_set) 3296 pairBuffer = _swig_property(_Box2D.b2PairManager_pairBuffer_get, _Box2D.b2PairManager_pairBuffer_set) 3297 pairBufferCount = _swig_property(_Box2D.b2PairManager_pairBufferCount_get, _Box2D.b2PairManager_pairBufferCount_set) 3298 hashTable = _swig_property(_Box2D.b2PairManager_hashTable_get, _Box2D.b2PairManager_hashTable_set)
3299 - def __repr__(self):
3300 return """b2PairManager( 3301 broadPhase = %s, 3302 callback = %s, 3303 freePair = %s, 3304 hashTable = %s, 3305 pairBuffer = %s, 3306 pairBufferCount = %s, 3307 pairCount = %s, 3308 pairs = %s)"""% tuple(str(a) for a in\ 3309 (self.broadPhase,self.callback,self.freePair,self.hashTable,self.pairBuffer,self.pairBufferCount,self.pairCount,self.pairs))
3310 3311 __getstate__=_generic_getstate 3312 __setstate__=_generic_setstate 3313 3314 __swig_destroy__ = _Box2D.delete_b2PairManager 3315 b2PairManager.Initialize = new_instancemethod(_Box2D.b2PairManager_Initialize,None,b2PairManager) 3316 b2PairManager.AddBufferedPair = new_instancemethod(_Box2D.b2PairManager_AddBufferedPair,None,b2PairManager) 3317 b2PairManager.RemoveBufferedPair = new_instancemethod(_Box2D.b2PairManager_RemoveBufferedPair,None,b2PairManager) 3318 b2PairManager.Commit = new_instancemethod(_Box2D.b2PairManager_Commit,None,b2PairManager) 3319 b2PairManager_swigregister = _Box2D.b2PairManager_swigregister 3320 b2PairManager_swigregister(b2PairManager) 3321
3322 -class b2Bound(object):
3323 """Proxy of C++ b2Bound class""" 3324 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3325 __repr__ = _swig_repr
3326 - def IsLower(self):
3327 """IsLower(self) -> bool""" 3328 return _Box2D.b2Bound_IsLower(self)
3329
3330 - def IsUpper(self):
3331 """IsUpper(self) -> bool""" 3332 return _Box2D.b2Bound_IsUpper(self)
3333 3334 value = _swig_property(_Box2D.b2Bound_value_get, _Box2D.b2Bound_value_set) 3335 proxyId = _swig_property(_Box2D.b2Bound_proxyId_get, _Box2D.b2Bound_proxyId_set) 3336 stabbingCount = _swig_property(_Box2D.b2Bound_stabbingCount_get, _Box2D.b2Bound_stabbingCount_set)
3337 - def __repr__(self):
3338 return """b2Bound( 3339 proxyId = %s, 3340 stabbingCount = %s, 3341 value = %s, 3342 IsLower() = %s, 3343 IsUpper() = %s)"""% tuple(str(a) for a in\ 3344 (self.proxyId,self.stabbingCount,self.value,self.IsLower(),self.IsUpper()))
3345 3346 __getstate__=_generic_getstate 3347 __setstate__=_generic_setstate 3348
3349 - def __init__(self):
3350 """__init__(self) -> b2Bound""" 3351 _Box2D.b2Bound_swiginit(self,_Box2D.new_b2Bound())
3352 __swig_destroy__ = _Box2D.delete_b2Bound 3353 b2Bound.IsLower = new_instancemethod(_Box2D.b2Bound_IsLower,None,b2Bound) 3354 b2Bound.IsUpper = new_instancemethod(_Box2D.b2Bound_IsUpper,None,b2Bound) 3355 b2Bound_swigregister = _Box2D.b2Bound_swigregister 3356 b2Bound_swigregister(b2Bound) 3357 b2_invalid = cvar.b2_invalid 3358 b2_nullEdge = cvar.b2_nullEdge 3359
3360 -class b2Proxy(object):
3361 """Proxy of C++ b2Proxy class""" 3362 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3363 __repr__ = _swig_repr
3364 - def GetNext(self):
3365 """GetNext(self) -> uint16""" 3366 return _Box2D.b2Proxy_GetNext(self)
3367
3368 - def SetNext(self, *args):
3369 """SetNext(self, uint16 next)""" 3370 return _Box2D.b2Proxy_SetNext(self, *args)
3371
3372 - def IsValid(self):
3373 """IsValid(self) -> bool""" 3374 return _Box2D.b2Proxy_IsValid(self)
3375 3376 lowerBounds = _swig_property(_Box2D.b2Proxy_lowerBounds_get, _Box2D.b2Proxy_lowerBounds_set) 3377 upperBounds = _swig_property(_Box2D.b2Proxy_upperBounds_get, _Box2D.b2Proxy_upperBounds_set) 3378 overlapCount = _swig_property(_Box2D.b2Proxy_overlapCount_get, _Box2D.b2Proxy_overlapCount_set) 3379 timeStamp = _swig_property(_Box2D.b2Proxy_timeStamp_get, _Box2D.b2Proxy_timeStamp_set)
3380 - def __repr__(self):
3381 return """b2Proxy( 3382 lowerBounds = %s, 3383 overlapCount = %s, 3384 timeStamp = %s, 3385 upperBounds = %s, 3386 userData = %s, 3387 IsValid() = %s)"""% tuple(str(a) for a in\ 3388 (self.lowerBounds,self.overlapCount,self.timeStamp,self.upperBounds,self.userData,self.IsValid()))
3389 3390 __getstate__=_generic_getstate 3391 __setstate__=_generic_setstate 3392
3393 - def __init__(self):
3394 """__init__(self) -> b2Proxy""" 3395 _Box2D.b2Proxy_swiginit(self,_Box2D.new_b2Proxy())
3396 __swig_destroy__ = _Box2D.delete_b2Proxy 3397 b2Proxy.GetNext = new_instancemethod(_Box2D.b2Proxy_GetNext,None,b2Proxy) 3398 b2Proxy.SetNext = new_instancemethod(_Box2D.b2Proxy_SetNext,None,b2Proxy) 3399 b2Proxy.IsValid = new_instancemethod(_Box2D.b2Proxy_IsValid,None,b2Proxy) 3400 b2Proxy_swigregister = _Box2D.b2Proxy_swigregister 3401 b2Proxy_swigregister(b2Proxy) 3402
3403 -class b2BroadPhase(object):
3404 """Proxy of C++ b2BroadPhase class""" 3405 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3406 __repr__ = _swig_repr
3407 - def __init__(self, *args):
3408 """__init__(self, b2AABB worldAABB, b2PairCallback callback) -> b2BroadPhase""" 3409 _Box2D.b2BroadPhase_swiginit(self,_Box2D.new_b2BroadPhase(*args))
3410 __swig_destroy__ = _Box2D.delete_b2BroadPhase
3411 - def InRange(self, *args):
3412 """InRange(self, b2AABB aabb) -> bool""" 3413 return _Box2D.b2BroadPhase_InRange(self, *args)
3414
3415 - def CreateProxy(self, *args):
3416 """CreateProxy(self, b2AABB aabb, void $ignore) -> uint16""" 3417 return _Box2D.b2BroadPhase_CreateProxy(self, *args)
3418
3419 - def DestroyProxy(self, *args):
3420 """DestroyProxy(self, int32 proxyId)""" 3421 return _Box2D.b2BroadPhase_DestroyProxy(self, *args)
3422
3423 - def MoveProxy(self, *args):
3424 """MoveProxy(self, int32 proxyId, b2AABB aabb)""" 3425 return _Box2D.b2BroadPhase_MoveProxy(self, *args)
3426
3427 - def Commit(self):
3428 """Commit(self)""" 3429 return _Box2D.b2BroadPhase_Commit(self)
3430
3431 - def GetProxy(self, *args):
3432 """GetProxy(self, int32 proxyId) -> b2Proxy""" 3433 return _Box2D.b2BroadPhase_GetProxy(self, *args)
3434
3435 - def Query(self, *args):
3436 """Query(self, b2AABB aabb, void $ignore, int32 maxCount) -> int32""" 3437 return _Box2D.b2BroadPhase_Query(self, *args)
3438
3439 - def QuerySegment(self, *args):
3440 """QuerySegment(self, b2Segment segment, void $ignore, int32 maxCount, SortKeyFunc sortKey) -> int32""" 3441 return _Box2D.b2BroadPhase_QuerySegment(self, *args)
3442
3443 - def Validate(self):
3444 """Validate(self)""" 3445 return _Box2D.b2BroadPhase_Validate(self)
3446
3447 - def ValidatePairs(self):
3448 """ValidatePairs(self)""" 3449 return _Box2D.b2BroadPhase_ValidatePairs(self)
3450 3451 pairManager = _swig_property(_Box2D.b2BroadPhase_pairManager_get, _Box2D.b2BroadPhase_pairManager_set) 3452 proxyPool = _swig_property(_Box2D.b2BroadPhase_proxyPool_get, _Box2D.b2BroadPhase_proxyPool_set) 3453 freeProxy = _swig_property(_Box2D.b2BroadPhase_freeProxy_get, _Box2D.b2BroadPhase_freeProxy_set) 3454 bounds = _swig_property(_Box2D.b2BroadPhase_bounds_get, _Box2D.b2BroadPhase_bounds_set) 3455 queryResults = _swig_property(_Box2D.b2BroadPhase_queryResults_get, _Box2D.b2BroadPhase_queryResults_set) 3456 querySortKeys = _swig_property(_Box2D.b2BroadPhase_querySortKeys_get, _Box2D.b2BroadPhase_querySortKeys_set) 3457 queryResultCount = _swig_property(_Box2D.b2BroadPhase_queryResultCount_get, _Box2D.b2BroadPhase_queryResultCount_set) 3458 worldAABB = _swig_property(_Box2D.b2BroadPhase_worldAABB_get, _Box2D.b2BroadPhase_worldAABB_set) 3459 quantizationFactor = _swig_property(_Box2D.b2BroadPhase_quantizationFactor_get, _Box2D.b2BroadPhase_quantizationFactor_set) 3460 proxyCount = _swig_property(_Box2D.b2BroadPhase_proxyCount_get, _Box2D.b2BroadPhase_proxyCount_set) 3461 timeStamp = _swig_property(_Box2D.b2BroadPhase_timeStamp_get, _Box2D.b2BroadPhase_timeStamp_set) 3462 s_validate = _swig_property(_Box2D.b2BroadPhase_s_validate_get, _Box2D.b2BroadPhase_s_validate_set)
3463 - def __repr__(self):
3464 return """b2BroadPhase( 3465 bounds = %s, 3466 freeProxy = %s, 3467 pairManager = %s, 3468 proxyCount = %s, 3469 proxyPool = %s, 3470 quantizationFactor = %s, 3471 queryResultCount = %s, 3472 queryResults = %s, 3473 querySortKeys = %s, 3474 s_validate = %s, 3475 timeStamp = %s, 3476 worldAABB = %s)"""% tuple(str(a) for a in\ 3477 (self.bounds,self.freeProxy,self.pairManager,self.proxyCount,self.proxyPool,self.quantizationFactor,self.queryResultCount,self.queryResults,self.querySortKeys,self.s_validate,self.timeStamp,self.worldAABB))
3478 3479 __getstate__=_generic_getstate 3480 __setstate__=_generic_setstate 3481 3482 b2BroadPhase.InRange = new_instancemethod(_Box2D.b2BroadPhase_InRange,None,b2BroadPhase) 3483 b2BroadPhase.CreateProxy = new_instancemethod(_Box2D.b2BroadPhase_CreateProxy,None,b2BroadPhase) 3484 b2BroadPhase.DestroyProxy = new_instancemethod(_Box2D.b2BroadPhase_DestroyProxy,None,b2BroadPhase) 3485 b2BroadPhase.MoveProxy = new_instancemethod(_Box2D.b2BroadPhase_MoveProxy,None,b2BroadPhase) 3486 b2BroadPhase.Commit = new_instancemethod(_Box2D.b2BroadPhase_Commit,None,b2BroadPhase) 3487 b2BroadPhase.GetProxy = new_instancemethod(_Box2D.b2BroadPhase_GetProxy,None,b2BroadPhase) 3488 b2BroadPhase.Query = new_instancemethod(_Box2D.b2BroadPhase_Query,None,b2BroadPhase) 3489 b2BroadPhase.QuerySegment = new_instancemethod(_Box2D.b2BroadPhase_QuerySegment,None,b2BroadPhase) 3490 b2BroadPhase.Validate = new_instancemethod(_Box2D.b2BroadPhase_Validate,None,b2BroadPhase) 3491 b2BroadPhase.ValidatePairs = new_instancemethod(_Box2D.b2BroadPhase_ValidatePairs,None,b2BroadPhase) 3492 b2BroadPhase_swigregister = _Box2D.b2BroadPhase_swigregister 3493 b2BroadPhase_swigregister(b2BroadPhase) 3494
3495 -class b2DestructionListener(object):
3496 """Joints and shapes are destroyed when their associated body is destroyed. Implement this listener so that you may nullify references to these joints and shapes.""" 3497 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3498 __repr__ = _swig_repr 3499 __swig_destroy__ = _Box2D.delete_b2DestructionListener
3500 - def SayGoodbye(self, *args):
3501 """ 3502 SayGoodbye(self, b2Joint joint) 3503 SayGoodbye(self, b2Shape shape) 3504 3505 Called when any shape is about to be destroyed due to the destruction of its parent body. 3506 """ 3507 return _Box2D.b2DestructionListener_SayGoodbye(self, *args)
3508
3509 - def __repr__(self):
3510 return "b2DestructionListener()"
3511 3512 __getstate__=_generic_getstate 3513 __setstate__=_generic_setstate 3514
3515 - def __init__(self):
3516 """__init__(self) -> b2DestructionListener""" 3517 if self.__class__ == b2DestructionListener: 3518 _self = None 3519 else: 3520 _self = self 3521 _Box2D.b2DestructionListener_swiginit(self,_Box2D.new_b2DestructionListener(_self, ))
3522 - def __disown__(self):
3523 self.this.disown() 3524 _Box2D.disown_b2DestructionListener(self) 3525 return weakref_proxy(self)
3526 b2DestructionListener.SayGoodbye = new_instancemethod(_Box2D.b2DestructionListener_SayGoodbye,None,b2DestructionListener) 3527 b2DestructionListener_swigregister = _Box2D.b2DestructionListener_swigregister 3528 b2DestructionListener_swigregister(b2DestructionListener) 3529
3530 -class b2BoundaryListener(object):
3531 """This is called when a body's shape passes outside of the world boundary.""" 3532 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3533 __repr__ = _swig_repr 3534 __swig_destroy__ = _Box2D.delete_b2BoundaryListener
3535 - def Violation(self, *args):
3536 """ 3537 Violation(self, b2Body body) 3538 3539 This is called for each body that leaves the world boundary. 3540 WARNING: 3541 you can't modify the world inside this callback. 3542 """ 3543 return _Box2D.b2BoundaryListener_Violation(self, *args)
3544
3545 - def __repr__(self):
3546 return "b2BoundaryListener()"
3547 3548 __getstate__=_generic_getstate 3549 __setstate__=_generic_setstate 3550
3551 - def __init__(self):
3552 """__init__(self) -> b2BoundaryListener""" 3553 if self.__class__ == b2BoundaryListener: 3554 _self = None 3555 else: 3556 _self = self 3557 _Box2D.b2BoundaryListener_swiginit(self,_Box2D.new_b2BoundaryListener(_self, ))
3558 - def __disown__(self):
3559 self.this.disown() 3560 _Box2D.disown_b2BoundaryListener(self) 3561 return weakref_proxy(self)
3562 b2BoundaryListener.Violation = new_instancemethod(_Box2D.b2BoundaryListener_Violation,None,b2BoundaryListener) 3563 b2BoundaryListener_swigregister = _Box2D.b2BoundaryListener_swigregister 3564 b2BoundaryListener_swigregister(b2BoundaryListener) 3565
3566 -class b2ContactFilter(object):
3567 """Implement this class to provide collision filtering. In other words, you can implement this class if you want finer control over contact creation.""" 3568 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3569 __repr__ = _swig_repr 3570 __swig_destroy__ = _Box2D.delete_b2ContactFilter
3571 - def ShouldCollide(self, *args):
3572 """ 3573 ShouldCollide(self, b2Shape shape1, b2Shape shape2) -> bool 3574 3575 Return true if contact calculations should be performed between these two shapes. 3576 WARNING: 3577 for performance reasons this is only called when the AABBs begin to overlap. 3578 """ 3579 return _Box2D.b2ContactFilter_ShouldCollide(self, *args)
3580
3581 - def RayCollide(self, *args):
3582 """ 3583 RayCollide(self, void $ignore, b2Shape b2Shape) -> bool 3584 3585 Return true if the given shape should be considered for ray intersection. 3586 """ 3587 return _Box2D.b2ContactFilter_RayCollide(self, *args)
3588
3589 - def __repr__(self):
3590 return "b2ContactFilter()"
3591 3592 __getstate__=_generic_getstate 3593 __setstate__=_generic_setstate 3594
3595 - def __init__(self):
3596 """__init__(self) -> b2ContactFilter""" 3597 if self.__class__ == b2ContactFilter: 3598 _self = None 3599 else: 3600 _self = self 3601 _Box2D.b2ContactFilter_swiginit(self,_Box2D.new_b2ContactFilter(_self, ))
3602 - def __disown__(self):
3603 self.this.disown() 3604 _Box2D.disown_b2ContactFilter(self) 3605 return weakref_proxy(self)
3606 b2ContactFilter.ShouldCollide = new_instancemethod(_Box2D.b2ContactFilter_ShouldCollide,None,b2ContactFilter) 3607 b2ContactFilter.RayCollide = new_instancemethod(_Box2D.b2ContactFilter_RayCollide,None,b2ContactFilter) 3608 b2ContactFilter_swigregister = _Box2D.b2ContactFilter_swigregister 3609 b2ContactFilter_swigregister(b2ContactFilter) 3610
3611 -class b2ContactListener(object):
3612 """ 3613 Implement this class to get collision results. You can use these results for things like sounds and game logic. You can also get contact results by traversing the contact lists after the time step. However, you might miss some contacts because continuous physics leads to sub-stepping. Additionally you may receive multiple callbacks for the same contact in a single time step. You should strive to make your callbacks efficient because there may be many callbacks per time step. 3614 WARNING: 3615 The contact separation is the last computed value. 3616 3617 You cannot create/destroy Box2D entities inside these callbacks. 3618 """ 3619 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3620 __repr__ = _swig_repr 3621 __swig_destroy__ = _Box2D.delete_b2ContactListener
3622 - def Add(self, *args):
3623 """ 3624 Add(self, b2ContactPoint point) 3625 3626 Called when a contact point is added. This includes the geometry and the forces. 3627 """ 3628 return _Box2D.b2ContactListener_Add(self, *args)
3629
3630 - def Persist(self, *args):
3631 """ 3632 Persist(self, b2ContactPoint point) 3633 3634 Called when a contact point persists. This includes the geometry and the forces. 3635 """ 3636 return _Box2D.b2ContactListener_Persist(self, *args)
3637
3638 - def Remove(self, *args):
3639 """ 3640 Remove(self, b2ContactPoint point) 3641 3642 Called when a contact point is removed. This includes the last computed geometry and forces. 3643 """ 3644 return _Box2D.b2ContactListener_Remove(self, *args)
3645
3646 - def Result(self, *args):
3647 """ 3648 Result(self, b2ContactResult point) 3649 3650 Called after a contact point is solved. 3651 """ 3652 return _Box2D.b2ContactListener_Result(self, *args)
3653
3654 - def __repr__(self):
3655 return "b2ContactListener()"
3656 3657 __getstate__=_generic_getstate 3658 __setstate__=_generic_setstate 3659
3660 - def __init__(self):
3661 """__init__(self) -> b2ContactListener""" 3662 if self.__class__ == b2ContactListener: 3663 _self = None 3664 else: 3665 _self = self 3666 _Box2D.b2ContactListener_swiginit(self,_Box2D.new_b2ContactListener(_self, ))
3667 - def __disown__(self):
3668 self.this.disown() 3669 _Box2D.disown_b2ContactListener(self) 3670 return weakref_proxy(self)
3671 b2ContactListener.Add = new_instancemethod(_Box2D.b2ContactListener_Add,None,b2ContactListener) 3672 b2ContactListener.Persist = new_instancemethod(_Box2D.b2ContactListener_Persist,None,b2ContactListener) 3673 b2ContactListener.Remove = new_instancemethod(_Box2D.b2ContactListener_Remove,None,b2ContactListener) 3674 b2ContactListener.Result = new_instancemethod(_Box2D.b2ContactListener_Result,None,b2ContactListener) 3675 b2ContactListener_swigregister = _Box2D.b2ContactListener_swigregister 3676 b2ContactListener_swigregister(b2ContactListener) 3677
3678 -class b2Color(object):
3679 """Color for debug drawing. Each value has the range [0,1].""" 3680 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3681 __repr__ = _swig_repr
3682 - def __init__(self, *args):
3683 """ 3684 __init__(self) -> b2Color 3685 __init__(self, float32 r, float32 g, float32 b) -> b2Color 3686 3687 Color for debug drawing. Each value has the range [0,1]. 3688 """ 3689 _Box2D.b2Color_swiginit(self,_Box2D.new_b2Color(*args))
3690 r = _swig_property(_Box2D.b2Color_r_get, _Box2D.b2Color_r_set) 3691 g = _swig_property(_Box2D.b2Color_g_get, _Box2D.b2Color_g_set) 3692 b = _swig_property(_Box2D.b2Color_b_get, _Box2D.b2Color_b_set)
3693 - def __repr__(self):
3694 return """b2Color( 3695 b = %s, 3696 g = %s, 3697 r = %s)"""% tuple(str(a) for a in\ 3698 (self.b,self.g,self.r))
3699 3700 __getstate__=_generic_getstate 3701 __setstate__=_generic_setstate 3702 3703 __swig_destroy__ = _Box2D.delete_b2Color 3704 b2Color_swigregister = _Box2D.b2Color_swigregister 3705 b2Color_swigregister(b2Color) 3706
3707 -class b2DebugDraw(object):
3708 """Implement and register this class with a b2Worldto provide debug drawing of physics entities in your game.""" 3709 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3710 __repr__ = _swig_repr
3711 - def __init__(self):
3712 """ 3713 __init__(self) -> b2DebugDraw 3714 3715 Implement and register this class with a b2Worldto provide debug drawing of physics entities in your game. 3716 """ 3717 if self.__class__ == b2DebugDraw: 3718 _self = None 3719 else: 3720 _self = self 3721 _Box2D.b2DebugDraw_swiginit(self,_Box2D.new_b2DebugDraw(_self, ))
3722 __swig_destroy__ = _Box2D.delete_b2DebugDraw 3723 e_shapeBit = _Box2D.b2DebugDraw_e_shapeBit 3724 e_jointBit = _Box2D.b2DebugDraw_e_jointBit 3725 e_coreShapeBit = _Box2D.b2DebugDraw_e_coreShapeBit 3726 e_aabbBit = _Box2D.b2DebugDraw_e_aabbBit 3727 e_obbBit = _Box2D.b2DebugDraw_e_obbBit 3728 e_pairBit = _Box2D.b2DebugDraw_e_pairBit 3729 e_centerOfMassBit = _Box2D.b2DebugDraw_e_centerOfMassBit 3730 e_controllerBit = _Box2D.b2DebugDraw_e_controllerBit
3731 - def SetFlags(self, *args):
3732 """ 3733 SetFlags(self, uint32 flags) 3734 3735 Set the drawing flags. 3736 """ 3737 return _Box2D.b2DebugDraw_SetFlags(self, *args)
3738
3739 - def GetFlags(self):
3740 """ 3741 GetFlags(self) -> uint32 3742 3743 Get the drawing flags. 3744 """ 3745 return _Box2D.b2DebugDraw_GetFlags(self)
3746
3747 - def AppendFlags(self, *args):
3748 """ 3749 AppendFlags(self, uint32 flags) 3750 3751 Append flags to the current flags. 3752 """ 3753 return _Box2D.b2DebugDraw_AppendFlags(self, *args)
3754
3755 - def ClearFlags(self, *args):
3756 """ 3757 ClearFlags(self, uint32 flags) 3758 3759 Clear flags from the current flags. 3760 """ 3761 return _Box2D.b2DebugDraw_ClearFlags(self, *args)
3762
3763 - def DrawPolygon(self, *args):
3764 """ 3765 DrawPolygon(self, b2Vec2 vertices, int32 vertexCount, b2Color color) 3766 3767 Draw a closed polygon provided in CCW order. 3768 """ 3769 return _Box2D.b2DebugDraw_DrawPolygon(self, *args)
3770
3771 - def DrawSolidPolygon(self, *args):
3772 """ 3773 DrawSolidPolygon(self, b2Vec2 vertices, int32 vertexCount, b2Color color) 3774 3775 Draw a solid closed polygon provided in CCW order. 3776 """ 3777 return _Box2D.b2DebugDraw_DrawSolidPolygon(self, *args)
3778
3779 - def DrawCircle(self, *args):
3780 """ 3781 DrawCircle(self, b2Vec2 center, float32 radius, b2Color color) 3782 3783 Draw a circle. 3784 """ 3785 return _Box2D.b2DebugDraw_DrawCircle(self, *args)
3786
3787 - def DrawSolidCircle(self, *args):
3788 """ 3789 DrawSolidCircle(self, b2Vec2 center, float32 radius, b2Vec2 axis, b2Color color) 3790 3791 Draw a solid circle. 3792 """ 3793 return _Box2D.b2DebugDraw_DrawSolidCircle(self, *args)
3794
3795 - def DrawSegment(self, *args):
3796 """ 3797 DrawSegment(self, b2Vec2 p1, b2Vec2 p2, b2Color color) 3798 3799 Draw a line segment. 3800 """ 3801 return _Box2D.b2DebugDraw_DrawSegment(self, *args)
3802
3803 - def DrawXForm(self, *args):
3804 """ 3805 DrawXForm(self, b2XForm xf) 3806 3807 Draw a transform. Choose your own length scale. 3808 3809 Parameters: 3810 ----------- 3811 3812 xf: a transform. 3813 """ 3814 return _Box2D.b2DebugDraw_DrawXForm(self, *args)
3815
3816 - def __repr__(self):
3817 return """b2DebugDraw( 3818 GetFlags() = %s, 3819 e_aabbBit = %s, 3820 e_centerOfMassBit = %s, 3821 e_controllerBit = %s, 3822 e_coreShapeBit = %s, 3823 e_jointBit = %s, 3824 e_obbBit = %s, 3825 e_pairBit = %s, 3826 e_shapeBit = %s)"""% tuple(str(a) for a in\ 3827 (self.GetFlags(),self.e_aabbBit,self.e_centerOfMassBit,self.e_controllerBit,self.e_coreShapeBit,self.e_jointBit,self.e_obbBit,self.e_pairBit,self.e_shapeBit))
3828 3829 __getstate__=_generic_getstate 3830 __setstate__=_generic_setstate 3831
3832 - def __disown__(self):
3833 self.this.disown() 3834 _Box2D.disown_b2DebugDraw(self) 3835 return weakref_proxy(self)
3836 b2DebugDraw.SetFlags = new_instancemethod(_Box2D.b2DebugDraw_SetFlags,None,b2DebugDraw) 3837 b2DebugDraw.GetFlags = new_instancemethod(_Box2D.b2DebugDraw_GetFlags,None,b2DebugDraw) 3838 b2DebugDraw.AppendFlags = new_instancemethod(_Box2D.b2DebugDraw_AppendFlags,None,b2DebugDraw) 3839 b2DebugDraw.ClearFlags = new_instancemethod(_Box2D.b2DebugDraw_ClearFlags,None,b2DebugDraw) 3840 b2DebugDraw.DrawPolygon = new_instancemethod(_Box2D.b2DebugDraw_DrawPolygon,None,b2DebugDraw) 3841 b2DebugDraw.DrawSolidPolygon = new_instancemethod(_Box2D.b2DebugDraw_DrawSolidPolygon,None,b2DebugDraw) 3842 b2DebugDraw.DrawCircle = new_instancemethod(_Box2D.b2DebugDraw_DrawCircle,None,b2DebugDraw) 3843 b2DebugDraw.DrawSolidCircle = new_instancemethod(_Box2D.b2DebugDraw_DrawSolidCircle,None,b2DebugDraw) 3844 b2DebugDraw.DrawSegment = new_instancemethod(_Box2D.b2DebugDraw_DrawSegment,None,b2DebugDraw) 3845 b2DebugDraw.DrawXForm = new_instancemethod(_Box2D.b2DebugDraw_DrawXForm,None,b2DebugDraw) 3846 b2DebugDraw_swigregister = _Box2D.b2DebugDraw_swigregister 3847 b2DebugDraw_swigregister(b2DebugDraw) 3848
3849 -class b2BlockAllocator(object):
3850 """Proxy of C++ b2BlockAllocator class""" 3851 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3852 __repr__ = _swig_repr
3853 - def __init__(self):
3854 """__init__(self) -> b2BlockAllocator""" 3855 _Box2D.b2BlockAllocator_swiginit(self,_Box2D.new_b2BlockAllocator())
3856 __swig_destroy__ = _Box2D.delete_b2BlockAllocator
3857 - def Allocate(self, *args):
3858 """Allocate(self, int32 size) -> void""" 3859 return _Box2D.b2BlockAllocator_Allocate(self, *args)
3860
3861 - def Free(self, *args):
3862 """Free(self, void p, int32 size)""" 3863 return _Box2D.b2BlockAllocator_Free(self, *args)
3864
3865 - def Clear(self):
3866 """Clear(self)""" 3867 return _Box2D.b2BlockAllocator_Clear(self)
3868
3869 - def __repr__(self):
3870 return "b2BlockAllocator()"
3871 3872 __getstate__=_generic_getstate 3873 __setstate__=_generic_setstate 3874 3875 b2BlockAllocator.Allocate = new_instancemethod(_Box2D.b2BlockAllocator_Allocate,None,b2BlockAllocator) 3876 b2BlockAllocator.Free = new_instancemethod(_Box2D.b2BlockAllocator_Free,None,b2BlockAllocator) 3877 b2BlockAllocator.Clear = new_instancemethod(_Box2D.b2BlockAllocator_Clear,None,b2BlockAllocator) 3878 b2BlockAllocator_swigregister = _Box2D.b2BlockAllocator_swigregister 3879 b2BlockAllocator_swigregister(b2BlockAllocator) 3880 b2_chunkSize = cvar.b2_chunkSize 3881 b2_maxBlockSize = cvar.b2_maxBlockSize 3882 b2_blockSizes = cvar.b2_blockSizes 3883 b2_chunkArrayIncrement = cvar.b2_chunkArrayIncrement 3884
3885 -class b2StackEntry(object):
3886 """Proxy of C++ b2StackEntry class""" 3887 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3888 __repr__ = _swig_repr 3889 data = _swig_property(_Box2D.b2StackEntry_data_get, _Box2D.b2StackEntry_data_set) 3890 size = _swig_property(_Box2D.b2StackEntry_size_get, _Box2D.b2StackEntry_size_set) 3891 usedMalloc = _swig_property(_Box2D.b2StackEntry_usedMalloc_get, _Box2D.b2StackEntry_usedMalloc_set)
3892 - def __repr__(self):
3893 return """b2StackEntry( 3894 data = %s, 3895 size = %s, 3896 usedMalloc = %s)"""% tuple(str(a) for a in\ 3897 (self.data,self.size,self.usedMalloc))
3898 3899 __getstate__=_generic_getstate 3900 __setstate__=_generic_setstate 3901
3902 - def __init__(self):
3903 """__init__(self) -> b2StackEntry""" 3904 _Box2D.b2StackEntry_swiginit(self,_Box2D.new_b2StackEntry())
3905 __swig_destroy__ = _Box2D.delete_b2StackEntry 3906 b2StackEntry_swigregister = _Box2D.b2StackEntry_swigregister 3907 b2StackEntry_swigregister(b2StackEntry) 3908 b2_stackSize = cvar.b2_stackSize 3909 b2_maxStackEntries = cvar.b2_maxStackEntries 3910
3911 -class b2StackAllocator(object):
3912 """Proxy of C++ b2StackAllocator class""" 3913 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3914 __repr__ = _swig_repr
3915 - def __init__(self):
3916 """__init__(self) -> b2StackAllocator""" 3917 _Box2D.b2StackAllocator_swiginit(self,_Box2D.new_b2StackAllocator())
3918 __swig_destroy__ = _Box2D.delete_b2StackAllocator
3919 - def Allocate(self, *args):
3920 """Allocate(self, int32 size) -> void""" 3921 return _Box2D.b2StackAllocator_Allocate(self, *args)
3922
3923 - def Free(self, *args):
3924 """Free(self, void p)""" 3925 return _Box2D.b2StackAllocator_Free(self, *args)
3926
3927 - def GetMaxAllocation(self):
3928 """GetMaxAllocation(self) -> int32""" 3929 return _Box2D.b2StackAllocator_GetMaxAllocation(self)
3930
3931 - def __repr__(self):
3932 return """b2StackAllocator( 3933 GetMaxAllocation() = %s)"""% tuple(str(a) for a in\ 3934 (self.GetMaxAllocation()))
3935 3936 __getstate__=_generic_getstate 3937 __setstate__=_generic_setstate 3938 3939 b2StackAllocator.Allocate = new_instancemethod(_Box2D.b2StackAllocator_Allocate,None,b2StackAllocator) 3940 b2StackAllocator.Free = new_instancemethod(_Box2D.b2StackAllocator_Free,None,b2StackAllocator) 3941 b2StackAllocator.GetMaxAllocation = new_instancemethod(_Box2D.b2StackAllocator_GetMaxAllocation,None,b2StackAllocator) 3942 b2StackAllocator_swigregister = _Box2D.b2StackAllocator_swigregister 3943 b2StackAllocator_swigregister(b2StackAllocator) 3944
3945 -class b2ContactRegister(object):
3946 """Proxy of C++ b2ContactRegister class""" 3947 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3948 __repr__ = _swig_repr 3949 createFcn = _swig_property(_Box2D.b2ContactRegister_createFcn_get, _Box2D.b2ContactRegister_createFcn_set) 3950 destroyFcn = _swig_property(_Box2D.b2ContactRegister_destroyFcn_get, _Box2D.b2ContactRegister_destroyFcn_set) 3951 primary = _swig_property(_Box2D.b2ContactRegister_primary_get, _Box2D.b2ContactRegister_primary_set)
3952 - def __repr__(self):
3953 return """b2ContactRegister( 3954 createFcn = %s, 3955 destroyFcn = %s, 3956 primary = %s)"""% tuple(str(a) for a in\ 3957 (self.createFcn,self.destroyFcn,self.primary))
3958 3959 __getstate__=_generic_getstate 3960 __setstate__=_generic_setstate 3961
3962 - def __init__(self):
3963 """__init__(self) -> b2ContactRegister""" 3964 _Box2D.b2ContactRegister_swiginit(self,_Box2D.new_b2ContactRegister())
3965 __swig_destroy__ = _Box2D.delete_b2ContactRegister 3966 b2ContactRegister_swigregister = _Box2D.b2ContactRegister_swigregister 3967 b2ContactRegister_swigregister(b2ContactRegister) 3968
3969 -class b2ContactEdge(object):
3970 """A contact edge is used to connect bodies and contacts together in a contact graph where each body is a node and each contact is an edge. A contact edge belongs to a doubly linked list maintained in each attached body. Each contact has two contact nodes, one for each attached body.""" 3971 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3972 __repr__ = _swig_repr 3973 other = _swig_property(_Box2D.b2ContactEdge_other_get, _Box2D.b2ContactEdge_other_set) 3974 contact = _swig_property(_Box2D.b2ContactEdge_contact_get, _Box2D.b2ContactEdge_contact_set) 3975 prev = _swig_property(_Box2D.b2ContactEdge_prev_get, _Box2D.b2ContactEdge_prev_set) 3976 next = _swig_property(_Box2D.b2ContactEdge_next_get, _Box2D.b2ContactEdge_next_set)
3977 - def __repr__(self):
3978 return """b2ContactEdge( 3979 contact = %s, 3980 other = %s)"""% tuple(str(a) for a in\ 3981 (self.contact,self.other))
3982 3983 __getstate__=_generic_getstate 3984 __setstate__=_generic_setstate 3985
3986 - def __init__(self):
3987 """__init__(self) -> b2ContactEdge""" 3988 _Box2D.b2ContactEdge_swiginit(self,_Box2D.new_b2ContactEdge())
3989 __swig_destroy__ = _Box2D.delete_b2ContactEdge 3990 b2ContactEdge_swigregister = _Box2D.b2ContactEdge_swigregister 3991 b2ContactEdge_swigregister(b2ContactEdge) 3992
3993 -class b2ContactPoint(object):
3994 """This structure is used to report contact points.""" 3995 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 3996 __repr__ = _swig_repr 3997 shape1 = _swig_property(_Box2D.b2ContactPoint_shape1_get, _Box2D.b2ContactPoint_shape1_set) 3998 shape2 = _swig_property(_Box2D.b2ContactPoint_shape2_get, _Box2D.b2ContactPoint_shape2_set) 3999 position = _swig_property(_Box2D.b2ContactPoint_position_get, _Box2D.b2ContactPoint_position_set) 4000 velocity = _swig_property(_Box2D.b2ContactPoint_velocity_get, _Box2D.b2ContactPoint_velocity_set) 4001 normal = _swig_property(_Box2D.b2ContactPoint_normal_get, _Box2D.b2ContactPoint_normal_set) 4002 separation = _swig_property(_Box2D.b2ContactPoint_separation_get, _Box2D.b2ContactPoint_separation_set) 4003 friction = _swig_property(_Box2D.b2ContactPoint_friction_get, _Box2D.b2ContactPoint_friction_set) 4004 restitution = _swig_property(_Box2D.b2ContactPoint_restitution_get, _Box2D.b2ContactPoint_restitution_set) 4005 id = _swig_property(_Box2D.b2ContactPoint_id_get, _Box2D.b2ContactPoint_id_set)
4006 - def __repr__(self):
4007 return """b2ContactPoint( 4008 friction = %s, 4009 id = %s, 4010 normal = %s, 4011 position = %s, 4012 restitution = %s, 4013 separation = %s, 4014 shape1 = %s, 4015 shape2 = %s, 4016 velocity = %s)"""% tuple(str(a) for a in\ 4017 (self.friction,self.id,self.normal,self.position,self.restitution,self.separation,self.shape1,self.shape2,self.velocity))
4018 4019 __getstate__=_generic_getstate 4020 __setstate__=_generic_setstate 4021
4022 - def __init__(self):
4023 """__init__(self) -> b2ContactPoint""" 4024 _Box2D.b2ContactPoint_swiginit(self,_Box2D.new_b2ContactPoint())
4025 __swig_destroy__ = _Box2D.delete_b2ContactPoint 4026 b2ContactPoint_swigregister = _Box2D.b2ContactPoint_swigregister 4027 b2ContactPoint_swigregister(b2ContactPoint) 4028
4029 -class b2ContactResult(object):
4030 """This structure is used to report contact point results.""" 4031 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4032 __repr__ = _swig_repr 4033 shape1 = _swig_property(_Box2D.b2ContactResult_shape1_get, _Box2D.b2ContactResult_shape1_set) 4034 shape2 = _swig_property(_Box2D.b2ContactResult_shape2_get, _Box2D.b2ContactResult_shape2_set) 4035 position = _swig_property(_Box2D.b2ContactResult_position_get, _Box2D.b2ContactResult_position_set) 4036 normal = _swig_property(_Box2D.b2ContactResult_normal_get, _Box2D.b2ContactResult_normal_set) 4037 normalImpulse = _swig_property(_Box2D.b2ContactResult_normalImpulse_get, _Box2D.b2ContactResult_normalImpulse_set) 4038 tangentImpulse = _swig_property(_Box2D.b2ContactResult_tangentImpulse_get, _Box2D.b2ContactResult_tangentImpulse_set) 4039 id = _swig_property(_Box2D.b2ContactResult_id_get, _Box2D.b2ContactResult_id_set)
4040 - def __repr__(self):
4041 return """b2ContactResult( 4042 id = %s, 4043 normal = %s, 4044 normalImpulse = %s, 4045 position = %s, 4046 shape1 = %s, 4047 shape2 = %s, 4048 tangentImpulse = %s)"""% tuple(str(a) for a in\ 4049 (self.id,self.normal,self.normalImpulse,self.position,self.shape1,self.shape2,self.tangentImpulse))
4050 4051 __getstate__=_generic_getstate 4052 __setstate__=_generic_setstate 4053
4054 - def __init__(self):
4055 """__init__(self) -> b2ContactResult""" 4056 _Box2D.b2ContactResult_swiginit(self,_Box2D.new_b2ContactResult())
4057 __swig_destroy__ = _Box2D.delete_b2ContactResult 4058 b2ContactResult_swigregister = _Box2D.b2ContactResult_swigregister 4059 b2ContactResult_swigregister(b2ContactResult) 4060
4061 -class b2Contact(object):
4062 """The class manages contact between two shapes. A contact exists for each overlapping AABB in the broad-phase (except if filtered). Therefore a contact object may exist that has no contact points.""" 4063 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
4064 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
4065 __repr__ = _swig_repr
4066 - def GetManifolds(self):
4067 """ 4068 GetManifolds(self) -> b2Manifold 4069 4070 Get the manifold array. 4071 """ 4072 return _Box2D.b2Contact_GetManifolds(self)
4073
4074 - def GetManifoldCount(self):
4075 """ 4076 GetManifoldCount(self) -> int32 4077 4078 Get the number of manifolds. This is 0 or 1 between convex shapes. This may be greater than 1 for convex-vs-concave shapes. Each manifold holds up to two contact points with a shared contact normal. 4079 """ 4080 return _Box2D.b2Contact_GetManifoldCount(self)
4081
4082 - def IsSolid(self):
4083 """ 4084 IsSolid(self) -> bool 4085 4086 Is this contact solid? 4087 true if this contact should generate a response. 4088 """ 4089 return _Box2D.b2Contact_IsSolid(self)
4090
4091 - def GetNext(self):
4092 """ 4093 GetNext(self) -> b2Contact 4094 4095 Get the next contact in the world's contact list. 4096 """ 4097 return _Box2D.b2Contact_GetNext(self)
4098
4099 - def GetShape1(self):
4100 """ 4101 GetShape1(self) -> b2Shape 4102 4103 Get the first shape in this contact. 4104 """ 4105 return _Box2D.b2Contact_GetShape1(self)
4106
4107 - def GetShape2(self):
4108 """ 4109 GetShape2(self) -> b2Shape 4110 4111 Get the second shape in this contact. 4112 """ 4113 return _Box2D.b2Contact_GetShape2(self)
4114 4115 e_nonSolidFlag = _Box2D.b2Contact_e_nonSolidFlag 4116 e_slowFlag = _Box2D.b2Contact_e_slowFlag 4117 e_islandFlag = _Box2D.b2Contact_e_islandFlag 4118 e_toiFlag = _Box2D.b2Contact_e_toiFlag
4119 - def AddType(*args):
4120 """ 4121 AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destroyFcn, 4122 b2ShapeType type1, b2ShapeType type2) 4123 """ 4124 return _Box2D.b2Contact_AddType(*args)
4125 4126 AddType = staticmethod(AddType)
4127 - def InitializeRegisters():
4128 """InitializeRegisters()""" 4129 return _Box2D.b2Contact_InitializeRegisters()
4130 4131 InitializeRegisters = staticmethod(InitializeRegisters)
4132 - def Create(*args):
4133 """Create(b2Shape shape1, b2Shape shape2, b2BlockAllocator allocator) -> b2Contact""" 4134 return _Box2D.b2Contact_Create(*args)
4135 4136 Create = staticmethod(Create)
4137 - def Destroy(*args):
4138 """Destroy(b2Contact contact, b2BlockAllocator allocator)""" 4139 return _Box2D.b2Contact_Destroy(*args)
4140 4141 Destroy = staticmethod(Destroy) 4142 __swig_destroy__ = _Box2D.delete_b2Contact
4143 - def Update(self, *args):
4144 """Update(self, b2ContactListener listener)""" 4145 return _Box2D.b2Contact_Update(self, *args)
4146
4147 - def Evaluate(self, *args):
4148 """Evaluate(self, b2ContactListener listener)""" 4149 return _Box2D.b2Contact_Evaluate(self, *args)
4150 4151 s_registers = _swig_property(_Box2D.b2Contact_s_registers_get, _Box2D.b2Contact_s_registers_set) 4152 s_initialized = _swig_property(_Box2D.b2Contact_s_initialized_get, _Box2D.b2Contact_s_initialized_set) 4153 flags = _swig_property(_Box2D.b2Contact_flags_get, _Box2D.b2Contact_flags_set) 4154 manifoldCount = _swig_property(_Box2D.b2Contact_manifoldCount_get, _Box2D.b2Contact_manifoldCount_set) 4155 prev = _swig_property(_Box2D.b2Contact_prev_get, _Box2D.b2Contact_prev_set) 4156 next = _swig_property(_Box2D.b2Contact_next_get, _Box2D.b2Contact_next_set) 4157 node1 = _swig_property(_Box2D.b2Contact_node1_get, _Box2D.b2Contact_node1_set) 4158 node2 = _swig_property(_Box2D.b2Contact_node2_get, _Box2D.b2Contact_node2_set) 4159 shape1 = _swig_property(_Box2D.b2Contact_shape1_get, _Box2D.b2Contact_shape1_set) 4160 shape2 = _swig_property(_Box2D.b2Contact_shape2_get, _Box2D.b2Contact_shape2_set) 4161 toi = _swig_property(_Box2D.b2Contact_toi_get, _Box2D.b2Contact_toi_set)
4162 - def __repr__(self):
4163 return """b2Contact( 4164 flags = %s, 4165 manifoldCount = %s, 4166 node1 = %s, 4167 node2 = %s, 4168 s_initialized = %s, 4169 s_registers = %s, 4170 shape1 = %s, 4171 shape2 = %s, 4172 toi = %s, 4173 GetManifolds() = %s, 4174 IsSolid() = %s, 4175 e_islandFlag = %s, 4176 e_nonSolidFlag = %s, 4177 e_slowFlag = %s, 4178 e_toiFlag = %s)"""% tuple(str(a) for a in\ 4179 (self.flags,self.manifoldCount,self.node1,self.node2,self.s_initialized,self.s_registers,self.shape1,self.shape2,self.toi,self.GetManifolds(),self.IsSolid(),self.e_islandFlag,self.e_nonSolidFlag,self.e_slowFlag,self.e_toiFlag))
4180 4181 __getstate__=_generic_getstate 4182 __setstate__=_generic_setstate
4183 4184 b2Contact.GetManifolds = new_instancemethod(_Box2D.b2Contact_GetManifolds,None,b2Contact) 4185 b2Contact.GetManifoldCount = new_instancemethod(_Box2D.b2Contact_GetManifoldCount,None,b2Contact) 4186 b2Contact.IsSolid = new_instancemethod(_Box2D.b2Contact_IsSolid,None,b2Contact) 4187 b2Contact.GetNext = new_instancemethod(_Box2D.b2Contact_GetNext,None,b2Contact) 4188 b2Contact.GetShape1 = new_instancemethod(_Box2D.b2Contact_GetShape1,None,b2Contact) 4189 b2Contact.GetShape2 = new_instancemethod(_Box2D.b2Contact_GetShape2,None,b2Contact) 4190 b2Contact.Update = new_instancemethod(_Box2D.b2Contact_Update,None,b2Contact) 4191 b2Contact.Evaluate = new_instancemethod(_Box2D.b2Contact_Evaluate,None,b2Contact) 4192 b2Contact_swigregister = _Box2D.b2Contact_swigregister 4193 b2Contact_swigregister(b2Contact) 4194
4195 -def b2Contact_AddType(*args):
4196 """ 4197 b2Contact_AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destroyFcn, 4198 b2ShapeType type1, b2ShapeType type2) 4199 """ 4200 return _Box2D.b2Contact_AddType(*args)
4201
4202 -def b2Contact_InitializeRegisters():
4203 """b2Contact_InitializeRegisters()""" 4204 return _Box2D.b2Contact_InitializeRegisters()
4205
4206 -def b2Contact_Create(*args):
4207 """b2Contact_Create(b2Shape shape1, b2Shape shape2, b2BlockAllocator allocator) -> b2Contact""" 4208 return _Box2D.b2Contact_Create(*args)
4209
4210 -def b2Contact_Destroy(*args):
4211 """b2Contact_Destroy(b2Contact contact, b2BlockAllocator allocator)""" 4212 return _Box2D.b2Contact_Destroy(*args)
4213
4214 -class b2NullContact(b2Contact):
4215 """Proxy of C++ b2NullContact class""" 4216 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4217 __repr__ = _swig_repr
4218 - def __init__(self):
4219 """__init__(self) -> b2NullContact""" 4220 _Box2D.b2NullContact_swiginit(self,_Box2D.new_b2NullContact())
4221 - def __repr__(self):
4222 return """b2NullContact( 4223 flags = %s, 4224 manifoldCount = %s, 4225 node1 = %s, 4226 node2 = %s, 4227 s_initialized = %s, 4228 s_registers = %s, 4229 shape1 = %s, 4230 shape2 = %s, 4231 toi = %s, 4232 GetManifolds() = %s, 4233 IsSolid() = %s, 4234 e_islandFlag = %s, 4235 e_nonSolidFlag = %s, 4236 e_slowFlag = %s, 4237 e_toiFlag = %s)"""% tuple(str(a) for a in\ 4238 (self.flags,self.manifoldCount,self.node1,self.node2,self.s_initialized,self.s_registers,self.shape1,self.shape2,self.toi,self.GetManifolds(),self.IsSolid(),self.e_islandFlag,self.e_nonSolidFlag,self.e_slowFlag,self.e_toiFlag))
4239 4240 __getstate__=_generic_getstate 4241 __setstate__=_generic_setstate 4242 4243 __swig_destroy__ = _Box2D.delete_b2NullContact 4244 b2NullContact_swigregister = _Box2D.b2NullContact_swigregister 4245 b2NullContact_swigregister(b2NullContact) 4246
4247 -class b2ContactManager(b2PairCallback):
4248 """Proxy of C++ b2ContactManager class""" 4249 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4250 __repr__ = _swig_repr
4251 - def __init__(self):
4252 """__init__(self) -> b2ContactManager""" 4253 _Box2D.b2ContactManager_swiginit(self,_Box2D.new_b2ContactManager())
4254 - def Destroy(self, *args):
4255 """Destroy(self, b2Contact c)""" 4256 return _Box2D.b2ContactManager_Destroy(self, *args)
4257
4258 - def Collide(self):
4259 """Collide(self)""" 4260 return _Box2D.b2ContactManager_Collide(self)
4261 4262 world = _swig_property(_Box2D.b2ContactManager_world_get, _Box2D.b2ContactManager_world_set) 4263 nullContact = _swig_property(_Box2D.b2ContactManager_nullContact_get, _Box2D.b2ContactManager_nullContact_set) 4264 destroyImmediate = _swig_property(_Box2D.b2ContactManager_destroyImmediate_get, _Box2D.b2ContactManager_destroyImmediate_set)
4265 - def __repr__(self):
4266 return """b2ContactManager( 4267 destroyImmediate = %s, 4268 nullContact = %s, 4269 world = %s)"""% tuple(str(a) for a in\ 4270 (self.destroyImmediate,self.nullContact,self.world))
4271 4272 __getstate__=_generic_getstate 4273 __setstate__=_generic_setstate 4274 4275 __swig_destroy__ = _Box2D.delete_b2ContactManager 4276 b2ContactManager.Destroy = new_instancemethod(_Box2D.b2ContactManager_Destroy,None,b2ContactManager) 4277 b2ContactManager.Collide = new_instancemethod(_Box2D.b2ContactManager_Collide,None,b2ContactManager) 4278 b2ContactManager_swigregister = _Box2D.b2ContactManager_swigregister 4279 b2ContactManager_swigregister(b2ContactManager) 4280
4281 -class b2TimeStep(object):
4282 """Proxy of C++ b2TimeStep class""" 4283 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4284 __repr__ = _swig_repr 4285 dt = _swig_property(_Box2D.b2TimeStep_dt_get, _Box2D.b2TimeStep_dt_set) 4286 inv_dt = _swig_property(_Box2D.b2TimeStep_inv_dt_get, _Box2D.b2TimeStep_inv_dt_set) 4287 dtRatio = _swig_property(_Box2D.b2TimeStep_dtRatio_get, _Box2D.b2TimeStep_dtRatio_set) 4288 velocityIterations = _swig_property(_Box2D.b2TimeStep_velocityIterations_get, _Box2D.b2TimeStep_velocityIterations_set) 4289 positionIterations = _swig_property(_Box2D.b2TimeStep_positionIterations_get, _Box2D.b2TimeStep_positionIterations_set) 4290 warmStarting = _swig_property(_Box2D.b2TimeStep_warmStarting_get, _Box2D.b2TimeStep_warmStarting_set)
4291 - def __repr__(self):
4292 return """b2TimeStep( 4293 dt = %s, 4294 dtRatio = %s, 4295 inv_dt = %s, 4296 positionIterations = %s, 4297 velocityIterations = %s, 4298 warmStarting = %s)"""% tuple(str(a) for a in\ 4299 (self.dt,self.dtRatio,self.inv_dt,self.positionIterations,self.velocityIterations,self.warmStarting))
4300 4301 __getstate__=_generic_getstate 4302 __setstate__=_generic_setstate 4303
4304 - def __init__(self):
4305 """__init__(self) -> b2TimeStep""" 4306 _Box2D.b2TimeStep_swiginit(self,_Box2D.new_b2TimeStep())
4307 __swig_destroy__ = _Box2D.delete_b2TimeStep 4308 b2TimeStep_swigregister = _Box2D.b2TimeStep_swigregister 4309 b2TimeStep_swigregister(b2TimeStep) 4310
4311 -class b2World(object):
4312 """The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.""" 4313 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4314 __repr__ = _swig_repr
4315 - def __init__(self, *args):
4316 """ 4317 __init__(self, b2AABB worldAABB, b2Vec2 gravity, bool doSleep) -> b2World 4318 4319 Construct a world object. 4320 4321 Parameters: 4322 ----------- 4323 4324 worldAABB: a bounding box that completely encompasses all your shapes. 4325 4326 gravity: the world gravity vector. 4327 4328 doSleep: improve performance by not simulating inactive bodies. 4329 """ 4330 _Box2D.b2World_swiginit(self,_Box2D.new_b2World(*args))
4331 __swig_destroy__ = _Box2D.delete_b2World
4332 - def SetDestructionListener(self, *args):
4333 """ 4334 SetDestructionListener(self, b2DestructionListener listener) 4335 4336 Register a destruction listener. 4337 """ 4338 return _Box2D.b2World_SetDestructionListener(self, *args)
4339
4340 - def SetBoundaryListener(self, *args):
4341 """ 4342 SetBoundaryListener(self, b2BoundaryListener listener) 4343 4344 Register a broad-phase boundary listener. 4345 """ 4346 return _Box2D.b2World_SetBoundaryListener(self, *args)
4347
4348 - def SetContactFilter(self, *args):
4349 """ 4350 SetContactFilter(self, b2ContactFilter filter) 4351 4352 Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter). 4353 """ 4354 return _Box2D.b2World_SetContactFilter(self, *args)
4355
4356 - def SetContactListener(self, *args):
4357 """ 4358 SetContactListener(self, b2ContactListener listener) 4359 4360 Register a contact event listener. 4361 """ 4362 return _Box2D.b2World_SetContactListener(self, *args)
4363
4364 - def SetDebugDraw(self, *args):
4365 """ 4366 SetDebugDraw(self, b2DebugDraw debugDraw) 4367 4368 Register a routine for debug drawing. The debug draw functions are called inside the b2World::Stepmethod, so make sure your renderer is ready to consume draw commands when you call Step(). 4369 """ 4370 return _Box2D.b2World_SetDebugDraw(self, *args)
4371
4372 - def CreateController(self, *args):
4373 """ 4374 CreateController(self, b2ControllerDef _def) -> b2Controller 4375 4376 Add a controller to the world. 4377 """ 4378 return _Box2D.b2World_CreateController(self, *args)
4379
4380 - def DestroyController(self, *args):
4381 """ 4382 DestroyController(self, b2Controller controller) 4383 4384 Removes a controller from the world. 4385 """ 4386 return _Box2D.b2World_DestroyController(self, *args)
4387
4388 - def GetGroundBody(self):
4389 """ 4390 GetGroundBody(self) -> b2Body 4391 4392 The world provides a single static ground body with no collision shapes. You can use this to simplify the creation of joints and static shapes. 4393 """ 4394 return _Box2D.b2World_GetGroundBody(self)
4395
4396 - def Step(self, *args):
4397 """ 4398 Step(self, float32 timeStep, int32 velocityIterations, int32 positionIterations) 4399 4400 Take a time step. This performs collision detection, integration, and constraint solution. 4401 4402 Parameters: 4403 ----------- 4404 4405 timeStep: the amount of time to simulate, this should not vary. 4406 4407 velocityIterations: for the velocity constraint solver. 4408 4409 positionIterations: for the position constraint solver. 4410 """ 4411 return _Box2D.b2World_Step(self, *args)
4412
4413 - def InRange(self, *args):
4414 """ 4415 InRange(self, b2AABB aabb) -> bool 4416 4417 Check if the AABB is within the broadphase limits. 4418 """ 4419 return _Box2D.b2World_InRange(self, *args)
4420
4421 - def _GetBodyList(self):
4422 """ 4423 _GetBodyList(self) -> b2Body 4424 4425 Get the world body list. With the returned body, use b2Body::GetNextto get the next body in the world list. A NULL body indicates the end of the list. 4426 the head of the world body list. 4427 """ 4428 return _Box2D.b2World__GetBodyList(self)
4429
4430 - def _GetJointList(self):
4431 """ 4432 _GetJointList(self) -> b2Joint 4433 4434 Get the world joint list. With the returned joint, use b2Joint::GetNextto get the next joint in the world list. A NULL joint indicates the end of the list. 4435 the head of the world joint list. 4436 """ 4437 return _Box2D.b2World__GetJointList(self)
4438
4439 - def _GetControllerList(self):
4440 """ 4441 _GetControllerList(self) -> b2Controller 4442 4443 Get the world controller list. With the returned controller, use b2Controller::GetNextto get the next controller in the world list. A NULL controller indicates the end of the list. 4444 the head of the world controller list. 4445 """ 4446 return _Box2D.b2World__GetControllerList(self)
4447
4448 - def Refilter(self, *args):
4449 """ 4450 Refilter(self, b2Shape shape) 4451 4452 Re-filter a shape. This re-runs contact filtering on a shape. 4453 """ 4454 return _Box2D.b2World_Refilter(self, *args)
4455
4456 - def SetWarmStarting(self, *args):
4457 """ 4458 SetWarmStarting(self, bool flag) 4459 4460 Enable/disable warm starting. For testing. 4461 """ 4462 return _Box2D.b2World_SetWarmStarting(self, *args)
4463
4464 - def SetContinuousPhysics(self, *args):
4465 """ 4466 SetContinuousPhysics(self, bool flag) 4467 4468 Enable/disable continuous physics. For testing. 4469 """ 4470 return _Box2D.b2World_SetContinuousPhysics(self, *args)
4471
4472 - def Validate(self):
4473 """ 4474 Validate(self) 4475 4476 Perform validation of internal data structures. 4477 """ 4478 return _Box2D.b2World_Validate(self)
4479
4480 - def GetProxyCount(self):
4481 """ 4482 GetProxyCount(self) -> int32 4483 4484 Get the number of broad-phase proxies. 4485 """ 4486 return _Box2D.b2World_GetProxyCount(self)
4487
4488 - def GetPairCount(self):
4489 """ 4490 GetPairCount(self) -> int32 4491 4492 Get the number of broad-phase pairs. 4493 """ 4494 return _Box2D.b2World_GetPairCount(self)
4495
4496 - def GetBodyCount(self):
4497 """ 4498 GetBodyCount(self) -> int32 4499 4500 Get the number of bodies. 4501 """ 4502 return _Box2D.b2World_GetBodyCount(self)
4503
4504 - def GetJointCount(self):
4505 """ 4506 GetJointCount(self) -> int32 4507 4508 Get the number of joints. 4509 """ 4510 return _Box2D.b2World_GetJointCount(self)
4511
4512 - def GetContactCount(self):
4513 """ 4514 GetContactCount(self) -> int32 4515 4516 Get the number of contacts (each may have 0 or more contact points). 4517 """ 4518 return _Box2D.b2World_GetContactCount(self)
4519
4520 - def GetControllerCount(self):
4521 """ 4522 GetControllerCount(self) -> int32 4523 4524 Get the number of controllers. 4525 """ 4526 return _Box2D.b2World_GetControllerCount(self)
4527
4528 - def SetGravity(self, *args):
4529 """ 4530 SetGravity(self, b2Vec2 gravity) 4531 4532 Change the global gravity vector. 4533 """ 4534 return _Box2D.b2World_SetGravity(self, *args)
4535
4536 - def GetGravity(self):
4537 """ 4538 GetGravity(self) -> b2Vec2 4539 4540 Get the global gravity vector. 4541 """ 4542 return _Box2D.b2World_GetGravity(self)
4543
4544 - def GetWorldAABB(self):
4545 """ 4546 GetWorldAABB(self) -> b2AABB 4547 4548 Get the world's AABB. 4549 """ 4550 return _Box2D.b2World_GetWorldAABB(self)
4551
4552 - def CanSleep(self):
4553 """ 4554 CanSleep(self) -> bool 4555 4556 Whether or not bodies can sleep. 4557 """ 4558 return _Box2D.b2World_CanSleep(self)
4559
4560 - def __repr__(self):
4561 return """b2World( 4562 doSleep = %s, 4563 gravity = %s, 4564 groundBody = %s, 4565 worldAABB = %s, 4566 GetBodyCount() = %s, 4567 GetContactCount() = %s, 4568 GetControllerCount() = %s, 4569 GetJointCount() = %s, 4570 GetPairCount() = %s, 4571 GetProxyCount() = %s)"""% tuple(str(a) for a in\ 4572 (self.doSleep,self.gravity,self.groundBody,self.worldAABB,self.GetBodyCount(),self.GetContactCount(),self.GetControllerCount(),self.GetJointCount(),self.GetPairCount(),self.GetProxyCount()))
4573 4574 __getstate__=_pickle_get_b2world 4575 __setstate__=_pickle_factory_set 4576 _pickle_finalize=_pickle_finalize_world 4577
4578 - def CreateBody(self, *args):
4579 """ 4580 CreateBody(self, b2BodyDef defn) -> b2Body 4581 4582 Create a rigid body given a definition. No reference to the definition is retained. 4583 WARNING: 4584 This function is locked during callbacks. 4585 """ 4586 return _Box2D.b2World_CreateBody(self, *args)
4587
4588 - def CreateJoint(self, *args):
4589 """ 4590 CreateJoint(self, b2JointDef defn) -> b2Joint 4591 4592 Create a joint to constrain bodies together. No reference to the definition is retained. This may cause the connected bodies to cease colliding. 4593 WARNING: 4594 This function is locked during callbacks. 4595 """ 4596 return _Box2D.b2World_CreateJoint(self, *args)
4597
4598 - def DestroyBody(self, *args):
4599 """ 4600 DestroyBody(self, b2Body body) 4601 4602 Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks. 4603 WARNING: 4604 This automatically deletes all associated shapes and joints. 4605 4606 This function is locked during callbacks. 4607 """ 4608 return _Box2D.b2World_DestroyBody(self, *args)
4609
4610 - def DestroyJoint(self, *args):
4611 """ 4612 DestroyJoint(self, b2Joint joint) 4613 4614 Destroy a joint. This may cause the connected bodies to begin colliding. 4615 WARNING: 4616 This function is locked during callbacks. 4617 """ 4618 return _Box2D.b2World_DestroyJoint(self, *args)
4619
4620 - def Raycast(self, *args):
4621 """ 4622 Raycast(self, b2Segment segment, b2Shape shapes, int32 maxCount, 4623 bool solidShapes, void $ignore) -> int32 4624 Raycast(self, b2Segment segment, int32 maxCount, bool solidShapes, 4625 PyObject $ignore) -> PyObject 4626 4627 Query the world for all shapes that intersect a given segment. You provide a shape pointer buffer of specified size. The number of shapes found is returned, and the buffer is filled in order of intersection 4628 4629 Parameters: 4630 ----------- 4631 4632 segment: 4633 defines the begin and end point of the ray cast, from p1 to p2. Use b2Segment.Extend to create (semi-)infinite rays 4634 4635 shapes: 4636 a user allocated shape pointer array of size maxCount (or greater). 4637 4638 maxCount: 4639 the capacity of the shapes array 4640 4641 solidShapes: 4642 determines if shapes that the ray starts in are counted as hits. 4643 4644 userData: 4645 passed through the worlds contact filter, with method RayCollide. This can be used to filter valid shapes 4646 4647 the number of shapes found 4648 """ 4649 return _Box2D.b2World_Raycast(self, *args)
4650
4651 - def RaycastOne(self, *args):
4652 """ 4653 RaycastOne(self, b2Segment segment, float32 _lambda, b2Vec2 normal, 4654 bool solidShapes, void $ignore) -> b2Shape 4655 RaycastOne(self, b2Segment segment, bool solidShapes, PyObject $ignore) -> PyObject 4656 4657 Performs a raycast as with Raycast, finding the first intersecting shape. 4658 4659 Parameters: 4660 ----------- 4661 4662 segment: 4663 defines the begin and end point of the ray cast, from p1 to p2. Use b2Segment.Extend to create (semi-)infinite rays 4664 4665 lambda: 4666 returns the hit fraction. You can use this to compute the contact point p = (1 - lambda) * segment.p1 + lambda * segment.p2. 4667 4668 normal: 4669 returns the normal at the contact point. If there is no intersection, the normal is not set. 4670 4671 solidShapes: 4672 determines if shapes that the ray starts in are counted as hits. 4673 4674 the colliding shape shape, or null if not found 4675 """ 4676 return _Box2D.b2World_RaycastOne(self, *args)
4677
4678 - def Query(self, *args):
4679 """ 4680 Query(self, b2AABB aabb, b2Shape shapes, int32 maxCount) -> int32 4681 Query(self, b2AABB aabb, uint32 maxCount) -> PyObject 4682 4683 Query the world for all shapes that potentially overlap the provided AABB. You provide a shape pointer buffer of specified size. The number of shapes found is returned. 4684 4685 Parameters: 4686 ----------- 4687 4688 aabb: the query box. 4689 4690 shapes: a user allocated shape pointer array of size maxCount (or greater). 4691 4692 maxCount: the capacity of the shapes array. 4693 4694 the number of shapes found in aabb. 4695 """ 4696 return _Box2D.b2World_Query(self, *args)
4697
4698 - def GetJointList(self):
4699 """ 4700 Get a list of the joints in this world 4701 """ 4702 jointList = [] 4703 joint = self._GetJointList() 4704 while joint: 4705 jointList.append(joint.getAsType()) 4706 joint = joint.GetNext() 4707 jointList.reverse() # jointlist is in reverse order 4708 return jointList
4709 - def GetBodyList(self):
4710 """ 4711 Get a list of the bodies in this world 4712 """ 4713 bodyList = [] 4714 body = self._GetBodyList() 4715 while body: 4716 bodyList.append(body) 4717 body = body.GetNext() 4718 bodyList.reverse() # bodylist is in reverse order 4719 return bodyList
4720 - def GetControllerList(self):
4721 """ 4722 Get a list of the controllers in this world 4723 """ 4724 controllerList = [] 4725 controller = self._GetControllerList() 4726 while controller: 4727 controllerList.append(controller.getAsType()) 4728 controller = controller.GetNext() 4729 controllerList.reverse() # controllerlist is in reverse order 4730 return controllerList
4731
4732 - def __iter__(self):
4733 """ 4734 Iterates over the bodies in the world 4735 """ 4736 for body in self.bodyList: 4737 yield body
4738 4739 gravity = property(GetGravity , SetGravity) 4740 jointList = property(GetJointList , None) 4741 bodyList = property(GetBodyList , None) 4742 groundBody= property(GetGroundBody, None) 4743 worldAABB = property(GetWorldAABB , None) 4744 doSleep = property(CanSleep , None) 4745 controllerList = property(GetControllerList, None) 4746 4747 b2World.SetDestructionListener = new_instancemethod(_Box2D.b2World_SetDestructionListener,None,b2World) 4748 b2World.SetBoundaryListener = new_instancemethod(_Box2D.b2World_SetBoundaryListener,None,b2World) 4749 b2World.SetContactFilter = new_instancemethod(_Box2D.b2World_SetContactFilter,None,b2World) 4750 b2World.SetContactListener = new_instancemethod(_Box2D.b2World_SetContactListener,None,b2World) 4751 b2World.SetDebugDraw = new_instancemethod(_Box2D.b2World_SetDebugDraw,None,b2World) 4752 b2World.CreateController = new_instancemethod(_Box2D.b2World_CreateController,None,b2World) 4753 b2World.DestroyController = new_instancemethod(_Box2D.b2World_DestroyController,None,b2World) 4754 b2World.GetGroundBody = new_instancemethod(_Box2D.b2World_GetGroundBody,None,b2World) 4755 b2World.Step = new_instancemethod(_Box2D.b2World_Step,None,b2World) 4756 b2World.InRange = new_instancemethod(_Box2D.b2World_InRange,None,b2World) 4757 b2World._GetBodyList = new_instancemethod(_Box2D.b2World__GetBodyList,None,b2World) 4758 b2World._GetJointList = new_instancemethod(_Box2D.b2World__GetJointList,None,b2World) 4759 b2World._GetControllerList = new_instancemethod(_Box2D.b2World__GetControllerList,None,b2World) 4760 b2World.Refilter = new_instancemethod(_Box2D.b2World_Refilter,None,b2World) 4761 b2World.SetWarmStarting = new_instancemethod(_Box2D.b2World_SetWarmStarting,None,b2World) 4762 b2World.SetContinuousPhysics = new_instancemethod(_Box2D.b2World_SetContinuousPhysics,None,b2World) 4763 b2World.Validate = new_instancemethod(_Box2D.b2World_Validate,None,b2World) 4764 b2World.GetProxyCount = new_instancemethod(_Box2D.b2World_GetProxyCount,None,b2World) 4765 b2World.GetPairCount = new_instancemethod(_Box2D.b2World_GetPairCount,None,b2World) 4766 b2World.GetBodyCount = new_instancemethod(_Box2D.b2World_GetBodyCount,None,b2World) 4767 b2World.GetJointCount = new_instancemethod(_Box2D.b2World_GetJointCount,None,b2World) 4768 b2World.GetContactCount = new_instancemethod(_Box2D.b2World_GetContactCount,None,b2World) 4769 b2World.GetControllerCount = new_instancemethod(_Box2D.b2World_GetControllerCount,None,b2World) 4770 b2World.SetGravity = new_instancemethod(_Box2D.b2World_SetGravity,None,b2World) 4771 b2World.GetGravity = new_instancemethod(_Box2D.b2World_GetGravity,None,b2World) 4772 b2World.GetWorldAABB = new_instancemethod(_Box2D.b2World_GetWorldAABB,None,b2World) 4773 b2World.CanSleep = new_instancemethod(_Box2D.b2World_CanSleep,None,b2World) 4774 b2World.CreateBody = new_instancemethod(_Box2D.b2World_CreateBody,None,b2World) 4775 b2World.CreateJoint = new_instancemethod(_Box2D.b2World_CreateJoint,None,b2World) 4776 b2World.DestroyBody = new_instancemethod(_Box2D.b2World_DestroyBody,None,b2World) 4777 b2World.DestroyJoint = new_instancemethod(_Box2D.b2World_DestroyJoint,None,b2World) 4778 b2World.Raycast = new_instancemethod(_Box2D.b2World_Raycast,None,b2World) 4779 b2World.RaycastOne = new_instancemethod(_Box2D.b2World_RaycastOne,None,b2World) 4780 b2World.Query = new_instancemethod(_Box2D.b2World_Query,None,b2World) 4781 b2World_swigregister = _Box2D.b2World_swigregister 4782 b2World_swigregister(b2World) 4783 4784 e_unknownController = _Box2D.e_unknownController 4785 e_buoyancyController = _Box2D.e_buoyancyController 4786 e_constantAccelController = _Box2D.e_constantAccelController 4787 e_constantForceController = _Box2D.e_constantForceController 4788 e_gravityController = _Box2D.e_gravityController 4789 e_tensorDampingController = _Box2D.e_tensorDampingController
4790 -class b2ControllerEdge(object):
4791 """A controller edge is used to connect bodies and controllers together in a bipartite graph.""" 4792 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4793 __repr__ = _swig_repr 4794 controller = _swig_property(_Box2D.b2ControllerEdge_controller_get, _Box2D.b2ControllerEdge_controller_set) 4795 body = _swig_property(_Box2D.b2ControllerEdge_body_get, _Box2D.b2ControllerEdge_body_set) 4796 prevBody = _swig_property(_Box2D.b2ControllerEdge_prevBody_get, _Box2D.b2ControllerEdge_prevBody_set) 4797 nextBody = _swig_property(_Box2D.b2ControllerEdge_nextBody_get, _Box2D.b2ControllerEdge_nextBody_set) 4798 prevController = _swig_property(_Box2D.b2ControllerEdge_prevController_get, _Box2D.b2ControllerEdge_prevController_set) 4799 nextController = _swig_property(_Box2D.b2ControllerEdge_nextController_get, _Box2D.b2ControllerEdge_nextController_set)
4800 - def __repr__(self):
4801 return """b2ControllerEdge( 4802 body = %s, 4803 controller = %s)"""% tuple(str(a) for a in\ 4804 (self.body,self.controller))
4805 4806 __getstate__=_generic_getstate 4807 __setstate__=_generic_setstate 4808
4809 - def __init__(self):
4810 """__init__(self) -> b2ControllerEdge""" 4811 _Box2D.b2ControllerEdge_swiginit(self,_Box2D.new_b2ControllerEdge())
4812 __swig_destroy__ = _Box2D.delete_b2ControllerEdge 4813 b2ControllerEdge_swigregister = _Box2D.b2ControllerEdge_swigregister 4814 b2ControllerEdge_swigregister(b2ControllerEdge) 4815
4816 -class b2Controller(object):
4817 """Base class for controllers. Controllers are a convience for encapsulating common per-step functionality.""" 4818 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
4819 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
4820 __repr__ = _swig_repr 4821 __swig_destroy__ = _Box2D.delete_b2Controller
4822 - def Step(self, *args):
4823 """ 4824 Step(self, b2TimeStep step) 4825 4826 Controllers override this to implement per-step functionality. 4827 """ 4828 return _Box2D.b2Controller_Step(self, *args)
4829
4830 - def Draw(self, *args):
4831 """ 4832 Draw(self, b2DebugDraw debugDraw) 4833 4834 Controllers override this to provide debug drawing. 4835 """ 4836 return _Box2D.b2Controller_Draw(self, *args)
4837
4838 - def AddBody(self, *args):
4839 """ 4840 AddBody(self, b2Body body) 4841 4842 Adds a body to the controller list. 4843 """ 4844 return _Box2D.b2Controller_AddBody(self, *args)
4845
4846 - def RemoveBody(self, *args):
4847 """ 4848 RemoveBody(self, b2Body body) 4849 4850 Removes a body from the controller list. 4851 """ 4852 return _Box2D.b2Controller_RemoveBody(self, *args)
4853
4854 - def Clear(self):
4855 """ 4856 Clear(self) 4857 4858 Removes all bodies from the controller list. 4859 """ 4860 return _Box2D.b2Controller_Clear(self)
4861
4862 - def GetType(self):
4863 """ 4864 GetType(self) -> b2ControllerType 4865 4866 Get the type of the controller. 4867 """ 4868 return _Box2D.b2Controller_GetType(self)
4869
4870 - def GetNext(self):
4871 """ 4872 GetNext(self) -> b2Controller 4873 4874 Get the next controller in the world's body list. 4875 """ 4876 return _Box2D.b2Controller_GetNext(self)
4877
4878 - def GetWorld(self):
4879 """ 4880 GetWorld(self) -> b2World 4881 4882 Get the parent world of this body. 4883 """ 4884 return _Box2D.b2Controller_GetWorld(self)
4885
4886 - def _GetBodyList(self):
4887 """ 4888 _GetBodyList(self) -> b2ControllerEdge 4889 4890 Get the attached body list. 4891 """ 4892 return _Box2D.b2Controller__GetBodyList(self)
4893
4894 - def __repr__(self):
4895 return "b2Controller()"
4896 4897 __getstate__=no_pickle 4898 __setstate__=_generic_setstate 4899
4900 - def __hash__(self):
4901 """__hash__(self) -> int32""" 4902 return _Box2D.b2Controller___hash__(self)
4903
4904 - def typeName(self):
4905 """ 4906 Return the name of the controller from: 4907 Unknown, Buoyancy, ConstantAccel, ConstantForce, Gravity, TensorDamping 4908 """ 4909 types = { e_unknownController : 'Unknown', 4910 e_buoyancyController : 'Buoyancy', 4911 e_constantAccelController : 'ConstantAccel', 4912 e_constantForceController : 'ConstantForce', 4913 e_gravityController : 'Gravity', 4914 e_tensorDampingController : 'TensorDamping' } 4915 return types[self.GetType()]
4916 - def getAsType(self):
4917 """ 4918 Return a typecasted version of the controller 4919 """ 4920 return (getattr(self, "_as%sController" % self.typeName())) ()
4921 - def GetBodyList(self):
4922 bodyList = [] 4923 c_edge = self._GetBodyList() 4924 while c_edge: 4925 bodyList.append(c_edge.body) 4926 c_edge = c_edge.nextBody 4927 bodyList.reverse() # bodylist is in reverse order 4928 return bodyList
4929
4930 - def __iter__(self):
4931 """ 4932 Iterates over the bodies in the controller 4933 """ 4934 for body in self.bodyList: 4935 yield body
4936 4937 __eq__ = b2ControllerCompare 4938 __ne__ = lambda self,other: not b2ControllerCompare(self,other) 4939 type = property(GetType, None) 4940 bodyList = property(GetBodyList, None) 4941
4942 - def _asBuoyancyController(self):
4943 """_asBuoyancyController(self) -> b2BuoyancyController""" 4944 return _Box2D.b2Controller__asBuoyancyController(self)
4945
4946 - def _asConstantAccelController(self):
4947 """_asConstantAccelController(self) -> b2ConstantAccelController""" 4948 return _Box2D.b2Controller__asConstantAccelController(self)
4949
4950 - def _asConstantForceController(self):
4951 """_asConstantForceController(self) -> b2ConstantForceController""" 4952 return _Box2D.b2Controller__asConstantForceController(self)
4953
4954 - def _asGravityController(self):
4955 """_asGravityController(self) -> b2GravityController""" 4956 return _Box2D.b2Controller__asGravityController(self)
4957
4958 - def _asTensorDampingController(self):
4959 """_asTensorDampingController(self) -> b2TensorDampingController""" 4960 return _Box2D.b2Controller__asTensorDampingController(self)
4961 4962 b2Controller.Step = new_instancemethod(_Box2D.b2Controller_Step,None,b2Controller) 4963 b2Controller.Draw = new_instancemethod(_Box2D.b2Controller_Draw,None,b2Controller) 4964 b2Controller.AddBody = new_instancemethod(_Box2D.b2Controller_AddBody,None,b2Controller) 4965 b2Controller.RemoveBody = new_instancemethod(_Box2D.b2Controller_RemoveBody,None,b2Controller) 4966 b2Controller.Clear = new_instancemethod(_Box2D.b2Controller_Clear,None,b2Controller) 4967 b2Controller.GetType = new_instancemethod(_Box2D.b2Controller_GetType,None,b2Controller) 4968 b2Controller.GetNext = new_instancemethod(_Box2D.b2Controller_GetNext,None,b2Controller) 4969 b2Controller.GetWorld = new_instancemethod(_Box2D.b2Controller_GetWorld,None,b2Controller) 4970 b2Controller._GetBodyList = new_instancemethod(_Box2D.b2Controller__GetBodyList,None,b2Controller) 4971 b2Controller.__hash__ = new_instancemethod(_Box2D.b2Controller___hash__,None,b2Controller) 4972 b2Controller._asBuoyancyController = new_instancemethod(_Box2D.b2Controller__asBuoyancyController,None,b2Controller) 4973 b2Controller._asConstantAccelController = new_instancemethod(_Box2D.b2Controller__asConstantAccelController,None,b2Controller) 4974 b2Controller._asConstantForceController = new_instancemethod(_Box2D.b2Controller__asConstantForceController,None,b2Controller) 4975 b2Controller._asGravityController = new_instancemethod(_Box2D.b2Controller__asGravityController,None,b2Controller) 4976 b2Controller._asTensorDampingController = new_instancemethod(_Box2D.b2Controller__asTensorDampingController,None,b2Controller) 4977 b2Controller_swigregister = _Box2D.b2Controller_swigregister 4978 b2Controller_swigregister(b2Controller) 4979
4980 -class b2ControllerDef(object):
4981 """Proxy of C++ b2ControllerDef class""" 4982 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
4983 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
4984 __repr__ = _swig_repr 4985 __swig_destroy__ = _Box2D.delete_b2ControllerDef
4986 - def __repr__(self):
4987 return "b2ControllerDef()"
4988 4989 __getstate__=_generic_getstate 4990 __setstate__=_generic_setstate
4991 4992 b2ControllerDef_swigregister = _Box2D.b2ControllerDef_swigregister 4993 b2ControllerDef_swigregister(b2ControllerDef) 4994
4995 -class b2BodyDef(object):
4996 """A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions.""" 4997 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 4998 __repr__ = _swig_repr
4999 - def __init__(self):
5000 """ 5001 __init__(self) -> b2BodyDef 5002 5003 This constructor sets the body definition default values. 5004 """ 5005 _Box2D.b2BodyDef_swiginit(self,_Box2D.new_b2BodyDef())
5006 massData = _swig_property(_Box2D.b2BodyDef_massData_get, _Box2D.b2BodyDef_massData_set) 5007 position = _swig_property(_Box2D.b2BodyDef_position_get, _Box2D.b2BodyDef_position_set) 5008 angle = _swig_property(_Box2D.b2BodyDef_angle_get, _Box2D.b2BodyDef_angle_set) 5009 linearDamping = _swig_property(_Box2D.b2BodyDef_linearDamping_get, _Box2D.b2BodyDef_linearDamping_set) 5010 angularDamping = _swig_property(_Box2D.b2BodyDef_angularDamping_get, _Box2D.b2BodyDef_angularDamping_set) 5011 allowSleep = _swig_property(_Box2D.b2BodyDef_allowSleep_get, _Box2D.b2BodyDef_allowSleep_set) 5012 isSleeping = _swig_property(_Box2D.b2BodyDef_isSleeping_get, _Box2D.b2BodyDef_isSleeping_set) 5013 fixedRotation = _swig_property(_Box2D.b2BodyDef_fixedRotation_get, _Box2D.b2BodyDef_fixedRotation_set) 5014 isBullet = _swig_property(_Box2D.b2BodyDef_isBullet_get, _Box2D.b2BodyDef_isBullet_set)
5015 - def __repr__(self):
5016 return """b2BodyDef( 5017 allowSleep = %s, 5018 angle = %s, 5019 angularDamping = %s, 5020 fixedRotation = %s, 5021 isBullet = %s, 5022 isSleeping = %s, 5023 linearDamping = %s, 5024 massData = %s, 5025 position = %s, 5026 userData = %s)"""% tuple(str(a) for a in\ 5027 (self.allowSleep,self.angle,self.angularDamping,self.fixedRotation,self.isBullet,self.isSleeping,self.linearDamping,self.massData,self.position,self.userData))
5028 5029 __getstate__=_generic_getstate 5030 __setstate__=_generic_setstate 5031
5032 - def GetUserData(self):
5033 """GetUserData(self) -> PyObject""" 5034 return _Box2D.b2BodyDef_GetUserData(self)
5035
5036 - def SetUserData(self, *args):
5037 """SetUserData(self, PyObject data)""" 5038 return _Box2D.b2BodyDef_SetUserData(self, *args)
5039
5040 - def ClearUserData(self):
5041 """ClearUserData(self)""" 5042 return _Box2D.b2BodyDef_ClearUserData(self)
5043 5044 userData = property(GetUserData, SetUserData)
5045 - def __del__(self):
5046 self.ClearUserData()
5047 5048 __swig_destroy__ = _Box2D.delete_b2BodyDef 5049 b2BodyDef.GetUserData = new_instancemethod(_Box2D.b2BodyDef_GetUserData,None,b2BodyDef) 5050 b2BodyDef.SetUserData = new_instancemethod(_Box2D.b2BodyDef_SetUserData,None,b2BodyDef) 5051 b2BodyDef.ClearUserData = new_instancemethod(_Box2D.b2BodyDef_ClearUserData,None,b2BodyDef) 5052 b2BodyDef_swigregister = _Box2D.b2BodyDef_swigregister 5053 b2BodyDef_swigregister(b2BodyDef) 5054
5055 -class b2Body(object):
5056 """A rigid body.""" 5057 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
5058 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
5059 __repr__ = _swig_repr
5060 - def SetMass(self, *args):
5061 """ 5062 SetMass(self, b2MassData massData) 5063 5064 Set the mass properties. Note that this changes the center of mass position. If you are not sure how to compute mass properties, use SetMassFromShapes. The inertia tensor is assumed to be relative to the center of mass. 5065 5066 Parameters: 5067 ----------- 5068 5069 massData: the mass properties. 5070 """ 5071 return _Box2D.b2Body_SetMass(self, *args)
5072
5073 - def SetMassFromShapes(self):
5074 """ 5075 SetMassFromShapes(self) 5076 5077 Compute the mass properties from the attached shapes. You typically call this after adding all the shapes. If you add or remove shapes later, you may want to call this again. Note that this changes the center of mass position. 5078 """ 5079 return _Box2D.b2Body_SetMassFromShapes(self)
5080
5081 - def SetXForm(self, *args):
5082 """ 5083 SetXForm(self, b2Vec2 position, float32 angle) -> bool 5084 5085 Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies. 5086 5087 Parameters: 5088 ----------- 5089 5090 position: the new world position of the body's origin (not necessarily the center of mass). 5091 5092 angle: the new world rotation angle of the body in radians. 5093 5094 false if the movement put a shape outside the world. In this case the body is automatically frozen. 5095 """ 5096 return _Box2D.b2Body_SetXForm(self, *args)
5097
5098 - def GetXForm(self):
5099 """ 5100 GetXForm(self) -> b2XForm 5101 5102 Get the body transform for the body's origin. 5103 the world transform of the body's origin. 5104 """ 5105 return _Box2D.b2Body_GetXForm(self)
5106
5107 - def GetPosition(self):
5108 """ 5109 GetPosition(self) -> b2Vec2 5110 5111 Get the world body origin position. 5112 the world position of the body's origin. 5113 """ 5114 return _Box2D.b2Body_GetPosition(self)
5115
5116 - def GetAngle(self):
5117 """ 5118 GetAngle(self) -> float32 5119 5120 Get the angle in radians. 5121 the current world rotation angle in radians. 5122 """ 5123 return _Box2D.b2Body_GetAngle(self)
5124
5125 - def GetLinearDamping(self):
5126 """ 5127 GetLinearDamping(self) -> float32 5128 5129 Get the linear damping. 5130 """ 5131 return _Box2D.b2Body_GetLinearDamping(self)
5132
5133 - def GetAngularDamping(self):
5134 """ 5135 GetAngularDamping(self) -> float32 5136 5137 Get the angular damping. 5138 """ 5139 return _Box2D.b2Body_GetAngularDamping(self)
5140
5141 - def GetWorldCenter(self):
5142 """ 5143 GetWorldCenter(self) -> b2Vec2 5144 5145 Get the world position of the center of mass. 5146 """ 5147 return _Box2D.b2Body_GetWorldCenter(self)
5148
5149 - def GetLocalCenter(self):
5150 """ 5151 GetLocalCenter(self) -> b2Vec2 5152 5153 Get the local position of the center of mass. 5154 """ 5155 return _Box2D.b2Body_GetLocalCenter(self)
5156
5157 - def SetLinearVelocity(self, *args):
5158 """ 5159 SetLinearVelocity(self, b2Vec2 v) 5160 5161 Set the linear velocity of the center of mass. 5162 5163 Parameters: 5164 ----------- 5165 5166 v: the new linear velocity of the center of mass. 5167 """ 5168 return _Box2D.b2Body_SetLinearVelocity(self, *args)
5169
5170 - def GetLinearVelocity(self):
5171 """ 5172 GetLinearVelocity(self) -> b2Vec2 5173 5174 Get the linear velocity of the center of mass. 5175 the linear velocity of the center of mass. 5176 """ 5177 return _Box2D.b2Body_GetLinearVelocity(self)
5178
5179 - def SetAngularVelocity(self, *args):
5180 """ 5181 SetAngularVelocity(self, float32 omega) 5182 5183 Set the angular velocity. 5184 5185 Parameters: 5186 ----------- 5187 5188 omega: the new angular velocity in radians/second. 5189 """ 5190 return _Box2D.b2Body_SetAngularVelocity(self, *args)
5191
5192 - def GetAngularVelocity(self):
5193 """ 5194 GetAngularVelocity(self) -> float32 5195 5196 Get the angular velocity. 5197 the angular velocity in radians/second. 5198 """ 5199 return _Box2D.b2Body_GetAngularVelocity(self)
5200
5201 - def ApplyForce(self, *args):
5202 """ 5203 ApplyForce(self, b2Vec2 force, b2Vec2 point) 5204 5205 Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body. 5206 5207 Parameters: 5208 ----------- 5209 5210 force: the world force vector, usually in Newtons (N). 5211 5212 point: the world position of the point of application. 5213 """ 5214 return _Box2D.b2Body_ApplyForce(self, *args)
5215
5216 - def ApplyTorque(self, *args):
5217 """ 5218 ApplyTorque(self, float32 torque) 5219 5220 Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body. 5221 5222 Parameters: 5223 ----------- 5224 5225 torque: about the z-axis (out of the screen), usually in N-m. 5226 """ 5227 return _Box2D.b2Body_ApplyTorque(self, *args)
5228
5229 - def ApplyImpulse(self, *args):
5230 """ 5231 ApplyImpulse(self, b2Vec2 impulse, b2Vec2 point) 5232 5233 Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body. 5234 5235 Parameters: 5236 ----------- 5237 5238 impulse: the world impulse vector, usually in N-seconds or kg-m/s. 5239 5240 point: the world position of the point of application. 5241 """ 5242 return _Box2D.b2Body_ApplyImpulse(self, *args)
5243
5244 - def GetMass(self):
5245 """ 5246 GetMass(self) -> float32 5247 5248 Get the total mass of the body. 5249 the mass, usually in kilograms (kg). 5250 """ 5251 return _Box2D.b2Body_GetMass(self)
5252
5253 - def GetInertia(self):
5254 """ 5255 GetInertia(self) -> float32 5256 5257 Get the central rotational inertia of the body. 5258 the rotational inertia, usually in kg-m^2. 5259 """ 5260 return _Box2D.b2Body_GetInertia(self)
5261
5262 - def GetWorldPoint(self, *args):
5263 """ 5264 GetWorldPoint(self, b2Vec2 localPoint) -> b2Vec2 5265 5266 Get the world coordinates of a point given the local coordinates. 5267 5268 Parameters: 5269 ----------- 5270 5271 localPoint: a point on the body measured relative the the body's origin. 5272 5273 the same point expressed in world coordinates. 5274 """ 5275 return _Box2D.b2Body_GetWorldPoint(self, *args)
5276
5277 - def GetWorldVector(self, *args):
5278 """ 5279 GetWorldVector(self, b2Vec2 localVector) -> b2Vec2 5280 5281 Get the world coordinates of a vector given the local coordinates. 5282 5283 Parameters: 5284 ----------- 5285 5286 localVector: a vector fixed in the body. 5287 5288 the same vector expressed in world coordinates. 5289 """ 5290 return _Box2D.b2Body_GetWorldVector(self, *args)
5291
5292 - def GetLocalPoint(self, *args):
5293 """ 5294 GetLocalPoint(self, b2Vec2 worldPoint) -> b2Vec2 5295 5296 Gets a local point relative to the body's origin given a world point. 5297 5298 Parameters: 5299 ----------- 5300 5301 a: point in world coordinates. 5302 5303 the corresponding local point relative to the body's origin. 5304 """ 5305 return _Box2D.b2Body_GetLocalPoint(self, *args)
5306
5307 - def GetLocalVector(self, *args):
5308 """ 5309 GetLocalVector(self, b2Vec2 worldVector) -> b2Vec2 5310 5311 Gets a local vector given a world vector. 5312 5313 Parameters: 5314 ----------- 5315 5316 a: vector in world coordinates. 5317 5318 the corresponding local vector. 5319 """ 5320 return _Box2D.b2Body_GetLocalVector(self, *args)
5321
5322 - def GetLinearVelocityFromWorldPoint(self, *args):
5323 """ 5324 GetLinearVelocityFromWorldPoint(self, b2Vec2 worldPoint) -> b2Vec2 5325 5326 Get the world linear velocity of a world point attached to this body. 5327 5328 Parameters: 5329 ----------- 5330 5331 a: point in world coordinates. 5332 5333 the world velocity of a point. 5334 """ 5335 return _Box2D.b2Body_GetLinearVelocityFromWorldPoint(self, *args)
5336
5337 - def GetLinearVelocityFromLocalPoint(self, *args):
5338 """ 5339 GetLinearVelocityFromLocalPoint(self, b2Vec2 localPoint) -> b2Vec2 5340 5341 Get the world velocity of a local point. 5342 5343 Parameters: 5344 ----------- 5345 5346 a: point in local coordinates. 5347 5348 the world velocity of a point. 5349 """ 5350 return _Box2D.b2Body_GetLinearVelocityFromLocalPoint(self, *args)
5351
5352 - def IsBullet(self):
5353 """ 5354 IsBullet(self) -> bool 5355 5356 Is this body treated like a bullet for continuous collision detection? 5357 """ 5358 return _Box2D.b2Body_IsBullet(self)
5359
5360 - def SetBullet(self, *args):
5361 """ 5362 SetBullet(self, bool flag) 5363 5364 Should this body be treated like a bullet for continuous collision detection? 5365 """ 5366 return _Box2D.b2Body_SetBullet(self, *args)
5367
5368 - def IsStatic(self):
5369 """ 5370 IsStatic(self) -> bool 5371 5372 Is this body static (immovable)? 5373 """ 5374 return _Box2D.b2Body_IsStatic(self)
5375
5376 - def IsDynamic(self):
5377 """ 5378 IsDynamic(self) -> bool 5379 5380 Is this body dynamic (movable)? 5381 """ 5382 return _Box2D.b2Body_IsDynamic(self)
5383
5384 - def IsFrozen(self):
5385 """ 5386 IsFrozen(self) -> bool 5387 5388 Is this body frozen? 5389 """ 5390 return _Box2D.b2Body_IsFrozen(self)
5391
5392 - def IsSleeping(self):
5393 """ 5394 IsSleeping(self) -> bool 5395 5396 Is this body sleeping (not simulating). 5397 """ 5398 return _Box2D.b2Body_IsSleeping(self)
5399
5400 - def AllowSleeping(self, *args):
5401 """ 5402 AllowSleeping(self, bool flag) 5403 5404 You can disable sleeping on this body. 5405 """ 5406 return _Box2D.b2Body_AllowSleeping(self, *args)
5407
5408 - def CanSleep(self):
5409 """ 5410 CanSleep(self) -> bool 5411 5412 Get whether or not this body is allowed to sleep. 5413 """ 5414 return _Box2D.b2Body_CanSleep(self)
5415
5416 - def IsRotationFixed(self):
5417 """ 5418 IsRotationFixed(self) -> bool 5419 5420 Get whether or not this body is allowed to rotate. 5421 """ 5422 return _Box2D.b2Body_IsRotationFixed(self)
5423
5424 - def WakeUp(self):
5425 """ 5426 WakeUp(self) 5427 5428 Wake up this body so it will begin simulating. 5429 """ 5430 return _Box2D.b2Body_WakeUp(self)
5431
5432 - def PutToSleep(self):
5433 """ 5434 PutToSleep(self) 5435 5436 Put this body to sleep so it will stop simulating. This also sets the velocity to zero. 5437 """ 5438 return _Box2D.b2Body_PutToSleep(self)
5439
5440 - def _GetShapeList(self):
5441 """ 5442 _GetShapeList(self) -> b2Shape 5443 5444 Get the list of all shapes attached to this body. 5445 """ 5446 return _Box2D.b2Body__GetShapeList(self)
5447
5448 - def GetJointList(self):
5449 """ 5450 GetJointList(self) -> b2JointEdge 5451 5452 Get the list of all joints attached to this body. 5453 """ 5454 return _Box2D.b2Body_GetJointList(self)
5455
5456 - def GetControllerList(self):
5457 """ 5458 GetControllerList(self) -> b2ControllerEdge 5459 5460 Get the list of all controllers attached to this body. 5461 """ 5462 return _Box2D.b2Body_GetControllerList(self)
5463
5464 - def GetNext(self):
5465 """ 5466 GetNext(self) -> b2Body 5467 5468 Get the next body in the world's body list. 5469 """ 5470 return _Box2D.b2Body_GetNext(self)
5471
5472 - def GetWorld(self):
5473 """ 5474 GetWorld(self) -> b2World 5475 5476 Get the parent world of this body. 5477 """ 5478 return _Box2D.b2Body_GetWorld(self)
5479
5480 - def __repr__(self):
5481 return """b2Body( 5482 allowSleep = %s, 5483 angle = %s, 5484 angularDamping = %s, 5485 angularVelocity = %s, 5486 fixedRotation = %s, 5487 isBullet = %s, 5488 isSleeping = %s, 5489 linearDamping = %s, 5490 linearVelocity = %s, 5491 massData = %s, 5492 position = %s, 5493 userData = %s, 5494 GetInertia() = %s, 5495 GetLocalCenter() = %s, 5496 GetMass() = %s, 5497 GetWorldCenter() = %s, 5498 GetXForm() = %s, 5499 IsBullet() = %s, 5500 IsDynamic() = %s, 5501 IsFrozen() = %s, 5502 IsRotationFixed() = %s, 5503 IsSleeping() = %s, 5504 IsStatic() = %s)"""% tuple(str(a) for a in\ 5505 (self.allowSleep,self.angle,self.angularDamping,self.angularVelocity,self.fixedRotation,self.isBullet,self.isSleeping,self.linearDamping,self.linearVelocity,self.massData,self.position,self.userData,self.GetInertia(),self.GetLocalCenter(),self.GetMass(),self.GetWorldCenter(),self.GetXForm(),self.IsBullet(),self.IsDynamic(),self.IsFrozen(),self.IsRotationFixed(),self.IsSleeping(),self.IsStatic()))
5506 5507 __getstate__=_pickle_body_getstate 5508 __setstate__=_pickle_factory_set 5509 _pickle_finalize=_pickle_finalize 5510
5511 - def DestroyShape(self, *args):
5512 """ 5513 DestroyShape(self, b2Shape shape) 5514 5515 Destroy a shape. This removes the shape from the broad-phase and therefore destroys any contacts associated with this shape. All shapes attached to a body are implicitly destroyed when the body is destroyed. 5516 5517 Parameters: 5518 ----------- 5519 5520 shape: the shape to be removed. 5521 5522 WARNING: 5523 This function is locked during callbacks. 5524 """ 5525 return _Box2D.b2Body_DestroyShape(self, *args)
5526
5527 - def CreateShape(self, *args):
5528 """ 5529 CreateShape(self, b2ShapeDef defn) -> b2Shape 5530 5531 Creates a shape and attach it to this body. 5532 5533 Parameters: 5534 ----------- 5535 5536 shapeDef: the shape definition. 5537 5538 WARNING: 5539 This function is locked during callbacks. 5540 """ 5541 return _Box2D.b2Body_CreateShape(self, *args)
5542
5543 - def GetUserData(self):
5544 """ 5545 GetUserData(self) -> PyObject 5546 5547 Get the user data pointer that was provided in the body definition. 5548 """ 5549 return _Box2D.b2Body_GetUserData(self)
5550
5551 - def SetUserData(self, *args):
5552 """ 5553 SetUserData(self, PyObject data) 5554 5555 Set the user data. Use this to store your application specific data. 5556 """ 5557 return _Box2D.b2Body_SetUserData(self, *args)
5558
5559 - def ClearUserData(self):
5560 """ClearUserData(self)""" 5561 return _Box2D.b2Body_ClearUserData(self)
5562 5563 userData = property(GetUserData, SetUserData) 5564
5565 - def __hash__(self):
5566 """__hash__(self) -> int32""" 5567 return _Box2D.b2Body___hash__(self)
5568 5569 __eq__ = b2BodyCompare 5570 __ne__ = lambda self,other: not b2BodyCompare(self,other) 5571
5572 - def setAngle(self, angle):
5573 """ 5574 Set the angle without altering the position 5575 5576 angle in radians. 5577 """ 5578 self.SetXForm(self.position, angle)
5579 - def setPosition(self, position):
5580 """ 5581 Set the position without altering the angle 5582 """ 5583 self.SetXForm(position, self.GetAngle())
5584
5585 - def getMassData(self):
5586 """ 5587 Get a b2MassData object that represents this b2Body 5588 5589 NOTE: To just get the mass, use body.mass (body.GetMass()) 5590 """ 5591 5592 ret = b2MassData() 5593 ret.mass = self.GetMass() 5594 ret.I = self.GetInertia() 5595 ret.center=self.GetLocalCenter() 5596 return ret
5597
5598 - def GetShapeList(self, asType=True):
5599 """ 5600 Get a list of the shapes in this body 5601 5602 Defaults to returning the typecasted objects. 5603 5604 e.g., if there is a b2CircleShape and a b2PolygonShape: 5605 GetShapeList(True) = [b2CircleShape, b2PolygonShape] 5606 GetShapeList(False)= [b2Shape, b2Shape] 5607 """ 5608 shapeList = [] 5609 shape = self._GetShapeList() 5610 while shape: 5611 if asType: 5612 shape=shape.getAsType() 5613 shapeList.append(shape) 5614 shape = shape.GetNext() 5615 shapeList.reverse() # shapelist is in reverse order 5616 return shapeList
5617
5618 - def __iter__(self):
5619 """ 5620 Iterates over the shapes in the body 5621 """ 5622 for shape in self.shapeList: 5623 yield shape
5624 5625 massData = property(getMassData , SetMass) 5626 position = property(GetPosition , setPosition) 5627 angle = property(GetAngle , setAngle) 5628 linearDamping = property(GetLinearDamping , None) 5629 angularDamping= property(GetAngularDamping , None) 5630 allowSleep = property(CanSleep , AllowSleeping) 5631 isSleeping = property(IsSleeping , None) 5632 fixedRotation = property(IsRotationFixed , None) 5633 isBullet = property(IsBullet , SetBullet) 5634 angularVelocity=property(GetAngularVelocity , SetAngularVelocity) 5635 linearVelocity =property(GetLinearVelocity , SetLinearVelocity) 5636 shapeList =property(GetShapeList , None)
5637 5638 b2Body.SetMass = new_instancemethod(_Box2D.b2Body_SetMass,None,b2Body) 5639 b2Body.SetMassFromShapes = new_instancemethod(_Box2D.b2Body_SetMassFromShapes,None,b2Body) 5640 b2Body.SetXForm = new_instancemethod(_Box2D.b2Body_SetXForm,None,b2Body) 5641 b2Body.GetXForm = new_instancemethod(_Box2D.b2Body_GetXForm,None,b2Body) 5642 b2Body.GetPosition = new_instancemethod(_Box2D.b2Body_GetPosition,None,b2Body) 5643 b2Body.GetAngle = new_instancemethod(_Box2D.b2Body_GetAngle,None,b2Body) 5644 b2Body.GetLinearDamping = new_instancemethod(_Box2D.b2Body_GetLinearDamping,None,b2Body) 5645 b2Body.GetAngularDamping = new_instancemethod(_Box2D.b2Body_GetAngularDamping,None,b2Body) 5646 b2Body.GetWorldCenter = new_instancemethod(_Box2D.b2Body_GetWorldCenter,None,b2Body) 5647 b2Body.GetLocalCenter = new_instancemethod(_Box2D.b2Body_GetLocalCenter,None,b2Body) 5648 b2Body.SetLinearVelocity = new_instancemethod(_Box2D.b2Body_SetLinearVelocity,None,b2Body) 5649 b2Body.GetLinearVelocity = new_instancemethod(_Box2D.b2Body_GetLinearVelocity,None,b2Body) 5650 b2Body.SetAngularVelocity = new_instancemethod(_Box2D.b2Body_SetAngularVelocity,None,b2Body) 5651 b2Body.GetAngularVelocity = new_instancemethod(_Box2D.b2Body_GetAngularVelocity,None,b2Body) 5652 b2Body.ApplyForce = new_instancemethod(_Box2D.b2Body_ApplyForce,None,b2Body) 5653 b2Body.ApplyTorque = new_instancemethod(_Box2D.b2Body_ApplyTorque,None,b2Body) 5654 b2Body.ApplyImpulse = new_instancemethod(_Box2D.b2Body_ApplyImpulse,None,b2Body) 5655 b2Body.GetMass = new_instancemethod(_Box2D.b2Body_GetMass,None,b2Body) 5656 b2Body.GetInertia = new_instancemethod(_Box2D.b2Body_GetInertia,None,b2Body) 5657 b2Body.GetWorldPoint = new_instancemethod(_Box2D.b2Body_GetWorldPoint,None,b2Body) 5658 b2Body.GetWorldVector = new_instancemethod(_Box2D.b2Body_GetWorldVector,None,b2Body) 5659 b2Body.GetLocalPoint = new_instancemethod(_Box2D.b2Body_GetLocalPoint,None,b2Body) 5660 b2Body.GetLocalVector = new_instancemethod(_Box2D.b2Body_GetLocalVector,None,b2Body) 5661 b2Body.GetLinearVelocityFromWorldPoint = new_instancemethod(_Box2D.b2Body_GetLinearVelocityFromWorldPoint,None,b2Body) 5662 b2Body.GetLinearVelocityFromLocalPoint = new_instancemethod(_Box2D.b2Body_GetLinearVelocityFromLocalPoint,None,b2Body) 5663 b2Body.IsBullet = new_instancemethod(_Box2D.b2Body_IsBullet,None,b2Body) 5664 b2Body.SetBullet = new_instancemethod(_Box2D.b2Body_SetBullet,None,b2Body) 5665 b2Body.IsStatic = new_instancemethod(_Box2D.b2Body_IsStatic,None,b2Body) 5666 b2Body.IsDynamic = new_instancemethod(_Box2D.b2Body_IsDynamic,None,b2Body) 5667 b2Body.IsFrozen = new_instancemethod(_Box2D.b2Body_IsFrozen,None,b2Body) 5668 b2Body.IsSleeping = new_instancemethod(_Box2D.b2Body_IsSleeping,None,b2Body) 5669 b2Body.AllowSleeping = new_instancemethod(_Box2D.b2Body_AllowSleeping,None,b2Body) 5670 b2Body.CanSleep = new_instancemethod(_Box2D.b2Body_CanSleep,None,b2Body) 5671 b2Body.IsRotationFixed = new_instancemethod(_Box2D.b2Body_IsRotationFixed,None,b2Body) 5672 b2Body.WakeUp = new_instancemethod(_Box2D.b2Body_WakeUp,None,b2Body) 5673 b2Body.PutToSleep = new_instancemethod(_Box2D.b2Body_PutToSleep,None,b2Body) 5674 b2Body._GetShapeList = new_instancemethod(_Box2D.b2Body__GetShapeList,None,b2Body) 5675 b2Body.GetJointList = new_instancemethod(_Box2D.b2Body_GetJointList,None,b2Body) 5676 b2Body.GetControllerList = new_instancemethod(_Box2D.b2Body_GetControllerList,None,b2Body) 5677 b2Body.GetNext = new_instancemethod(_Box2D.b2Body_GetNext,None,b2Body) 5678 b2Body.GetWorld = new_instancemethod(_Box2D.b2Body_GetWorld,None,b2Body) 5679 b2Body.DestroyShape = new_instancemethod(_Box2D.b2Body_DestroyShape,None,b2Body) 5680 b2Body.CreateShape = new_instancemethod(_Box2D.b2Body_CreateShape,None,b2Body) 5681 b2Body.GetUserData = new_instancemethod(_Box2D.b2Body_GetUserData,None,b2Body) 5682 b2Body.SetUserData = new_instancemethod(_Box2D.b2Body_SetUserData,None,b2Body) 5683 b2Body.ClearUserData = new_instancemethod(_Box2D.b2Body_ClearUserData,None,b2Body) 5684 b2Body.__hash__ = new_instancemethod(_Box2D.b2Body___hash__,None,b2Body) 5685 b2Body_swigregister = _Box2D.b2Body_swigregister 5686 b2Body_swigregister(b2Body) 5687
5688 -class b2BuoyancyController(b2Controller):
5689 """Calculates buoyancy forces for fluids in the form of a half plane.""" 5690 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
5691 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
5692 __repr__ = _swig_repr 5693 normal = _swig_property(_Box2D.b2BuoyancyController_normal_get, _Box2D.b2BuoyancyController_normal_set) 5694 offset = _swig_property(_Box2D.b2BuoyancyController_offset_get, _Box2D.b2BuoyancyController_offset_set) 5695 density = _swig_property(_Box2D.b2BuoyancyController_density_get, _Box2D.b2BuoyancyController_density_set) 5696 velocity = _swig_property(_Box2D.b2BuoyancyController_velocity_get, _Box2D.b2BuoyancyController_velocity_set) 5697 linearDrag = _swig_property(_Box2D.b2BuoyancyController_linearDrag_get, _Box2D.b2BuoyancyController_linearDrag_set) 5698 angularDrag = _swig_property(_Box2D.b2BuoyancyController_angularDrag_get, _Box2D.b2BuoyancyController_angularDrag_set) 5699 useDensity = _swig_property(_Box2D.b2BuoyancyController_useDensity_get, _Box2D.b2BuoyancyController_useDensity_set) 5700 useWorldGravity = _swig_property(_Box2D.b2BuoyancyController_useWorldGravity_get, _Box2D.b2BuoyancyController_useWorldGravity_set) 5701 gravity = _swig_property(_Box2D.b2BuoyancyController_gravity_get, _Box2D.b2BuoyancyController_gravity_set)
5702 - def __repr__(self):
5703 return """b2BuoyancyController( 5704 angularDrag = %s, 5705 density = %s, 5706 gravity = %s, 5707 linearDrag = %s, 5708 normal = %s, 5709 offset = %s, 5710 useDensity = %s, 5711 useWorldGravity = %s, 5712 velocity = %s)"""% tuple(str(a) for a in\ 5713 (self.angularDrag,self.density,self.gravity,self.linearDrag,self.normal,self.offset,self.useDensity,self.useWorldGravity,self.velocity))
5714 5715 __getstate__=_pickle_get_controller 5716 __setstate__=_pickle_factory_set 5717 _pickle_finalize=_pickle_finalize_controller 5718 5719 __swig_destroy__ = _Box2D.delete_b2BuoyancyController
5720 b2BuoyancyController_swigregister = _Box2D.b2BuoyancyController_swigregister 5721 b2BuoyancyController_swigregister(b2BuoyancyController) 5722
5723 -class b2BuoyancyControllerDef(b2ControllerDef):
5724 """This class is used to build buoyancy controllers.""" 5725 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5726 __repr__ = _swig_repr 5727 normal = _swig_property(_Box2D.b2BuoyancyControllerDef_normal_get, _Box2D.b2BuoyancyControllerDef_normal_set) 5728 offset = _swig_property(_Box2D.b2BuoyancyControllerDef_offset_get, _Box2D.b2BuoyancyControllerDef_offset_set) 5729 density = _swig_property(_Box2D.b2BuoyancyControllerDef_density_get, _Box2D.b2BuoyancyControllerDef_density_set) 5730 velocity = _swig_property(_Box2D.b2BuoyancyControllerDef_velocity_get, _Box2D.b2BuoyancyControllerDef_velocity_set) 5731 linearDrag = _swig_property(_Box2D.b2BuoyancyControllerDef_linearDrag_get, _Box2D.b2BuoyancyControllerDef_linearDrag_set) 5732 angularDrag = _swig_property(_Box2D.b2BuoyancyControllerDef_angularDrag_get, _Box2D.b2BuoyancyControllerDef_angularDrag_set) 5733 useDensity = _swig_property(_Box2D.b2BuoyancyControllerDef_useDensity_get, _Box2D.b2BuoyancyControllerDef_useDensity_set) 5734 useWorldGravity = _swig_property(_Box2D.b2BuoyancyControllerDef_useWorldGravity_get, _Box2D.b2BuoyancyControllerDef_useWorldGravity_set) 5735 gravity = _swig_property(_Box2D.b2BuoyancyControllerDef_gravity_get, _Box2D.b2BuoyancyControllerDef_gravity_set)
5736 - def __init__(self):
5737 """ 5738 __init__(self) -> b2BuoyancyControllerDef 5739 5740 This class is used to build buoyancy controllers. 5741 """ 5742 _Box2D.b2BuoyancyControllerDef_swiginit(self,_Box2D.new_b2BuoyancyControllerDef())
5743 - def __repr__(self):
5744 return """b2BuoyancyControllerDef( 5745 angularDrag = %s, 5746 density = %s, 5747 gravity = %s, 5748 linearDrag = %s, 5749 normal = %s, 5750 offset = %s, 5751 useDensity = %s, 5752 useWorldGravity = %s, 5753 velocity = %s)"""% tuple(str(a) for a in\ 5754 (self.angularDrag,self.density,self.gravity,self.linearDrag,self.normal,self.offset,self.useDensity,self.useWorldGravity,self.velocity))
5755 5756 __getstate__=_generic_getstate 5757 __setstate__=_generic_setstate 5758 5759 __swig_destroy__ = _Box2D.delete_b2BuoyancyControllerDef 5760 b2BuoyancyControllerDef_swigregister = _Box2D.b2BuoyancyControllerDef_swigregister 5761 b2BuoyancyControllerDef_swigregister(b2BuoyancyControllerDef) 5762
5763 -class b2ConstantAccelController(b2Controller):
5764 """Applies a force every frame.""" 5765 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
5766 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
5767 __repr__ = _swig_repr 5768 A = _swig_property(_Box2D.b2ConstantAccelController_A_get, _Box2D.b2ConstantAccelController_A_set)
5769 - def __repr__(self):
5770 return """b2ConstantAccelController( 5771 A = %s)"""% tuple(str(a) for a in\ 5772 (self.A))
5773 5774 __getstate__=_pickle_get_controller 5775 __setstate__=_pickle_factory_set 5776 _pickle_finalize=_pickle_finalize_controller 5777 5778 __swig_destroy__ = _Box2D.delete_b2ConstantAccelController
5779 b2ConstantAccelController_swigregister = _Box2D.b2ConstantAccelController_swigregister 5780 b2ConstantAccelController_swigregister(b2ConstantAccelController) 5781
5782 -class b2ConstantAccelControllerDef(b2ControllerDef):
5783 """This class is used to build constant acceleration controllers.""" 5784 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5785 __repr__ = _swig_repr 5786 A = _swig_property(_Box2D.b2ConstantAccelControllerDef_A_get, _Box2D.b2ConstantAccelControllerDef_A_set)
5787 - def __repr__(self):
5788 return """b2ConstantAccelControllerDef( 5789 A = %s)"""% tuple(str(a) for a in\ 5790 (self.A))
5791 5792 __getstate__=_generic_getstate 5793 __setstate__=_generic_setstate 5794
5795 - def __init__(self):
5796 """__init__(self) -> b2ConstantAccelControllerDef""" 5797 _Box2D.b2ConstantAccelControllerDef_swiginit(self,_Box2D.new_b2ConstantAccelControllerDef())
5798 __swig_destroy__ = _Box2D.delete_b2ConstantAccelControllerDef 5799 b2ConstantAccelControllerDef_swigregister = _Box2D.b2ConstantAccelControllerDef_swigregister 5800 b2ConstantAccelControllerDef_swigregister(b2ConstantAccelControllerDef) 5801
5802 -class b2ConstantForceController(b2Controller):
5803 """Applies a force every frame.""" 5804 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
5805 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
5806 __repr__ = _swig_repr 5807 F = _swig_property(_Box2D.b2ConstantForceController_F_get, _Box2D.b2ConstantForceController_F_set)
5808 - def __repr__(self):
5809 return """b2ConstantForceController( 5810 F = %s)"""% tuple(str(a) for a in\ 5811 (self.F))
5812 5813 __getstate__=_pickle_get_controller 5814 __setstate__=_pickle_factory_set 5815 _pickle_finalize=_pickle_finalize_controller 5816 5817 __swig_destroy__ = _Box2D.delete_b2ConstantForceController
5818 b2ConstantForceController_swigregister = _Box2D.b2ConstantForceController_swigregister 5819 b2ConstantForceController_swigregister(b2ConstantForceController) 5820
5821 -class b2ConstantForceControllerDef(b2ControllerDef):
5822 """This class is used to build constant force controllers.""" 5823 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5824 __repr__ = _swig_repr 5825 F = _swig_property(_Box2D.b2ConstantForceControllerDef_F_get, _Box2D.b2ConstantForceControllerDef_F_set)
5826 - def __repr__(self):
5827 return """b2ConstantForceControllerDef( 5828 F = %s)"""% tuple(str(a) for a in\ 5829 (self.F))
5830 5831 __getstate__=_generic_getstate 5832 __setstate__=_generic_setstate 5833
5834 - def __init__(self):
5835 """__init__(self) -> b2ConstantForceControllerDef""" 5836 _Box2D.b2ConstantForceControllerDef_swiginit(self,_Box2D.new_b2ConstantForceControllerDef())
5837 __swig_destroy__ = _Box2D.delete_b2ConstantForceControllerDef 5838 b2ConstantForceControllerDef_swigregister = _Box2D.b2ConstantForceControllerDef_swigregister 5839 b2ConstantForceControllerDef_swigregister(b2ConstantForceControllerDef) 5840
5841 -class b2GravityController(b2Controller):
5842 """Applies simplified gravity between every pair of bodies.""" 5843 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
5844 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
5845 __repr__ = _swig_repr 5846 G = _swig_property(_Box2D.b2GravityController_G_get, _Box2D.b2GravityController_G_set) 5847 invSqr = _swig_property(_Box2D.b2GravityController_invSqr_get, _Box2D.b2GravityController_invSqr_set)
5848 - def __repr__(self):
5849 return """b2GravityController( 5850 G = %s, 5851 invSqr = %s)"""% tuple(str(a) for a in\ 5852 (self.G,self.invSqr))
5853 5854 __getstate__=_pickle_get_controller 5855 __setstate__=_pickle_factory_set 5856 _pickle_finalize=_pickle_finalize_controller 5857 5858 __swig_destroy__ = _Box2D.delete_b2GravityController
5859 b2GravityController_swigregister = _Box2D.b2GravityController_swigregister 5860 b2GravityController_swigregister(b2GravityController) 5861
5862 -class b2GravityControllerDef(b2ControllerDef):
5863 """This class is used to build gravity controllers.""" 5864 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5865 __repr__ = _swig_repr 5866 G = _swig_property(_Box2D.b2GravityControllerDef_G_get, _Box2D.b2GravityControllerDef_G_set) 5867 invSqr = _swig_property(_Box2D.b2GravityControllerDef_invSqr_get, _Box2D.b2GravityControllerDef_invSqr_set)
5868 - def __repr__(self):
5869 return """b2GravityControllerDef( 5870 G = %s, 5871 invSqr = %s)"""% tuple(str(a) for a in\ 5872 (self.G,self.invSqr))
5873 5874 __getstate__=_generic_getstate 5875 __setstate__=_generic_setstate 5876
5877 - def __init__(self):
5878 """__init__(self) -> b2GravityControllerDef""" 5879 _Box2D.b2GravityControllerDef_swiginit(self,_Box2D.new_b2GravityControllerDef())
5880 __swig_destroy__ = _Box2D.delete_b2GravityControllerDef 5881 b2GravityControllerDef_swigregister = _Box2D.b2GravityControllerDef_swigregister 5882 b2GravityControllerDef_swigregister(b2GravityControllerDef) 5883
5884 -class b2TensorDampingController(b2Controller):
5885 """Applies top down linear damping to the controlled bodies The damping is calculated by multiplying velocity by a matrix in local co-ordinates.""" 5886 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
5887 - def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
5888 __repr__ = _swig_repr 5889 T = _swig_property(_Box2D.b2TensorDampingController_T_get, _Box2D.b2TensorDampingController_T_set) 5890 maxTimestep = _swig_property(_Box2D.b2TensorDampingController_maxTimestep_get, _Box2D.b2TensorDampingController_maxTimestep_set)
5891 - def __repr__(self):
5892 return """b2TensorDampingController( 5893 T = %s, 5894 maxTimestep = %s)"""% tuple(str(a) for a in\ 5895 (self.T,self.maxTimestep))
5896 5897 __getstate__=_pickle_get_controller 5898 __setstate__=_pickle_factory_set 5899 _pickle_finalize=_pickle_finalize_controller 5900 5901 __swig_destroy__ = _Box2D.delete_b2TensorDampingController
5902 b2TensorDampingController_swigregister = _Box2D.b2TensorDampingController_swigregister 5903 b2TensorDampingController_swigregister(b2TensorDampingController) 5904
5905 -class b2TensorDampingControllerDef(b2ControllerDef):
5906 """This class is used to build tensor damping controllers.""" 5907 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5908 __repr__ = _swig_repr 5909 T = _swig_property(_Box2D.b2TensorDampingControllerDef_T_get, _Box2D.b2TensorDampingControllerDef_T_set) 5910 maxTimestep = _swig_property(_Box2D.b2TensorDampingControllerDef_maxTimestep_get, _Box2D.b2TensorDampingControllerDef_maxTimestep_set)
5911 - def SetAxisAligned(self, *args):
5912 """ 5913 SetAxisAligned(self, float32 xDamping, float32 yDamping) 5914 5915 Sets damping independantly along the x and y axes. 5916 """ 5917 return _Box2D.b2TensorDampingControllerDef_SetAxisAligned(self, *args)
5918
5919 - def __repr__(self):
5920 return """b2TensorDampingControllerDef( 5921 T = %s, 5922 maxTimestep = %s)"""% tuple(str(a) for a in\ 5923 (self.T,self.maxTimestep))
5924 5925 __getstate__=_generic_getstate 5926 __setstate__=_generic_setstate 5927
5928 - def __init__(self):
5929 """__init__(self) -> b2TensorDampingControllerDef""" 5930 _Box2D.b2TensorDampingControllerDef_swiginit(self,_Box2D.new_b2TensorDampingControllerDef())
5931 __swig_destroy__ = _Box2D.delete_b2TensorDampingControllerDef 5932 b2TensorDampingControllerDef.SetAxisAligned = new_instancemethod(_Box2D.b2TensorDampingControllerDef_SetAxisAligned,None,b2TensorDampingControllerDef) 5933 b2TensorDampingControllerDef_swigregister = _Box2D.b2TensorDampingControllerDef_swigregister 5934 b2TensorDampingControllerDef_swigregister(b2TensorDampingControllerDef) 5935
5936 -class b2DistanceJointDef(b2JointDef):
5937 """ 5938 Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. 5939 WARNING: 5940 Do not use a zero or short length. 5941 """ 5942 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5943 __repr__ = _swig_repr
5944 - def __init__(self):
5945 """ 5946 __init__(self) -> b2DistanceJointDef 5947 5948 Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. 5949 WARNING: 5950 Do not use a zero or short length. 5951 """ 5952 _Box2D.b2DistanceJointDef_swiginit(self,_Box2D.new_b2DistanceJointDef())
5953 - def Initialize(self, *args):
5954 """ 5955 Initialize(self, b2Body body1, b2Body body2, b2Vec2 anchor1, b2Vec2 anchor2) 5956 5957 Initialize the bodies, anchors, and length using the world anchors. 5958 """ 5959 return _Box2D.b2DistanceJointDef_Initialize(self, *args)
5960 5961 localAnchor1 = _swig_property(_Box2D.b2DistanceJointDef_localAnchor1_get, _Box2D.b2DistanceJointDef_localAnchor1_set) 5962 localAnchor2 = _swig_property(_Box2D.b2DistanceJointDef_localAnchor2_get, _Box2D.b2DistanceJointDef_localAnchor2_set) 5963 length = _swig_property(_Box2D.b2DistanceJointDef_length_get, _Box2D.b2DistanceJointDef_length_set) 5964 frequencyHz = _swig_property(_Box2D.b2DistanceJointDef_frequencyHz_get, _Box2D.b2DistanceJointDef_frequencyHz_set) 5965 dampingRatio = _swig_property(_Box2D.b2DistanceJointDef_dampingRatio_get, _Box2D.b2DistanceJointDef_dampingRatio_set)
5966 - def __repr__(self):
5967 return """b2DistanceJointDef( 5968 body1 = %s, 5969 body2 = %s, 5970 collideConnected = %s, 5971 dampingRatio = %s, 5972 frequencyHz = %s, 5973 length = %s, 5974 localAnchor1 = %s, 5975 localAnchor2 = %s, 5976 type = %s, 5977 userData = %s)"""% tuple(str(a) for a in\ 5978 (self.body1,self.body2,self.collideConnected,self.dampingRatio,self.frequencyHz,self.length,self.localAnchor1,self.localAnchor2,self.type,self.userData))
5979 5980 __getstate__=_generic_getstate 5981 __setstate__=_generic_setstate 5982 5983 __swig_destroy__ = _Box2D.delete_b2DistanceJointDef 5984 b2DistanceJointDef.Initialize = new_instancemethod(_Box2D.b2DistanceJointDef_Initialize,None,b2DistanceJointDef) 5985 b2DistanceJointDef_swigregister = _Box2D.b2DistanceJointDef_swigregister 5986 b2DistanceJointDef_swigregister(b2DistanceJointDef) 5987
5988 -class b2DistanceJoint(b2Joint):
5989 """A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.""" 5990 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 5991 __repr__ = _swig_repr
5992 - def __init__(self, *args):
5993 """ 5994 __init__(self, b2DistanceJointDef data) -> b2DistanceJoint 5995 5996 A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod. 5997 """ 5998 _Box2D.b2DistanceJoint_swiginit(self,_Box2D.new_b2DistanceJoint(*args))
5999 - def InitVelocityConstraints(self, *args):
6000 """InitVelocityConstraints(self, b2TimeStep step)""" 6001 return _Box2D.b2DistanceJoint_InitVelocityConstraints(self, *args)
6002
6003 - def SolveVelocityConstraints(self, *args):
6004 """SolveVelocityConstraints(self, b2TimeStep step)""" 6005 return _Box2D.b2DistanceJoint_SolveVelocityConstraints(self, *args)
6006
6007 - def SolvePositionConstraints(self, *args):
6008 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 6009 return _Box2D.b2DistanceJoint_SolvePositionConstraints(self, *args)
6010 6011 localAnchor1 = _swig_property(_Box2D.b2DistanceJoint_localAnchor1_get, _Box2D.b2DistanceJoint_localAnchor1_set) 6012 localAnchor2 = _swig_property(_Box2D.b2DistanceJoint_localAnchor2_get, _Box2D.b2DistanceJoint_localAnchor2_set) 6013 u = _swig_property(_Box2D.b2DistanceJoint_u_get, _Box2D.b2DistanceJoint_u_set) 6014 frequencyHz = _swig_property(_Box2D.b2DistanceJoint_frequencyHz_get, _Box2D.b2DistanceJoint_frequencyHz_set) 6015 dampingRatio = _swig_property(_Box2D.b2DistanceJoint_dampingRatio_get, _Box2D.b2DistanceJoint_dampingRatio_set) 6016 gamma = _swig_property(_Box2D.b2DistanceJoint_gamma_get, _Box2D.b2DistanceJoint_gamma_set) 6017 bias = _swig_property(_Box2D.b2DistanceJoint_bias_get, _Box2D.b2DistanceJoint_bias_set) 6018 impulse = _swig_property(_Box2D.b2DistanceJoint_impulse_get, _Box2D.b2DistanceJoint_impulse_set) 6019 mass = _swig_property(_Box2D.b2DistanceJoint_mass_get, _Box2D.b2DistanceJoint_mass_set) 6020 length = _swig_property(_Box2D.b2DistanceJoint_length_get, _Box2D.b2DistanceJoint_length_set)
6021 - def __repr__(self):
6022 return """b2DistanceJoint( 6023 bias = %s, 6024 body1 = %s, 6025 body2 = %s, 6026 collideConnected = %s, 6027 dampingRatio = %s, 6028 frequencyHz = %s, 6029 gamma = %s, 6030 impulse = %s, 6031 length = %s, 6032 localAnchor1 = %s, 6033 localAnchor2 = %s, 6034 mass = %s, 6035 type = %s, 6036 u = %s, 6037 userData = %s, 6038 GetAnchor1() = %s, 6039 GetAnchor2() = %s)"""% tuple(str(a) for a in\ 6040 (self.bias,self.body1,self.body2,self.collideConnected,self.dampingRatio,self.frequencyHz,self.gamma,self.impulse,self.length,self.localAnchor1,self.localAnchor2,self.mass,self.type,self.u,self.userData,self.GetAnchor1(),self.GetAnchor2()))
6041 6042 __getstate__=_pickle_get_joint 6043 __setstate__=_pickle_factory_set 6044 _pickle_finalize=_pickle_finalize_joint 6045 6046 __swig_destroy__ = _Box2D.delete_b2DistanceJoint 6047 b2DistanceJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2DistanceJoint_InitVelocityConstraints,None,b2DistanceJoint) 6048 b2DistanceJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2DistanceJoint_SolveVelocityConstraints,None,b2DistanceJoint) 6049 b2DistanceJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2DistanceJoint_SolvePositionConstraints,None,b2DistanceJoint) 6050 b2DistanceJoint_swigregister = _Box2D.b2DistanceJoint_swigregister 6051 b2DistanceJoint_swigregister(b2DistanceJoint) 6052
6053 -class b2GearJointDef(b2JointDef):
6054 """Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body.""" 6055 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6056 __repr__ = _swig_repr
6057 - def __init__(self):
6058 """ 6059 __init__(self) -> b2GearJointDef 6060 6061 Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body. 6062 """ 6063 _Box2D.b2GearJointDef_swiginit(self,_Box2D.new_b2GearJointDef())
6064 joint1 = _swig_property(_Box2D.b2GearJointDef_joint1_get, _Box2D.b2GearJointDef_joint1_set) 6065 joint2 = _swig_property(_Box2D.b2GearJointDef_joint2_get, _Box2D.b2GearJointDef_joint2_set) 6066 ratio = _swig_property(_Box2D.b2GearJointDef_ratio_get, _Box2D.b2GearJointDef_ratio_set)
6067 - def __repr__(self):
6068 return """b2GearJointDef( 6069 body1 = %s, 6070 body2 = %s, 6071 collideConnected = %s, 6072 joint1 = %s, 6073 joint2 = %s, 6074 ratio = %s, 6075 type = %s, 6076 userData = %s)"""% tuple(str(a) for a in\ 6077 (self.body1,self.body2,self.collideConnected,self.joint1,self.joint2,self.ratio,self.type,self.userData))
6078 6079 __getstate__=_generic_getstate 6080 __setstate__=_generic_setstate 6081 6082 __swig_destroy__ = _Box2D.delete_b2GearJointDef 6083 b2GearJointDef_swigregister = _Box2D.b2GearJointDef_swigregister 6084 b2GearJointDef_swigregister(b2GearJointDef) 6085
6086 -class b2GearJoint(b2Joint):
6087 """ 6088 A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length. 6089 WARNING: 6090 The revolute and prismatic joints must be attached to fixed bodies (which must be body1 on those joints). 6091 """ 6092 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6093 __repr__ = _swig_repr
6094 - def GetRatio(self):
6095 """ 6096 GetRatio(self) -> float32 6097 6098 Get the gear ratio. 6099 """ 6100 return _Box2D.b2GearJoint_GetRatio(self)
6101
6102 - def __init__(self, *args):
6103 """ 6104 __init__(self, b2GearJointDef data) -> b2GearJoint 6105 6106 A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length. 6107 WARNING: 6108 The revolute and prismatic joints must be attached to fixed bodies (which must be body1 on those joints). 6109 """ 6110 _Box2D.b2GearJoint_swiginit(self,_Box2D.new_b2GearJoint(*args))
6111 - def InitVelocityConstraints(self, *args):
6112 """InitVelocityConstraints(self, b2TimeStep step)""" 6113 return _Box2D.b2GearJoint_InitVelocityConstraints(self, *args)
6114
6115 - def SolveVelocityConstraints(self, *args):
6116 """SolveVelocityConstraints(self, b2TimeStep step)""" 6117 return _Box2D.b2GearJoint_SolveVelocityConstraints(self, *args)
6118
6119 - def SolvePositionConstraints(self, *args):
6120 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 6121 return _Box2D.b2GearJoint_SolvePositionConstraints(self, *args)
6122 6123 ground1 = _swig_property(_Box2D.b2GearJoint_ground1_get, _Box2D.b2GearJoint_ground1_set) 6124 ground2 = _swig_property(_Box2D.b2GearJoint_ground2_get, _Box2D.b2GearJoint_ground2_set) 6125 revolute1 = _swig_property(_Box2D.b2GearJoint_revolute1_get, _Box2D.b2GearJoint_revolute1_set) 6126 prismatic1 = _swig_property(_Box2D.b2GearJoint_prismatic1_get, _Box2D.b2GearJoint_prismatic1_set) 6127 revolute2 = _swig_property(_Box2D.b2GearJoint_revolute2_get, _Box2D.b2GearJoint_revolute2_set) 6128 prismatic2 = _swig_property(_Box2D.b2GearJoint_prismatic2_get, _Box2D.b2GearJoint_prismatic2_set) 6129 groundAnchor1 = _swig_property(_Box2D.b2GearJoint_groundAnchor1_get, _Box2D.b2GearJoint_groundAnchor1_set) 6130 groundAnchor2 = _swig_property(_Box2D.b2GearJoint_groundAnchor2_get, _Box2D.b2GearJoint_groundAnchor2_set) 6131 localAnchor1 = _swig_property(_Box2D.b2GearJoint_localAnchor1_get, _Box2D.b2GearJoint_localAnchor1_set) 6132 localAnchor2 = _swig_property(_Box2D.b2GearJoint_localAnchor2_get, _Box2D.b2GearJoint_localAnchor2_set) 6133 J = _swig_property(_Box2D.b2GearJoint_J_get, _Box2D.b2GearJoint_J_set) 6134 constant = _swig_property(_Box2D.b2GearJoint_constant_get, _Box2D.b2GearJoint_constant_set) 6135 ratio = _swig_property(_Box2D.b2GearJoint_ratio_get, _Box2D.b2GearJoint_ratio_set) 6136 mass = _swig_property(_Box2D.b2GearJoint_mass_get, _Box2D.b2GearJoint_mass_set) 6137 impulse = _swig_property(_Box2D.b2GearJoint_impulse_get, _Box2D.b2GearJoint_impulse_set)
6138 - def __repr__(self):
6139 return """b2GearJoint( 6140 J = %s, 6141 body1 = %s, 6142 body2 = %s, 6143 collideConnected = %s, 6144 constant = %s, 6145 ground1 = %s, 6146 ground2 = %s, 6147 groundAnchor1 = %s, 6148 groundAnchor2 = %s, 6149 impulse = %s, 6150 joint1 = %s, 6151 joint2 = %s, 6152 localAnchor1 = %s, 6153 localAnchor2 = %s, 6154 mass = %s, 6155 prismatic1 = %s, 6156 prismatic2 = %s, 6157 ratio = %s, 6158 revolute1 = %s, 6159 revolute2 = %s, 6160 type = %s, 6161 userData = %s, 6162 GetAnchor1() = %s, 6163 GetAnchor2() = %s)"""% tuple(str(a) for a in\ 6164 (self.J,self.body1,self.body2,self.collideConnected,self.constant,self.ground1,self.ground2,self.groundAnchor1,self.groundAnchor2,self.impulse,self.joint1,self.joint2,self.localAnchor1,self.localAnchor2,self.mass,self.prismatic1,self.prismatic2,self.ratio,self.revolute1,self.revolute2,self.type,self.userData,self.GetAnchor1(),self.GetAnchor2()))
6165 6166 __getstate__=_pickle_get_joint 6167 __setstate__=_pickle_factory_set 6168 _pickle_finalize=_pickle_finalize_joint 6169 6170 joint1 = property(lambda self: (self.revolute1 and self.revolute1) or self.prismatic1, None) 6171 joint2 = property(lambda self: (self.revolute2 and self.revolute2) or self.prismatic2, None) 6172 6173 __swig_destroy__ = _Box2D.delete_b2GearJoint 6174 b2GearJoint.GetRatio = new_instancemethod(_Box2D.b2GearJoint_GetRatio,None,b2GearJoint) 6175 b2GearJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2GearJoint_InitVelocityConstraints,None,b2GearJoint) 6176 b2GearJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2GearJoint_SolveVelocityConstraints,None,b2GearJoint) 6177 b2GearJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2GearJoint_SolvePositionConstraints,None,b2GearJoint) 6178 b2GearJoint_swigregister = _Box2D.b2GearJoint_swigregister 6179 b2GearJoint_swigregister(b2GearJoint) 6180
6181 -class b2LineJointDef(b2JointDef):
6182 """Line joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.""" 6183 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6184 __repr__ = _swig_repr
6185 - def __init__(self):
6186 """ 6187 __init__(self) -> b2LineJointDef 6188 6189 Line joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game. 6190 """ 6191 _Box2D.b2LineJointDef_swiginit(self,_Box2D.new_b2LineJointDef())
6192 - def Initialize(self, *args):
6193 """ 6194 Initialize(self, b2Body body1, b2Body body2, b2Vec2 anchor, b2Vec2 axis) 6195 6196 Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. 6197 """ 6198 return _Box2D.b2LineJointDef_Initialize(self, *args)
6199 6200 localAnchor1 = _swig_property(_Box2D.b2LineJointDef_localAnchor1_get, _Box2D.b2LineJointDef_localAnchor1_set) 6201 localAnchor2 = _swig_property(_Box2D.b2LineJointDef_localAnchor2_get, _Box2D.b2LineJointDef_localAnchor2_set) 6202 localAxis1 = _swig_property(_Box2D.b2LineJointDef_localAxis1_get, _Box2D.b2LineJointDef_localAxis1_set) 6203 enableLimit = _swig_property(_Box2D.b2LineJointDef_enableLimit_get, _Box2D.b2LineJointDef_enableLimit_set) 6204 lowerTranslation = _swig_property(_Box2D.b2LineJointDef_lowerTranslation_get, _Box2D.b2LineJointDef_lowerTranslation_set) 6205 upperTranslation = _swig_property(_Box2D.b2LineJointDef_upperTranslation_get, _Box2D.b2LineJointDef_upperTranslation_set) 6206 enableMotor = _swig_property(_Box2D.b2LineJointDef_enableMotor_get, _Box2D.b2LineJointDef_enableMotor_set) 6207 maxMotorForce = _swig_property(_Box2D.b2LineJointDef_maxMotorForce_get, _Box2D.b2LineJointDef_maxMotorForce_set) 6208 motorSpeed = _swig_property(_Box2D.b2LineJointDef_motorSpeed_get, _Box2D.b2LineJointDef_motorSpeed_set)
6209 - def __repr__(self):
6210 return """b2LineJointDef( 6211 body1 = %s, 6212 body2 = %s, 6213 collideConnected = %s, 6214 enableLimit = %s, 6215 enableMotor = %s, 6216 localAnchor1 = %s, 6217 localAnchor2 = %s, 6218 localAxis1 = %s, 6219 lowerTranslation = %s, 6220 maxMotorForce = %s, 6221 motorSpeed = %s, 6222 type = %s, 6223 upperTranslation = %s, 6224 userData = %s)"""% tuple(str(a) for a in\ 6225 (self.body1,self.body2,self.collideConnected,self.enableLimit,self.enableMotor,self.localAnchor1,self.localAnchor2,self.localAxis1,self.lowerTranslation,self.maxMotorForce,self.motorSpeed,self.type,self.upperTranslation,self.userData))
6226 6227 __getstate__=_generic_getstate 6228 __setstate__=_generic_setstate 6229 6230 __swig_destroy__ = _Box2D.delete_b2LineJointDef 6231 b2LineJointDef.Initialize = new_instancemethod(_Box2D.b2LineJointDef_Initialize,None,b2LineJointDef) 6232 b2LineJointDef_swigregister = _Box2D.b2LineJointDef_swigregister 6233 b2LineJointDef_swigregister(b2LineJointDef) 6234
6235 -class b2LineJoint(b2Joint):
6236 """A line joint. This joint provides one degree of freedom: translation along an axis fixed in body1. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.""" 6237 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6238 __repr__ = _swig_repr
6239 - def GetJointTranslation(self):
6240 """ 6241 GetJointTranslation(self) -> float32 6242 6243 Get the current joint translation, usually in meters. 6244 """ 6245 return _Box2D.b2LineJoint_GetJointTranslation(self)
6246
6247 - def GetJointSpeed(self):
6248 """ 6249 GetJointSpeed(self) -> float32 6250 6251 Get the current joint translation speed, usually in meters per second. 6252 """ 6253 return _Box2D.b2LineJoint_GetJointSpeed(self)
6254
6255 - def IsLimitEnabled(self):
6256 """ 6257 IsLimitEnabled(self) -> bool 6258 6259 Is the joint limit enabled? 6260 """ 6261 return _Box2D.b2LineJoint_IsLimitEnabled(self)
6262
6263 - def EnableLimit(self, *args):
6264 """ 6265 EnableLimit(self, bool flag) 6266 6267 Enable/disable the joint limit. 6268 """ 6269 return _Box2D.b2LineJoint_EnableLimit(self, *args)
6270
6271 - def GetLowerLimit(self):
6272 """ 6273 GetLowerLimit(self) -> float32 6274 6275 Get the lower joint limit, usually in meters. 6276 """ 6277 return _Box2D.b2LineJoint_GetLowerLimit(self)
6278
6279 - def GetUpperLimit(self):
6280 """ 6281 GetUpperLimit(self) -> float32 6282 6283 Get the upper joint limit, usually in meters. 6284 """ 6285 return _Box2D.b2LineJoint_GetUpperLimit(self)
6286
6287 - def SetLimits(self, *args):
6288 """ 6289 SetLimits(self, float32 lower, float32 upper) 6290 6291 Set the joint limits, usually in meters. 6292 """ 6293 return _Box2D.b2LineJoint_SetLimits(self, *args)
6294
6295 - def IsMotorEnabled(self):
6296 """ 6297 IsMotorEnabled(self) -> bool 6298 6299 Is the joint motor enabled? 6300 """ 6301 return _Box2D.b2LineJoint_IsMotorEnabled(self)
6302
6303 - def EnableMotor(self, *args):
6304 """ 6305 EnableMotor(self, bool flag) 6306 6307 Enable/disable the joint motor. 6308 """ 6309 return _Box2D.b2LineJoint_EnableMotor(self, *args)
6310
6311 - def SetMotorSpeed(self, *args):
6312 """ 6313 SetMotorSpeed(self, float32 speed) 6314 6315 Set the motor speed, usually in meters per second. 6316 """ 6317 return _Box2D.b2LineJoint_SetMotorSpeed(self, *args)
6318
6319 - def GetMotorSpeed(self):
6320 """ 6321 GetMotorSpeed(self) -> float32 6322 6323 Get the motor speed, usually in meters per second. 6324 """ 6325 return _Box2D.b2LineJoint_GetMotorSpeed(self)
6326
6327 - def SetMaxMotorForce(self, *args):
6328 """ 6329 SetMaxMotorForce(self, float32 force) 6330 6331 Set the maximum motor force, usually in N. 6332 """ 6333 return _Box2D.b2LineJoint_SetMaxMotorForce(self, *args)
6334
6335 - def GetMotorForce(self):
6336 """ 6337 GetMotorForce(self) -> float32 6338 6339 Get the current motor force, usually in N. 6340 """ 6341 return _Box2D.b2LineJoint_GetMotorForce(self)
6342
6343 - def __init__(self, *args):
6344 """ 6345 __init__(self, b2LineJointDef _def) -> b2LineJoint 6346 6347 A line joint. This joint provides one degree of freedom: translation along an axis fixed in body1. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction. 6348 """ 6349 _Box2D.b2LineJoint_swiginit(self,_Box2D.new_b2LineJoint(*args))
6350 - def InitVelocityConstraints(self, *args):
6351 """InitVelocityConstraints(self, b2TimeStep step)""" 6352 return _Box2D.b2LineJoint_InitVelocityConstraints(self, *args)
6353
6354 - def SolveVelocityConstraints(self, *args):
6355 """SolveVelocityConstraints(self, b2TimeStep step)""" 6356 return _Box2D.b2LineJoint_SolveVelocityConstraints(self, *args)
6357
6358 - def SolvePositionConstraints(self, *args):
6359 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 6360 return _Box2D.b2LineJoint_SolvePositionConstraints(self, *args)
6361 6362 localAnchor1 = _swig_property(_Box2D.b2LineJoint_localAnchor1_get, _Box2D.b2LineJoint_localAnchor1_set) 6363 localAnchor2 = _swig_property(_Box2D.b2LineJoint_localAnchor2_get, _Box2D.b2LineJoint_localAnchor2_set) 6364 localXAxis1 = _swig_property(_Box2D.b2LineJoint_localXAxis1_get, _Box2D.b2LineJoint_localXAxis1_set) 6365 localYAxis1 = _swig_property(_Box2D.b2LineJoint_localYAxis1_get, _Box2D.b2LineJoint_localYAxis1_set) 6366 axis = _swig_property(_Box2D.b2LineJoint_axis_get, _Box2D.b2LineJoint_axis_set) 6367 perp = _swig_property(_Box2D.b2LineJoint_perp_get, _Box2D.b2LineJoint_perp_set) 6368 s1 = _swig_property(_Box2D.b2LineJoint_s1_get, _Box2D.b2LineJoint_s1_set) 6369 s2 = _swig_property(_Box2D.b2LineJoint_s2_get, _Box2D.b2LineJoint_s2_set) 6370 a1 = _swig_property(_Box2D.b2LineJoint_a1_get, _Box2D.b2LineJoint_a1_set) 6371 a2 = _swig_property(_Box2D.b2LineJoint_a2_get, _Box2D.b2LineJoint_a2_set) 6372 K = _swig_property(_Box2D.b2LineJoint_K_get, _Box2D.b2LineJoint_K_set) 6373 impulse = _swig_property(_Box2D.b2LineJoint_impulse_get, _Box2D.b2LineJoint_impulse_set) 6374 motorMass = _swig_property(_Box2D.b2LineJoint_motorMass_get, _Box2D.b2LineJoint_motorMass_set) 6375 motorImpulse = _swig_property(_Box2D.b2LineJoint_motorImpulse_get, _Box2D.b2LineJoint_motorImpulse_set) 6376 lowerTranslation = _swig_property(_Box2D.b2LineJoint_lowerTranslation_get, _Box2D.b2LineJoint_lowerTranslation_set) 6377 upperTranslation = _swig_property(_Box2D.b2LineJoint_upperTranslation_get, _Box2D.b2LineJoint_upperTranslation_set) 6378 maxMotorForce = _swig_property(_Box2D.b2LineJoint_maxMotorForce_get, _Box2D.b2LineJoint_maxMotorForce_set) 6379 motorSpeed = _swig_property(_Box2D.b2LineJoint_motorSpeed_get, _Box2D.b2LineJoint_motorSpeed_set) 6380 enableLimit = _swig_property(_Box2D.b2LineJoint_enableLimit_get, _Box2D.b2LineJoint_enableLimit_set) 6381 enableMotor = _swig_property(_Box2D.b2LineJoint_enableMotor_get, _Box2D.b2LineJoint_enableMotor_set) 6382 limitState = _swig_property(_Box2D.b2LineJoint_limitState_get, _Box2D.b2LineJoint_limitState_set)
6383 - def __repr__(self):
6384 return """b2LineJoint( 6385 K = %s, 6386 a1 = %s, 6387 a2 = %s, 6388 axis = %s, 6389 body1 = %s, 6390 body2 = %s, 6391 collideConnected = %s, 6392 enableLimit = %s, 6393 enableMotor = %s, 6394 impulse = %s, 6395 limitState = %s, 6396 localAnchor1 = %s, 6397 localAnchor2 = %s, 6398 localXAxis1 = %s, 6399 localYAxis1 = %s, 6400 lowerTranslation = %s, 6401 maxMotorForce = %s, 6402 motorImpulse = %s, 6403 motorMass = %s, 6404 motorSpeed = %s, 6405 perp = %s, 6406 s1 = %s, 6407 s2 = %s, 6408 type = %s, 6409 upperTranslation = %s, 6410 userData = %s, 6411 GetAnchor1() = %s, 6412 GetAnchor2() = %s, 6413 GetJointSpeed() = %s, 6414 GetJointTranslation() = %s, 6415 GetLowerLimit() = %s, 6416 GetMotorForce() = %s, 6417 GetUpperLimit() = %s, 6418 IsLimitEnabled() = %s, 6419 IsMotorEnabled() = %s)"""% tuple(str(a) for a in\ 6420 (self.K,self.a1,self.a2,self.axis,self.body1,self.body2,self.collideConnected,self.enableLimit,self.enableMotor,self.impulse,self.limitState,self.localAnchor1,self.localAnchor2,self.localXAxis1,self.localYAxis1,self.lowerTranslation,self.maxMotorForce,self.motorImpulse,self.motorMass,self.motorSpeed,self.perp,self.s1,self.s2,self.type,self.upperTranslation,self.userData,self.GetAnchor1(),self.GetAnchor2(),self.GetJointSpeed(),self.GetJointTranslation(),self.GetLowerLimit(),self.GetMotorForce(),self.GetUpperLimit(),self.IsLimitEnabled(),self.IsMotorEnabled()))
6421 6422 __getstate__=_pickle_get_joint 6423 __setstate__=_pickle_factory_set 6424 _pickle_finalize=_pickle_finalize_joint 6425 6426 __swig_destroy__ = _Box2D.delete_b2LineJoint 6427 b2LineJoint.GetJointTranslation = new_instancemethod(_Box2D.b2LineJoint_GetJointTranslation,None,b2LineJoint) 6428 b2LineJoint.GetJointSpeed = new_instancemethod(_Box2D.b2LineJoint_GetJointSpeed,None,b2LineJoint) 6429 b2LineJoint.IsLimitEnabled = new_instancemethod(_Box2D.b2LineJoint_IsLimitEnabled,None,b2LineJoint) 6430 b2LineJoint.EnableLimit = new_instancemethod(_Box2D.b2LineJoint_EnableLimit,None,b2LineJoint) 6431 b2LineJoint.GetLowerLimit = new_instancemethod(_Box2D.b2LineJoint_GetLowerLimit,None,b2LineJoint) 6432 b2LineJoint.GetUpperLimit = new_instancemethod(_Box2D.b2LineJoint_GetUpperLimit,None,b2LineJoint) 6433 b2LineJoint.SetLimits = new_instancemethod(_Box2D.b2LineJoint_SetLimits,None,b2LineJoint) 6434 b2LineJoint.IsMotorEnabled = new_instancemethod(_Box2D.b2LineJoint_IsMotorEnabled,None,b2LineJoint) 6435 b2LineJoint.EnableMotor = new_instancemethod(_Box2D.b2LineJoint_EnableMotor,None,b2LineJoint) 6436 b2LineJoint.SetMotorSpeed = new_instancemethod(_Box2D.b2LineJoint_SetMotorSpeed,None,b2LineJoint) 6437 b2LineJoint.GetMotorSpeed = new_instancemethod(_Box2D.b2LineJoint_GetMotorSpeed,None,b2LineJoint) 6438 b2LineJoint.SetMaxMotorForce = new_instancemethod(_Box2D.b2LineJoint_SetMaxMotorForce,None,b2LineJoint) 6439 b2LineJoint.GetMotorForce = new_instancemethod(_Box2D.b2LineJoint_GetMotorForce,None,b2LineJoint) 6440 b2LineJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2LineJoint_InitVelocityConstraints,None,b2LineJoint) 6441 b2LineJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2LineJoint_SolveVelocityConstraints,None,b2LineJoint) 6442 b2LineJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2LineJoint_SolvePositionConstraints,None,b2LineJoint) 6443 b2LineJoint_swigregister = _Box2D.b2LineJoint_swigregister 6444 b2LineJoint_swigregister(b2LineJoint) 6445
6446 -class b2MouseJointDef(b2JointDef):
6447 """Mouse joint definition. This requires a world target point, tuning parameters, and the time step.""" 6448 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6449 __repr__ = _swig_repr
6450 - def __init__(self):
6451 """ 6452 __init__(self) -> b2MouseJointDef 6453 6454 Mouse joint definition. This requires a world target point, tuning parameters, and the time step. 6455 """ 6456 _Box2D.b2MouseJointDef_swiginit(self,_Box2D.new_b2MouseJointDef())
6457 target = _swig_property(_Box2D.b2MouseJointDef_target_get, _Box2D.b2MouseJointDef_target_set) 6458 maxForce = _swig_property(_Box2D.b2MouseJointDef_maxForce_get, _Box2D.b2MouseJointDef_maxForce_set) 6459 frequencyHz = _swig_property(_Box2D.b2MouseJointDef_frequencyHz_get, _Box2D.b2MouseJointDef_frequencyHz_set) 6460 dampingRatio = _swig_property(_Box2D.b2MouseJointDef_dampingRatio_get, _Box2D.b2MouseJointDef_dampingRatio_set)
6461 - def __repr__(self):
6462 return """b2MouseJointDef( 6463 body1 = %s, 6464 body2 = %s, 6465 collideConnected = %s, 6466 dampingRatio = %s, 6467 frequencyHz = %s, 6468 maxForce = %s, 6469 target = %s, 6470 type = %s, 6471 userData = %s)"""% tuple(str(a) for a in\ 6472 (self.body1,self.body2,self.collideConnected,self.dampingRatio,self.frequencyHz,self.maxForce,self.target,self.type,self.userData))
6473 6474 __getstate__=_generic_getstate 6475 __setstate__=_generic_setstate 6476 6477 __swig_destroy__ = _Box2D.delete_b2MouseJointDef 6478 b2MouseJointDef_swigregister = _Box2D.b2MouseJointDef_swigregister 6479 b2MouseJointDef_swigregister(b2MouseJointDef) 6480
6481 -class b2MouseJoint(b2Joint):
6482 """A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.""" 6483 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6484 __repr__ = _swig_repr
6485 - def SetTarget(self, *args):
6486 """ 6487 SetTarget(self, b2Vec2 target) 6488 6489 Use this to update the target point. 6490 """ 6491 return _Box2D.b2MouseJoint_SetTarget(self, *args)
6492
6493 - def __init__(self, *args):
6494 """ 6495 __init__(self, b2MouseJointDef _def) -> b2MouseJoint 6496 6497 A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces. 6498 """ 6499 _Box2D.b2MouseJoint_swiginit(self,_Box2D.new_b2MouseJoint(*args))
6500 - def InitVelocityConstraints(self, *args):
6501 """InitVelocityConstraints(self, b2TimeStep step)""" 6502 return _Box2D.b2MouseJoint_InitVelocityConstraints(self, *args)
6503
6504 - def SolveVelocityConstraints(self, *args):
6505 """SolveVelocityConstraints(self, b2TimeStep step)""" 6506 return _Box2D.b2MouseJoint_SolveVelocityConstraints(self, *args)
6507
6508 - def SolvePositionConstraints(self, *args):
6509 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 6510 return _Box2D.b2MouseJoint_SolvePositionConstraints(self, *args)
6511 6512 localAnchor = _swig_property(_Box2D.b2MouseJoint_localAnchor_get, _Box2D.b2MouseJoint_localAnchor_set) 6513 target = _swig_property(_Box2D.b2MouseJoint_target_get, _Box2D.b2MouseJoint_target_set) 6514 impulse = _swig_property(_Box2D.b2MouseJoint_impulse_get, _Box2D.b2MouseJoint_impulse_set) 6515 mass = _swig_property(_Box2D.b2MouseJoint_mass_get, _Box2D.b2MouseJoint_mass_set) 6516 C = _swig_property(_Box2D.b2MouseJoint_C_get, _Box2D.b2MouseJoint_C_set) 6517 maxForce = _swig_property(_Box2D.b2MouseJoint_maxForce_get, _Box2D.b2MouseJoint_maxForce_set) 6518 frequencyHz = _swig_property(_Box2D.b2MouseJoint_frequencyHz_get, _Box2D.b2MouseJoint_frequencyHz_set) 6519 dampingRatio = _swig_property(_Box2D.b2MouseJoint_dampingRatio_get, _Box2D.b2MouseJoint_dampingRatio_set) 6520 beta = _swig_property(_Box2D.b2MouseJoint_beta_get, _Box2D.b2MouseJoint_beta_set) 6521 gamma = _swig_property(_Box2D.b2MouseJoint_gamma_get, _Box2D.b2MouseJoint_gamma_set)
6522 - def __repr__(self):
6523 return """b2MouseJoint( 6524 C = %s, 6525 beta = %s, 6526 body1 = %s, 6527 body2 = %s, 6528 collideConnected = %s, 6529 dampingRatio = %s, 6530 frequencyHz = %s, 6531 gamma = %s, 6532 impulse = %s, 6533 localAnchor = %s, 6534 mass = %s, 6535 maxForce = %s, 6536 target = %s, 6537 type = %s, 6538 userData = %s, 6539 GetAnchor1() = %s, 6540 GetAnchor2() = %s)"""% tuple(str(a) for a in\ 6541 (self.C,self.beta,self.body1,self.body2,self.collideConnected,self.dampingRatio,self.frequencyHz,self.gamma,self.impulse,self.localAnchor,self.mass,self.maxForce,self.target,self.type,self.userData,self.GetAnchor1(),self.GetAnchor2()))
6542 6543 __getstate__=_pickle_get_joint 6544 __setstate__=_pickle_factory_set 6545 _pickle_finalize=_pickle_finalize_joint 6546 6547 __swig_destroy__ = _Box2D.delete_b2MouseJoint 6548 b2MouseJoint.SetTarget = new_instancemethod(_Box2D.b2MouseJoint_SetTarget,None,b2MouseJoint) 6549 b2MouseJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2MouseJoint_InitVelocityConstraints,None,b2MouseJoint) 6550 b2MouseJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2MouseJoint_SolveVelocityConstraints,None,b2MouseJoint) 6551 b2MouseJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2MouseJoint_SolvePositionConstraints,None,b2MouseJoint) 6552 b2MouseJoint_swigregister = _Box2D.b2MouseJoint_swigregister 6553 b2MouseJoint_swigregister(b2MouseJoint) 6554
6555 -class b2PrismaticJointDef(b2JointDef):
6556 """Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.""" 6557 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6558 __repr__ = _swig_repr
6559 - def __init__(self):
6560 """ 6561 __init__(self) -> b2PrismaticJointDef 6562 6563 Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game. 6564 """ 6565 _Box2D.b2PrismaticJointDef_swiginit(self,_Box2D.new_b2PrismaticJointDef())
6566 - def Initialize(self, *args):
6567 """ 6568 Initialize(self, b2Body body1, b2Body body2, b2Vec2 anchor, b2Vec2 axis) 6569 6570 Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. 6571 """ 6572 return _Box2D.b2PrismaticJointDef_Initialize(self, *args)
6573 6574 localAnchor1 = _swig_property(_Box2D.b2PrismaticJointDef_localAnchor1_get, _Box2D.b2PrismaticJointDef_localAnchor1_set) 6575 localAnchor2 = _swig_property(_Box2D.b2PrismaticJointDef_localAnchor2_get, _Box2D.b2PrismaticJointDef_localAnchor2_set) 6576 localAxis1 = _swig_property(_Box2D.b2PrismaticJointDef_localAxis1_get, _Box2D.b2PrismaticJointDef_localAxis1_set) 6577 referenceAngle = _swig_property(_Box2D.b2PrismaticJointDef_referenceAngle_get, _Box2D.b2PrismaticJointDef_referenceAngle_set) 6578 enableLimit = _swig_property(_Box2D.b2PrismaticJointDef_enableLimit_get, _Box2D.b2PrismaticJointDef_enableLimit_set) 6579 lowerTranslation = _swig_property(_Box2D.b2PrismaticJointDef_lowerTranslation_get, _Box2D.b2PrismaticJointDef_lowerTranslation_set) 6580 upperTranslation = _swig_property(_Box2D.b2PrismaticJointDef_upperTranslation_get, _Box2D.b2PrismaticJointDef_upperTranslation_set) 6581 enableMotor = _swig_property(_Box2D.b2PrismaticJointDef_enableMotor_get, _Box2D.b2PrismaticJointDef_enableMotor_set) 6582 maxMotorForce = _swig_property(_Box2D.b2PrismaticJointDef_maxMotorForce_get, _Box2D.b2PrismaticJointDef_maxMotorForce_set) 6583 motorSpeed = _swig_property(_Box2D.b2PrismaticJointDef_motorSpeed_get, _Box2D.b2PrismaticJointDef_motorSpeed_set)
6584 - def __repr__(self):
6585 return """b2PrismaticJointDef( 6586 body1 = %s, 6587 body2 = %s, 6588 collideConnected = %s, 6589 enableLimit = %s, 6590 enableMotor = %s, 6591 localAnchor1 = %s, 6592 localAnchor2 = %s, 6593 localAxis1 = %s, 6594 lowerTranslation = %s, 6595 maxMotorForce = %s, 6596 motorSpeed = %s, 6597 referenceAngle = %s, 6598 type = %s, 6599 upperTranslation = %s, 6600 userData = %s)"""% tuple(str(a) for a in\ 6601 (self.body1,self.body2,self.collideConnected,self.enableLimit,self.enableMotor,self.localAnchor1,self.localAnchor2,self.localAxis1,self.lowerTranslation,self.maxMotorForce,self.motorSpeed,self.referenceAngle,self.type,self.upperTranslation,self.userData))
6602 6603 __getstate__=_generic_getstate 6604 __setstate__=_generic_setstate 6605 6606 __swig_destroy__ = _Box2D.delete_b2PrismaticJointDef 6607 b2PrismaticJointDef.Initialize = new_instancemethod(_Box2D.b2PrismaticJointDef_Initialize,None,b2PrismaticJointDef) 6608 b2PrismaticJointDef_swigregister = _Box2D.b2PrismaticJointDef_swigregister 6609 b2PrismaticJointDef_swigregister(b2PrismaticJointDef) 6610
6611 -class b2PrismaticJoint(b2Joint):
6612 """A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.""" 6613 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6614 __repr__ = _swig_repr
6615 - def GetJointTranslation(self):
6616 """ 6617 GetJointTranslation(self) -> float32 6618 6619 Get the current joint translation, usually in meters. 6620 """ 6621 return _Box2D.b2PrismaticJoint_GetJointTranslation(self)
6622
6623 - def GetJointSpeed(self):
6624 """ 6625 GetJointSpeed(self) -> float32 6626 6627 Get the current joint translation speed, usually in meters per second. 6628 """ 6629 return _Box2D.b2PrismaticJoint_GetJointSpeed(self)
6630
6631 - def IsLimitEnabled(self):
6632 """ 6633 IsLimitEnabled(self) -> bool 6634 6635 Is the joint limit enabled? 6636 """ 6637 return _Box2D.b2PrismaticJoint_IsLimitEnabled(self)
6638
6639 - def EnableLimit(self, *args):
6640 """ 6641 EnableLimit(self, bool flag) 6642 6643 Enable/disable the joint limit. 6644 """ 6645 return _Box2D.b2PrismaticJoint_EnableLimit(self, *args)
6646
6647 - def GetLowerLimit(self):
6648 """ 6649 GetLowerLimit(self) -> float32 6650 6651 Get the lower joint limit, usually in meters. 6652 """ 6653 return _Box2D.b2PrismaticJoint_GetLowerLimit(self)
6654
6655 - def GetUpperLimit(self):
6656 """ 6657 GetUpperLimit(self) -> float32 6658 6659 Get the upper joint limit, usually in meters. 6660 """ 6661 return _Box2D.b2PrismaticJoint_GetUpperLimit(self)
6662
6663 - def SetLimits(self, *args):
6664 """ 6665 SetLimits(self, float32 lower, float32 upper) 6666 6667 Set the joint limits, usually in meters. 6668 """ 6669 return _Box2D.b2PrismaticJoint_SetLimits(self, *args)
6670
6671 - def IsMotorEnabled(self):
6672 """ 6673 IsMotorEnabled(self) -> bool 6674 6675 Is the joint motor enabled? 6676 """ 6677 return _Box2D.b2PrismaticJoint_IsMotorEnabled(self)
6678
6679 - def EnableMotor(self, *args):
6680 """ 6681 EnableMotor(self, bool flag) 6682 6683 Enable/disable the joint motor. 6684 """ 6685 return _Box2D.b2PrismaticJoint_EnableMotor(self, *args)
6686
6687 - def SetMotorSpeed(self, *args):
6688 """ 6689 SetMotorSpeed(self, float32 speed) 6690 6691 Set the motor speed, usually in meters per second. 6692 """ 6693 return _Box2D.b2PrismaticJoint_SetMotorSpeed(self, *args)
6694
6695 - def GetMotorSpeed(self):
6696 """ 6697 GetMotorSpeed(self) -> float32 6698 6699 Get the motor speed, usually in meters per second. 6700 """ 6701 return _Box2D.b2PrismaticJoint_GetMotorSpeed(self)
6702
6703 - def SetMaxMotorForce(self, *args):
6704 """ 6705 SetMaxMotorForce(self, float32 force) 6706 6707 Set the maximum motor force, usually in N. 6708 """ 6709 return _Box2D.b2PrismaticJoint_SetMaxMotorForce(self, *args)
6710
6711 - def GetMotorForce(self):
6712 """ 6713 GetMotorForce(self) -> float32 6714 6715 Get the current motor force, usually in N. 6716 """ 6717 return _Box2D.b2PrismaticJoint_GetMotorForce(self)
6718
6719 - def __init__(self, *args):
6720 """ 6721 __init__(self, b2PrismaticJointDef _def) -> b2PrismaticJoint 6722 6723 A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction. 6724 """ 6725 _Box2D.b2PrismaticJoint_swiginit(self,_Box2D.new_b2PrismaticJoint(*args))
6726 - def InitVelocityConstraints(self, *args):
6727 """InitVelocityConstraints(self, b2TimeStep step)""" 6728 return _Box2D.b2PrismaticJoint_InitVelocityConstraints(self, *args)
6729
6730 - def SolveVelocityConstraints(self, *args):
6731 """SolveVelocityConstraints(self, b2TimeStep step)""" 6732 return _Box2D.b2PrismaticJoint_SolveVelocityConstraints(self, *args)
6733
6734 - def SolvePositionConstraints(self, *args):
6735 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 6736 return _Box2D.b2PrismaticJoint_SolvePositionConstraints(self, *args)
6737 6738 localAnchor1 = _swig_property(_Box2D.b2PrismaticJoint_localAnchor1_get, _Box2D.b2PrismaticJoint_localAnchor1_set) 6739 localAnchor2 = _swig_property(_Box2D.b2PrismaticJoint_localAnchor2_get, _Box2D.b2PrismaticJoint_localAnchor2_set) 6740 localXAxis1 = _swig_property(_Box2D.b2PrismaticJoint_localXAxis1_get, _Box2D.b2PrismaticJoint_localXAxis1_set) 6741 localYAxis1 = _swig_property(_Box2D.b2PrismaticJoint_localYAxis1_get, _Box2D.b2PrismaticJoint_localYAxis1_set) 6742 referenceAngle = _swig_property(_Box2D.b2PrismaticJoint_referenceAngle_get, _Box2D.b2PrismaticJoint_referenceAngle_set) 6743 axis = _swig_property(_Box2D.b2PrismaticJoint_axis_get, _Box2D.b2PrismaticJoint_axis_set) 6744 perp = _swig_property(_Box2D.b2PrismaticJoint_perp_get, _Box2D.b2PrismaticJoint_perp_set) 6745 s1 = _swig_property(_Box2D.b2PrismaticJoint_s1_get, _Box2D.b2PrismaticJoint_s1_set) 6746 s2 = _swig_property(_Box2D.b2PrismaticJoint_s2_get, _Box2D.b2PrismaticJoint_s2_set) 6747 a1 = _swig_property(_Box2D.b2PrismaticJoint_a1_get, _Box2D.b2PrismaticJoint_a1_set) 6748 a2 = _swig_property(_Box2D.b2PrismaticJoint_a2_get, _Box2D.b2PrismaticJoint_a2_set) 6749 K = _swig_property(_Box2D.b2PrismaticJoint_K_get, _Box2D.b2PrismaticJoint_K_set) 6750 impulse = _swig_property(_Box2D.b2PrismaticJoint_impulse_get, _Box2D.b2PrismaticJoint_impulse_set) 6751 motorMass = _swig_property(_Box2D.b2PrismaticJoint_motorMass_get, _Box2D.b2PrismaticJoint_motorMass_set) 6752 motorImpulse = _swig_property(_Box2D.b2PrismaticJoint_motorImpulse_get, _Box2D.b2PrismaticJoint_motorImpulse_set) 6753 lowerTranslation = _swig_property(_Box2D.b2PrismaticJoint_lowerTranslation_get, _Box2D.b2PrismaticJoint_lowerTranslation_set) 6754 upperTranslation = _swig_property(_Box2D.b2PrismaticJoint_upperTranslation_get, _Box2D.b2PrismaticJoint_upperTranslation_set) 6755 maxMotorForce = _swig_property(_Box2D.b2PrismaticJoint_maxMotorForce_get, _Box2D.b2PrismaticJoint_maxMotorForce_set) 6756 motorSpeed = _swig_property(_Box2D.b2PrismaticJoint_motorSpeed_get, _Box2D.b2PrismaticJoint_motorSpeed_set) 6757 enableLimit = _swig_property(_Box2D.b2PrismaticJoint_enableLimit_get, _Box2D.b2PrismaticJoint_enableLimit_set) 6758 enableMotor = _swig_property(_Box2D.b2PrismaticJoint_enableMotor_get, _Box2D.b2PrismaticJoint_enableMotor_set) 6759 limitState = _swig_property(_Box2D.b2PrismaticJoint_limitState_get, _Box2D.b2PrismaticJoint_limitState_set)
6760 - def __repr__(self):
6761 return """b2PrismaticJoint( 6762 K = %s, 6763 a1 = %s, 6764 a2 = %s, 6765 axis = %s, 6766 body1 = %s, 6767 body2 = %s, 6768 collideConnected = %s, 6769 enableLimit = %s, 6770 enableMotor = %s, 6771 impulse = %s, 6772 limitState = %s, 6773 localAnchor1 = %s, 6774 localAnchor2 = %s, 6775 localXAxis1 = %s, 6776 localYAxis1 = %s, 6777 lowerTranslation = %s, 6778 maxMotorForce = %s, 6779 motorImpulse = %s, 6780 motorMass = %s, 6781 motorSpeed = %s, 6782 perp = %s, 6783 referenceAngle = %s, 6784 s1 = %s, 6785 s2 = %s, 6786 type = %s, 6787 upperTranslation = %s, 6788 userData = %s, 6789 GetAnchor1() = %s, 6790 GetAnchor2() = %s, 6791 GetJointSpeed() = %s, 6792 GetJointTranslation() = %s, 6793 GetLowerLimit() = %s, 6794 GetMotorForce() = %s, 6795 GetUpperLimit() = %s, 6796 IsLimitEnabled() = %s, 6797 IsMotorEnabled() = %s)"""% tuple(str(a) for a in\ 6798 (self.K,self.a1,self.a2,self.axis,self.body1,self.body2,self.collideConnected,self.enableLimit,self.enableMotor,self.impulse,self.limitState,self.localAnchor1,self.localAnchor2,self.localXAxis1,self.localYAxis1,self.lowerTranslation,self.maxMotorForce,self.motorImpulse,self.motorMass,self.motorSpeed,self.perp,self.referenceAngle,self.s1,self.s2,self.type,self.upperTranslation,self.userData,self.GetAnchor1(),self.GetAnchor2(),self.GetJointSpeed(),self.GetJointTranslation(),self.GetLowerLimit(),self.GetMotorForce(),self.GetUpperLimit(),self.IsLimitEnabled(),self.IsMotorEnabled()))
6799 6800 __getstate__=_pickle_get_joint 6801 __setstate__=_pickle_factory_set 6802 _pickle_finalize=_pickle_finalize_joint 6803 6804 __swig_destroy__ = _Box2D.delete_b2PrismaticJoint 6805 b2PrismaticJoint.GetJointTranslation = new_instancemethod(_Box2D.b2PrismaticJoint_GetJointTranslation,None,b2PrismaticJoint) 6806 b2PrismaticJoint.GetJointSpeed = new_instancemethod(_Box2D.b2PrismaticJoint_GetJointSpeed,None,b2PrismaticJoint) 6807 b2PrismaticJoint.IsLimitEnabled = new_instancemethod(_Box2D.b2PrismaticJoint_IsLimitEnabled,None,b2PrismaticJoint) 6808 b2PrismaticJoint.EnableLimit = new_instancemethod(_Box2D.b2PrismaticJoint_EnableLimit,None,b2PrismaticJoint) 6809 b2PrismaticJoint.GetLowerLimit = new_instancemethod(_Box2D.b2PrismaticJoint_GetLowerLimit,None,b2PrismaticJoint) 6810 b2PrismaticJoint.GetUpperLimit = new_instancemethod(_Box2D.b2PrismaticJoint_GetUpperLimit,None,b2PrismaticJoint) 6811 b2PrismaticJoint.SetLimits = new_instancemethod(_Box2D.b2PrismaticJoint_SetLimits,None,b2PrismaticJoint) 6812 b2PrismaticJoint.IsMotorEnabled = new_instancemethod(_Box2D.b2PrismaticJoint_IsMotorEnabled,None,b2PrismaticJoint) 6813 b2PrismaticJoint.EnableMotor = new_instancemethod(_Box2D.b2PrismaticJoint_EnableMotor,None,b2PrismaticJoint) 6814 b2PrismaticJoint.SetMotorSpeed = new_instancemethod(_Box2D.b2PrismaticJoint_SetMotorSpeed,None,b2PrismaticJoint) 6815 b2PrismaticJoint.GetMotorSpeed = new_instancemethod(_Box2D.b2PrismaticJoint_GetMotorSpeed,None,b2PrismaticJoint) 6816 b2PrismaticJoint.SetMaxMotorForce = new_instancemethod(_Box2D.b2PrismaticJoint_SetMaxMotorForce,None,b2PrismaticJoint) 6817 b2PrismaticJoint.GetMotorForce = new_instancemethod(_Box2D.b2PrismaticJoint_GetMotorForce,None,b2PrismaticJoint) 6818 b2PrismaticJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2PrismaticJoint_InitVelocityConstraints,None,b2PrismaticJoint) 6819 b2PrismaticJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2PrismaticJoint_SolveVelocityConstraints,None,b2PrismaticJoint) 6820 b2PrismaticJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2PrismaticJoint_SolvePositionConstraints,None,b2PrismaticJoint) 6821 b2PrismaticJoint_swigregister = _Box2D.b2PrismaticJoint_swigregister 6822 b2PrismaticJoint_swigregister(b2PrismaticJoint) 6823
6824 -class b2PulleyJointDef(b2JointDef):
6825 """Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a pulley ratio.""" 6826 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6827 __repr__ = _swig_repr
6828 - def __init__(self):
6829 """ 6830 __init__(self) -> b2PulleyJointDef 6831 6832 Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a pulley ratio. 6833 """ 6834 _Box2D.b2PulleyJointDef_swiginit(self,_Box2D.new_b2PulleyJointDef())
6835 - def Initialize(self, *args):
6836 """ 6837 Initialize(self, b2Body body1, b2Body body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, 6838 b2Vec2 anchor1, b2Vec2 anchor2, 6839 float32 ratio) 6840 6841 Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. 6842 """ 6843 return _Box2D.b2PulleyJointDef_Initialize(self, *args)
6844 6845 groundAnchor1 = _swig_property(_Box2D.b2PulleyJointDef_groundAnchor1_get, _Box2D.b2PulleyJointDef_groundAnchor1_set) 6846 groundAnchor2 = _swig_property(_Box2D.b2PulleyJointDef_groundAnchor2_get, _Box2D.b2PulleyJointDef_groundAnchor2_set) 6847 localAnchor1 = _swig_property(_Box2D.b2PulleyJointDef_localAnchor1_get, _Box2D.b2PulleyJointDef_localAnchor1_set) 6848 localAnchor2 = _swig_property(_Box2D.b2PulleyJointDef_localAnchor2_get, _Box2D.b2PulleyJointDef_localAnchor2_set) 6849 length1 = _swig_property(_Box2D.b2PulleyJointDef_length1_get, _Box2D.b2PulleyJointDef_length1_set) 6850 maxLength1 = _swig_property(_Box2D.b2PulleyJointDef_maxLength1_get, _Box2D.b2PulleyJointDef_maxLength1_set) 6851 length2 = _swig_property(_Box2D.b2PulleyJointDef_length2_get, _Box2D.b2PulleyJointDef_length2_set) 6852 maxLength2 = _swig_property(_Box2D.b2PulleyJointDef_maxLength2_get, _Box2D.b2PulleyJointDef_maxLength2_set) 6853 ratio = _swig_property(_Box2D.b2PulleyJointDef_ratio_get, _Box2D.b2PulleyJointDef_ratio_set)
6854 - def __repr__(self):
6855 return """b2PulleyJointDef( 6856 body1 = %s, 6857 body2 = %s, 6858 collideConnected = %s, 6859 groundAnchor1 = %s, 6860 groundAnchor2 = %s, 6861 length1 = %s, 6862 length2 = %s, 6863 localAnchor1 = %s, 6864 localAnchor2 = %s, 6865 maxLength1 = %s, 6866 maxLength2 = %s, 6867 ratio = %s, 6868 type = %s, 6869 userData = %s)"""% tuple(str(a) for a in\ 6870 (self.body1,self.body2,self.collideConnected,self.groundAnchor1,self.groundAnchor2,self.length1,self.length2,self.localAnchor1,self.localAnchor2,self.maxLength1,self.maxLength2,self.ratio,self.type,self.userData))
6871 6872 __getstate__=_generic_getstate 6873 __setstate__=_generic_setstate 6874 6875 __swig_destroy__ = _Box2D.delete_b2PulleyJointDef 6876 b2PulleyJointDef.Initialize = new_instancemethod(_Box2D.b2PulleyJointDef_Initialize,None,b2PulleyJointDef) 6877 b2PulleyJointDef_swigregister = _Box2D.b2PulleyJointDef_swigregister 6878 b2PulleyJointDef_swigregister(b2PulleyJointDef) 6879 b2_minPulleyLength = cvar.b2_minPulleyLength 6880
6881 -class b2PulleyJoint(b2Joint):
6882 """The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top.""" 6883 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 6884 __repr__ = _swig_repr
6885 - def GetGroundAnchor1(self):
6886 """ 6887 GetGroundAnchor1(self) -> b2Vec2 6888 6889 Get the first ground anchor. 6890 """ 6891 return _Box2D.b2PulleyJoint_GetGroundAnchor1(self)
6892
6893 - def GetGroundAnchor2(self):
6894 """ 6895 GetGroundAnchor2(self) -> b2Vec2 6896 6897 Get the second ground anchor. 6898 """ 6899 return _Box2D.b2PulleyJoint_GetGroundAnchor2(self)
6900
6901 - def GetLength1(self):
6902 """ 6903 GetLength1(self) -> float32 6904 6905 Get the current length of the segment attached to body1. 6906 """ 6907 return _Box2D.b2PulleyJoint_GetLength1(self)
6908
6909 - def GetLength2(self):
6910 """ 6911 GetLength2(self) -> float32 6912 6913 Get the current length of the segment attached to body2. 6914 """ 6915 return _Box2D.b2PulleyJoint_GetLength2(self)
6916
6917 - def GetRatio(self):
6918 """ 6919 GetRatio(self) -> float32 6920 6921 Get the pulley ratio. 6922 """ 6923 return _Box2D.b2PulleyJoint_GetRatio(self)
6924
6925 - def __init__(self, *args):
6926 """ 6927 __init__(self, b2PulleyJointDef data) -> b2PulleyJoint 6928 6929 The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top. 6930 """ 6931 _Box2D.b2PulleyJoint_swiginit(self,_Box2D.new_b2PulleyJoint(*args))
6932 - def InitVelocityConstraints(self, *args):
6933 """InitVelocityConstraints(self, b2TimeStep step)""" 6934 return _Box2D.b2PulleyJoint_InitVelocityConstraints(self, *args)
6935
6936 - def SolveVelocityConstraints(self, *args):
6937 """SolveVelocityConstraints(self, b2TimeStep step)""" 6938 return _Box2D.b2PulleyJoint_SolveVelocityConstraints(self, *args)
6939
6940 - def SolvePositionConstraints(self, *args):
6941 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 6942 return _Box2D.b2PulleyJoint_SolvePositionConstraints(self, *args)
6943 6944 ground = _swig_property(_Box2D.b2PulleyJoint_ground_get, _Box2D.b2PulleyJoint_ground_set) 6945 groundAnchor1 = _swig_property(_Box2D.b2PulleyJoint_groundAnchor1_get, _Box2D.b2PulleyJoint_groundAnchor1_set) 6946 groundAnchor2 = _swig_property(_Box2D.b2PulleyJoint_groundAnchor2_get, _Box2D.b2PulleyJoint_groundAnchor2_set) 6947 localAnchor1 = _swig_property(_Box2D.b2PulleyJoint_localAnchor1_get, _Box2D.b2PulleyJoint_localAnchor1_set) 6948 localAnchor2 = _swig_property(_Box2D.b2PulleyJoint_localAnchor2_get, _Box2D.b2PulleyJoint_localAnchor2_set) 6949 u1 = _swig_property(_Box2D.b2PulleyJoint_u1_get, _Box2D.b2PulleyJoint_u1_set) 6950 u2 = _swig_property(_Box2D.b2PulleyJoint_u2_get, _Box2D.b2PulleyJoint_u2_set) 6951 constant = _swig_property(_Box2D.b2PulleyJoint_constant_get, _Box2D.b2PulleyJoint_constant_set) 6952 ratio = _swig_property(_Box2D.b2PulleyJoint_ratio_get, _Box2D.b2PulleyJoint_ratio_set) 6953 maxLength1 = _swig_property(_Box2D.b2PulleyJoint_maxLength1_get, _Box2D.b2PulleyJoint_maxLength1_set) 6954 maxLength2 = _swig_property(_Box2D.b2PulleyJoint_maxLength2_get, _Box2D.b2PulleyJoint_maxLength2_set) 6955 pulleyMass = _swig_property(_Box2D.b2PulleyJoint_pulleyMass_get, _Box2D.b2PulleyJoint_pulleyMass_set) 6956 limitMass1 = _swig_property(_Box2D.b2PulleyJoint_limitMass1_get, _Box2D.b2PulleyJoint_limitMass1_set) 6957 limitMass2 = _swig_property(_Box2D.b2PulleyJoint_limitMass2_get, _Box2D.b2PulleyJoint_limitMass2_set) 6958 impulse = _swig_property(_Box2D.b2PulleyJoint_impulse_get, _Box2D.b2PulleyJoint_impulse_set) 6959 limitImpulse1 = _swig_property(_Box2D.b2PulleyJoint_limitImpulse1_get, _Box2D.b2PulleyJoint_limitImpulse1_set) 6960 limitImpulse2 = _swig_property(_Box2D.b2PulleyJoint_limitImpulse2_get, _Box2D.b2PulleyJoint_limitImpulse2_set) 6961 state = _swig_property(_Box2D.b2PulleyJoint_state_get, _Box2D.b2PulleyJoint_state_set) 6962 limitState1 = _swig_property(_Box2D.b2PulleyJoint_limitState1_get, _Box2D.b2PulleyJoint_limitState1_set) 6963 limitState2 = _swig_property(_Box2D.b2PulleyJoint_limitState2_get, _Box2D.b2PulleyJoint_limitState2_set)
6964 - def __repr__(self):
6965 return """b2PulleyJoint( 6966 body1 = %s, 6967 body2 = %s, 6968 collideConnected = %s, 6969 constant = %s, 6970 ground = %s, 6971 groundAnchor1 = %s, 6972 groundAnchor2 = %s, 6973 impulse = %s, 6974 length1 = %s, 6975 length2 = %s, 6976 limitImpulse1 = %s, 6977 limitImpulse2 = %s, 6978 limitMass1 = %s, 6979 limitMass2 = %s, 6980 limitState1 = %s, 6981 limitState2 = %s, 6982 localAnchor1 = %s, 6983 localAnchor2 = %s, 6984 maxLength1 = %s, 6985 maxLength2 = %s, 6986 pulleyMass = %s, 6987 ratio = %s, 6988 state = %s, 6989 type = %s, 6990 u1 = %s, 6991 u2 = %s, 6992 userData = %s, 6993 GetAnchor1() = %s, 6994 GetAnchor2() = %s)"""% tuple(str(a) for a in\ 6995 (self.body1,self.body2,self.collideConnected,self.constant,self.ground,self.groundAnchor1,self.groundAnchor2,self.impulse,self.length1,self.length2,self.limitImpulse1,self.limitImpulse2,self.limitMass1,self.limitMass2,self.limitState1,self.limitState2,self.localAnchor1,self.localAnchor2,self.maxLength1,self.maxLength2,self.pulleyMass,self.ratio,self.state,self.type,self.u1,self.u2,self.userData,self.GetAnchor1(),self.GetAnchor2()))
6996 6997 __getstate__=_pickle_get_joint 6998 __setstate__=_pickle_factory_set 6999 _pickle_finalize=_pickle_finalize_joint 7000 7001 length1 = property(GetLength1, None) 7002 length2 = property(GetLength2, None) 7003 7004 __swig_destroy__ = _Box2D.delete_b2PulleyJoint 7005 b2PulleyJoint.GetGroundAnchor1 = new_instancemethod(_Box2D.b2PulleyJoint_GetGroundAnchor1,None,b2PulleyJoint) 7006 b2PulleyJoint.GetGroundAnchor2 = new_instancemethod(_Box2D.b2PulleyJoint_GetGroundAnchor2,None,b2PulleyJoint) 7007 b2PulleyJoint.GetLength1 = new_instancemethod(_Box2D.b2PulleyJoint_GetLength1,None,b2PulleyJoint) 7008 b2PulleyJoint.GetLength2 = new_instancemethod(_Box2D.b2PulleyJoint_GetLength2,None,b2PulleyJoint) 7009 b2PulleyJoint.GetRatio = new_instancemethod(_Box2D.b2PulleyJoint_GetRatio,None,b2PulleyJoint) 7010 b2PulleyJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2PulleyJoint_InitVelocityConstraints,None,b2PulleyJoint) 7011 b2PulleyJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2PulleyJoint_SolveVelocityConstraints,None,b2PulleyJoint) 7012 b2PulleyJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2PulleyJoint_SolvePositionConstraints,None,b2PulleyJoint) 7013 b2PulleyJoint_swigregister = _Box2D.b2PulleyJoint_swigregister 7014 b2PulleyJoint_swigregister(b2PulleyJoint) 7015
7016 -class b2RevoluteJointDef(b2JointDef):
7017 """Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.""" 7018 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 7019 __repr__ = _swig_repr
7020 - def __init__(self):
7021 """ 7022 __init__(self) -> b2RevoluteJointDef 7023 7024 Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken. 7025 """ 7026 _Box2D.b2RevoluteJointDef_swiginit(self,_Box2D.new_b2RevoluteJointDef())
7027 - def Initialize(self, *args):
7028 """ 7029 Initialize(self, b2Body body1, b2Body body2, b2Vec2 anchor) 7030 7031 Initialize the bodies, anchors, and reference angle using the world anchor. 7032 """ 7033 return _Box2D.b2RevoluteJointDef_Initialize(self, *args)
7034 7035 localAnchor1 = _swig_property(_Box2D.b2RevoluteJointDef_localAnchor1_get, _Box2D.b2RevoluteJointDef_localAnchor1_set) 7036 localAnchor2 = _swig_property(_Box2D.b2RevoluteJointDef_localAnchor2_get, _Box2D.b2RevoluteJointDef_localAnchor2_set) 7037 referenceAngle = _swig_property(_Box2D.b2RevoluteJointDef_referenceAngle_get, _Box2D.b2RevoluteJointDef_referenceAngle_set) 7038 enableLimit = _swig_property(_Box2D.b2RevoluteJointDef_enableLimit_get, _Box2D.b2RevoluteJointDef_enableLimit_set) 7039 lowerAngle = _swig_property(_Box2D.b2RevoluteJointDef_lowerAngle_get, _Box2D.b2RevoluteJointDef_lowerAngle_set) 7040 upperAngle = _swig_property(_Box2D.b2RevoluteJointDef_upperAngle_get, _Box2D.b2RevoluteJointDef_upperAngle_set) 7041 enableMotor = _swig_property(_Box2D.b2RevoluteJointDef_enableMotor_get, _Box2D.b2RevoluteJointDef_enableMotor_set) 7042 motorSpeed = _swig_property(_Box2D.b2RevoluteJointDef_motorSpeed_get, _Box2D.b2RevoluteJointDef_motorSpeed_set) 7043 maxMotorTorque = _swig_property(_Box2D.b2RevoluteJointDef_maxMotorTorque_get, _Box2D.b2RevoluteJointDef_maxMotorTorque_set)
7044 - def __repr__(self):
7045 return """b2RevoluteJointDef( 7046 body1 = %s, 7047 body2 = %s, 7048 collideConnected = %s, 7049 enableLimit = %s, 7050 enableMotor = %s, 7051 localAnchor1 = %s, 7052 localAnchor2 = %s, 7053 lowerAngle = %s, 7054 maxMotorTorque = %s, 7055 motorSpeed = %s, 7056 referenceAngle = %s, 7057 type = %s, 7058 upperAngle = %s, 7059 userData = %s)"""% tuple(str(a) for a in\ 7060 (self.body1,self.body2,self.collideConnected,self.enableLimit,self.enableMotor,self.localAnchor1,self.localAnchor2,self.lowerAngle,self.maxMotorTorque,self.motorSpeed,self.referenceAngle,self.type,self.upperAngle,self.userData))
7061 7062 __getstate__=_generic_getstate 7063 __setstate__=_generic_setstate 7064 7065 __swig_destroy__ = _Box2D.delete_b2RevoluteJointDef 7066 b2RevoluteJointDef.Initialize = new_instancemethod(_Box2D.b2RevoluteJointDef_Initialize,None,b2RevoluteJointDef) 7067 b2RevoluteJointDef_swigregister = _Box2D.b2RevoluteJointDef_swigregister 7068 b2RevoluteJointDef_swigregister(b2RevoluteJointDef) 7069
7070 -class b2RevoluteJoint(b2Joint):
7071 """A revolute joint constrains to bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation about the shared point. A maximum motor torque is provided so that infinite forces are not generated.""" 7072 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') 7073 __repr__ = _swig_repr
7074 - def GetJointAngle(self):
7075 """ 7076 GetJointAngle(self) -> float32 7077 7078 Get the current joint angle in radians. 7079 """ 7080 return _Box2D.b2RevoluteJoint_GetJointAngle(self)
7081
7082 - def GetJointSpeed(self):
7083 """ 7084 GetJointSpeed(self) -> float32 7085 7086 Get the current joint angle speed in radians per second. 7087 """ 7088 return _Box2D.b2RevoluteJoint_GetJointSpeed(self)
7089
7090 - def IsLimitEnabled(self):
7091 """ 7092 IsLimitEnabled(self) -> bool 7093 7094 Is the joint limit enabled? 7095 """ 7096 return _Box2D.b2RevoluteJoint_IsLimitEnabled(self)
7097
7098 - def EnableLimit(self, *args):
7099 """ 7100 EnableLimit(self, bool flag) 7101 7102 Enable/disable the joint limit. 7103 """ 7104 return _Box2D.b2RevoluteJoint_EnableLimit(self, *args)
7105
7106 - def GetLowerLimit(self):
7107 """ 7108 GetLowerLimit(self) -> float32 7109 7110 Get the lower joint limit in radians. 7111 """ 7112 return _Box2D.b2RevoluteJoint_GetLowerLimit(self)
7113
7114 - def GetUpperLimit(self):
7115 """ 7116 GetUpperLimit(self) -> float32 7117 7118 Get the upper joint limit in radians. 7119 """ 7120 return _Box2D.b2RevoluteJoint_GetUpperLimit(self)
7121
7122 - def SetLimits(self, *args):
7123 """ 7124 SetLimits(self, float32 lower, float32 upper) 7125 7126 Set the joint limits in radians. 7127 """ 7128 return _Box2D.b2RevoluteJoint_SetLimits(self, *args)
7129
7130 - def IsMotorEnabled(self):
7131 """ 7132 IsMotorEnabled(self) -> bool 7133 7134 Is the joint motor enabled? 7135 """ 7136 return _Box2D.b2RevoluteJoint_IsMotorEnabled(self)
7137
7138 - def EnableMotor(self, *args):
7139 """ 7140 EnableMotor(self, bool flag) 7141 7142 Enable/disable the joint motor. 7143 """ 7144 return _Box2D.b2RevoluteJoint_EnableMotor(self, *args)
7145
7146 - def SetMotorSpeed(self, *args):
7147 """ 7148 SetMotorSpeed(self, float32 speed) 7149 7150 Set the motor speed in radians per second. 7151 """ 7152 return _Box2D.b2RevoluteJoint_SetMotorSpeed(self, *args)
7153
7154 - def GetMotorSpeed(self):
7155 """ 7156 GetMotorSpeed(self) -> float32 7157 7158 Get the motor speed in radians per second. 7159 """ 7160 return _Box2D.b2RevoluteJoint_GetMotorSpeed(self)
7161
7162 - def SetMaxMotorTorque(self, *args):
7163 """ 7164 SetMaxMotorTorque(self, float32 torque) 7165 7166 Set the maximum motor torque, usually in N-m. 7167 """ 7168 return _Box2D.b2RevoluteJoint_SetMaxMotorTorque(self, *args)
7169
7170 - def GetMotorTorque(self):
7171 """ 7172 GetMotorTorque(self) -> float32 7173 7174 Get the current motor torque, usually in N-m. 7175 """ 7176 return _Box2D.b2RevoluteJoint_GetMotorTorque(self)
7177
7178 - def __init__(self, *args):
7179 """ 7180 __init__(self, b2RevoluteJointDef _def) -> b2RevoluteJoint 7181 7182 A revolute joint constrains to bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation about the shared point. A maximum motor torque is provided so that infinite forces are not generated. 7183 """ 7184 _Box2D.b2RevoluteJoint_swiginit(self,_Box2D.new_b2RevoluteJoint(*args))
7185 - def InitVelocityConstraints(self, *args):
7186 """InitVelocityConstraints(self, b2TimeStep step)""" 7187 return _Box2D.b2RevoluteJoint_InitVelocityConstraints(self, *args)
7188
7189 - def SolveVelocityConstraints(self, *args):
7190 """SolveVelocityConstraints(self, b2TimeStep step)""" 7191 return _Box2D.b2RevoluteJoint_SolveVelocityConstraints(self, *args)
7192
7193 - def SolvePositionConstraints(self, *args):
7194 """SolvePositionConstraints(self, float32 baumgarte) -> bool""" 7195 return _Box2D.b2RevoluteJoint_SolvePositionConstraints(self, *args)
7196 7197 localAnchor1 = _swig_property(_Box2D.b2RevoluteJoint_localAnchor1_get, _Box2D.b2RevoluteJoint_localAnchor1_set) 7198 localAnchor2 = _swig_property(_Box2D.b2RevoluteJoint_localAnchor2_get, _Box2D.b2RevoluteJoint_localAnchor2_set) 7199 impulse = _swig_property(_Box2D.b2RevoluteJoint_impulse_get, _Box2D.b2RevoluteJoint_impulse_set) 7200 motorImpulse = _swig_property(_Box2D.b2RevoluteJoint_motorImpulse_get, _Box2D.b2RevoluteJoint_motorImpulse_set) 7201 mass = _swig_property(_Box2D.b2RevoluteJoint_mass_get, _Box2D.b2RevoluteJoint_mass_set) 7202 motorMass = _swig_property(_Box2D.b2RevoluteJoint_motorMass_get, _Box2D.b2RevoluteJoint_motorMass_set) 7203 enableMotor = _swig_property(_Box2D.b2RevoluteJoint_enableMotor_get, _Box2D.b2RevoluteJoint_enableMotor_set) 7204 maxMotorTorque = _swig_property(_Box2D.b2RevoluteJoint_maxMotorTorque_get, _Box2D.b2RevoluteJoint_maxMotorTorque_set) 7205 motorSpeed = _swig_property(_Box2D.b2RevoluteJoint_motorSpeed_get, _Box2D.b2RevoluteJoint_motorSpeed_set) 7206 enableLimit = _swig_property(_Box2D.b2RevoluteJoint_enableLimit_get, _Box2D.b2RevoluteJoint_enableLimit_set) 7207 referenceAngle = _swig_property(_Box2D.b2RevoluteJoint_referenceAngle_get, _Box2D.b2RevoluteJoint_referenceAngle_set) 7208 lowerAngle = _swig_property(_Box2D.b2RevoluteJoint_lowerAngle_get, _Box2D.b2RevoluteJoint_lowerAngle_set) 7209 upperAngle = _swig_property(_Box2D.b2RevoluteJoint_upperAngle_get, _Box2D.b2RevoluteJoint_upperAngle_set) 7210 limitState = _swig_property(_Box2D.b2RevoluteJoint_limitState_get, _Box2D.b2RevoluteJoint_limitState_set)
7211 - def __repr__(self):
7212 return """b2RevoluteJoint( 7213 body1 = %s, 7214 body2 = %s, 7215 collideConnected = %s, 7216 enableLimit = %s, 7217 enableMotor = %s, 7218 impulse = %s, 7219 limitState = %s, 7220 localAnchor1 = %s, 7221 localAnchor2 = %s, 7222 lowerAngle = %s, 7223 mass = %s, 7224 maxMotorTorque = %s, 7225 motorImpulse = %s, 7226 motorMass = %s, 7227 motorSpeed = %s, 7228 referenceAngle = %s, 7229 type = %s, 7230 upperAngle = %s, 7231 userData = %s, 7232 GetAnchor1() = %s, 7233 GetAnchor2() = %s, 7234 GetJointAngle() = %s, 7235 GetJointSpeed() = %s, 7236 GetLowerLimit() = %s, 7237 GetMotorTorque() = %s, 7238 GetUpperLimit() = %s, 7239 IsLimitEnabled() = %s, 7240 IsMotorEnabled() = %s)"""% tuple(str(a) for a in\ 7241 (self.body1,self.body2,self.collideConnected,self.enableLimit,self.enableMotor,self.impulse,self.limitState,self.localAnchor1,self.localAnchor2,self.lowerAngle,self.mass,self.maxMotorTorque,self.motorImpulse,self.motorMass,self.motorSpeed,self.referenceAngle,self.type,self.upperAngle,self.userData,self.GetAnchor1(),self.GetAnchor2(),self.GetJointAngle(),self.GetJointSpeed(),self.GetLowerLimit(),self.GetMotorTorque(),self.GetUpperLimit(),self.IsLimitEnabled(),self.IsMotorEnabled()))
7242 7243 __getstate__=_pickle_get_joint 7244 __setstate__=_pickle_factory_set 7245 _pickle_finalize=_pickle_finalize_joint 7246 7247 __swig_destroy__ = _Box2D.delete_b2RevoluteJoint 7248 b2RevoluteJoint.GetJointAngle = new_instancemethod(_Box2D.b2RevoluteJoint_GetJointAngle,None,b2RevoluteJoint) 7249 b2RevoluteJoint.GetJointSpeed = new_instancemethod(_Box2D.b2RevoluteJoint_GetJointSpeed,None,b2RevoluteJoint) 7250 b2RevoluteJoint.IsLimitEnabled = new_instancemethod(_Box2D.b2RevoluteJoint_IsLimitEnabled,None,b2RevoluteJoint) 7251 b2RevoluteJoint.EnableLimit = new_instancemethod(_Box2D.b2RevoluteJoint_EnableLimit,None,b2RevoluteJoint) 7252 b2RevoluteJoint.GetLowerLimit = new_instancemethod(_Box2D.b2RevoluteJoint_GetLowerLimit,None,b2RevoluteJoint) 7253 b2RevoluteJoint.GetUpperLimit = new_instancemethod(_Box2D.b2RevoluteJoint_GetUpperLimit,None,b2RevoluteJoint) 7254 b2RevoluteJoint.SetLimits = new_instancemethod(_Box2D.b2RevoluteJoint_SetLimits,None,b2RevoluteJoint) 7255 b2RevoluteJoint.IsMotorEnabled = new_instancemethod(_Box2D.b2RevoluteJoint_IsMotorEnabled,None,b2RevoluteJoint) 7256 b2RevoluteJoint.EnableMotor = new_instancemethod(_Box2D.b2RevoluteJoint_EnableMotor,None,b2RevoluteJoint) 7257 b2RevoluteJoint.SetMotorSpeed = new_instancemethod(_Box2D.b2RevoluteJoint_SetMotorSpeed,None,b2RevoluteJoint) 7258 b2RevoluteJoint.GetMotorSpeed = new_instancemethod(_Box2D.b2RevoluteJoint_GetMotorSpeed,None,b2RevoluteJoint) 7259 b2RevoluteJoint.SetMaxMotorTorque = new_instancemethod(_Box2D.b2RevoluteJoint_SetMaxMotorTorque,None,b2RevoluteJoint) 7260 b2RevoluteJoint.GetMotorTorque = new_instancemethod(_Box2D.b2RevoluteJoint_GetMotorTorque,None,b2RevoluteJoint) 7261 b2RevoluteJoint.InitVelocityConstraints = new_instancemethod(_Box2D.b2RevoluteJoint_InitVelocityConstraints,None,b2RevoluteJoint) 7262 b2RevoluteJoint.SolveVelocityConstraints = new_instancemethod(_Box2D.b2RevoluteJoint_SolveVelocityConstraints,None,b2RevoluteJoint) 7263 b2RevoluteJoint.SolvePositionConstraints = new_instancemethod(_Box2D.b2RevoluteJoint_SolvePositionConstraints,None,b2RevoluteJoint) 7264 b2RevoluteJoint_swigregister = _Box2D.b2RevoluteJoint_swigregister 7265 b2RevoluteJoint_swigregister(b2RevoluteJoint) 7266