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

type b2Shape

source code

Known Subclasses:

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. WARNING: you cannot reuse shapes.

Instance Methods [hide private]
 
__init__(self, *args, **kwargs) source code
 
__repr__(self) source code
 
__getstate__(self) source code
 
__setstate__(self, dict)
Takes each variable=value pair in the dictionary and sets the attributes based on them
source code
 
__eq__(a, b) source code
 
__ne__(self, other) source code
 
typeName(self) source code
 
getAsType(self)
Return a typecasted version of the shape
source code
 
GetType(...)
b2Shape_GetType(b2Shape self) -> b2ShapeType
source code
 
IsSensor(...)
b2Shape_IsSensor(b2Shape self) -> bool
source code
 
SetFilterData(...)
b2Shape_SetFilterData(b2Shape self, b2FilterData filter)
source code
 
GetFilterData(...)
b2Shape_GetFilterData(b2Shape self) -> b2FilterData
source code
 
GetBody(...)
b2Shape_GetBody(b2Shape self) -> b2Body
source code
 
GetNext(...)
b2Shape_GetNext(b2Shape self) -> b2Shape
source code
 
TestPoint(...)
b2Shape_TestPoint(b2Shape self, b2XForm xf, b2Vec2 p) -> bool
source code
 
ComputeAABB(...)
b2Shape_ComputeAABB(b2Shape self, b2AABB aabb, b2XForm xf)
source code
 
ComputeSweptAABB(...)
b2Shape_ComputeSweptAABB(b2Shape self, b2AABB aabb, b2XForm xf1, b2XForm xf2)
source code
 
ComputeMass(...)
b2Shape_ComputeMass(b2Shape self, b2MassData massData)
source code
 
ComputeSubmergedArea(...)
b2Shape_ComputeSubmergedArea(b2Shape self, b2Vec2 normal, float32 offset, b2XForm xf, b2Vec2 c) -> float32
source code
 
GetSweepRadius(...)
b2Shape_GetSweepRadius(b2Shape self) -> float32
source code
 
GetFriction(...)
b2Shape_GetFriction(b2Shape self) -> float32
source code
 
SetFriction(...)
b2Shape_SetFriction(b2Shape self, float32 friction)
source code
 
GetRestitution(...)
b2Shape_GetRestitution(b2Shape self) -> float32
source code
 
SetRestitution(...)
b2Shape_SetRestitution(b2Shape self, float32 restitution)
source code
 
GetDensity(...)
b2Shape_GetDensity(b2Shape self) -> float32
source code
 
SetDensity(...)
b2Shape_SetDensity(b2Shape self, float32 density)
source code
 
GetUserData(...)
b2Shape_GetUserData(b2Shape self) -> PyObject
source code
 
SetUserData(...)
b2Shape_SetUserData(b2Shape self, PyObject data)
source code
 
ClearUserData(...)
b2Shape_ClearUserData(b2Shape self)
source code
 
__hash__(...)
b2Shape___hash__(b2Shape self) -> int32
source code
 
TestSegment(...)
TestSegment(b2XForm xf, float32 _lambda, b2Vec2 normal, b2Segment segment, float32 maxLambda) -> b2SegmentCollide b2Shape_TestSegment(b2Shape self, b2XForm xf, b2Segment segment, float32 maxLambda) -> PyObject
source code
 
asCircle(...)
b2Shape_asCircle(b2Shape self) -> b2CircleShape
source code
 
asPolygon(...)
b2Shape_asPolygon(b2Shape self) -> b2PolygonShape
source code
 
asEdge(...)
b2Shape_asEdge(b2Shape self) -> b2EdgeShape
source code
Properties [hide private]
  thisown
The membership flag
  userData
GetUserData(self) -> PyObject
  filter
GetFilterData(self) -> b2FilterData
  friction
GetFriction(self) -> float32
  restitution
GetRestitution(self) -> float32
  density
GetDensity(self) -> float32
  isSensor
IsSensor(self) -> bool
Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 
Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 
Overrides: object.__repr__
(inherited documentation)

GetType(...)

source code 

b2Shape_GetType(b2Shape self) -> b2ShapeType

Get the type of this shape. You can use this to down cast to the concrete shape. the shape type.

IsSensor(...)

source code 

b2Shape_IsSensor(b2Shape self) -> bool

Is this shape a sensor (non-solid)? the true if the shape is a sensor.

SetFilterData(...)

source code 

b2Shape_SetFilterData(b2Shape self, b2FilterData filter)

Set the contact filtering data. You must call b2World::Refilterto correct existing contacts/non-contacts.

GetFilterData(...)

source code 

b2Shape_GetFilterData(b2Shape self) -> b2FilterData

Get the contact filtering data.

GetBody(...)

source code 

b2Shape_GetBody(b2Shape self) -> b2Body

Get the parent body of this shape. This is NULL if the shape is not attached. the parent body.

GetNext(...)

source code 

b2Shape_GetNext(b2Shape self) -> b2Shape

Get the next shape in the parent body's shape list. the next shape.

TestPoint(...)

source code 

b2Shape_TestPoint(b2Shape self, b2XForm xf, b2Vec2 p) -> bool

Test a point for containment in this shape. This only works for convex shapes.

Parameters:
-----------

xf: the shape world transform.

p: a point in world coordinates.

ComputeAABB(...)

source code 

b2Shape_ComputeAABB(b2Shape self, b2AABB aabb, b2XForm xf)

Given a transform, compute the associated axis aligned bounding box for this shape.

Parameters:
-----------

aabb: returns the axis aligned box.

xf: the world transform of the shape.

ComputeSweptAABB(...)

source code 

b2Shape_ComputeSweptAABB(b2Shape self, b2AABB aabb, b2XForm xf1, b2XForm xf2)

Given two transforms, compute the associated swept axis aligned bounding box for this shape.

Parameters:
-----------

aabb: returns the axis aligned box.

xf1: the starting shape world transform.

xf2: the ending shape world transform.

ComputeMass(...)

source code 

b2Shape_ComputeMass(b2Shape self, b2MassData massData)

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.

Parameters:
-----------

massData: returns the mass data for this shape.

ComputeSubmergedArea(...)

source code 

b2Shape_ComputeSubmergedArea(b2Shape self, b2Vec2 normal, float32 offset, b2XForm xf, 
    b2Vec2 c) -> float32

Compute the volume and centroid of this shape intersected with a half plane

Parameters:
-----------

normal: the surface normal

offset: the surface offset along normal

xf: the shape transform

c: returns the centroid

the total volume less than offset along normal

GetSweepRadius(...)

source code 

b2Shape_GetSweepRadius(b2Shape self) -> float32

Get the maximum radius about the parent body's center of mass.

GetFriction(...)

source code 

b2Shape_GetFriction(b2Shape self) -> float32

Get the coefficient of friction.

SetFriction(...)

source code 

b2Shape_SetFriction(b2Shape self, float32 friction)

Set the coefficient of friction.

GetRestitution(...)

source code 

b2Shape_GetRestitution(b2Shape self) -> float32

Get the coefficient of restitution.

SetRestitution(...)

source code 

b2Shape_SetRestitution(b2Shape self, float32 restitution)

Set the coefficient of restitution.

GetDensity(...)

source code 

b2Shape_GetDensity(b2Shape self) -> float32

Get the density of the shape.

SetDensity(...)

source code 

b2Shape_SetDensity(b2Shape self, float32 density)

Set the density of the shape.

GetUserData(...)

source code 

b2Shape_GetUserData(b2Shape self) -> PyObject

Get the user data that was assigned in the shape definition. Use this to store your application specific data.

SetUserData(...)

source code 

b2Shape_SetUserData(b2Shape self, PyObject data)

Set the user data. Use this to store your application specific data.

__hash__(...)
(Hashing function)

source code 

b2Shape___hash__(b2Shape self) -> int32

Overrides: object.__hash__

TestSegment(...)

source code 

TestSegment(b2XForm xf, float32 _lambda, b2Vec2 normal, b2Segment segment, 
    float32 maxLambda) -> b2SegmentCollide
b2Shape_TestSegment(b2Shape self, b2XForm xf, b2Segment segment, float32 maxLambda) -> PyObject

Perform a ray cast against this shape.

Parameters:
-----------

xf: 
the shape world transform.

lambda: 
returns the hit fraction. You can use this to compute the contact point p = (1 - lambda) * segment.p1 + lambda * segment.p2.

normal: 
returns the normal at the contact point. If there is no intersection, the normal is not set.

segment: 
defines the begin and end point of the ray cast.

maxLambda: 
a number typically in the range [0,1].


Property Details [hide private]

thisown

The membership flag

userData

GetUserData(self) -> PyObject

Get the user data that was assigned in the shape definition. Use this to store your application specific data.

filter

GetFilterData(self) -> b2FilterData

Get the contact filtering data.

friction

GetFriction(self) -> float32

Get the coefficient of friction.

restitution

GetRestitution(self) -> float32

Get the coefficient of restitution.

density

GetDensity(self) -> float32

Get the density of the shape.

isSensor

IsSensor(self) -> bool

Is this shape a sensor (non-solid)? the true if the shape is a sensor.