siconos.mechanics.collision.bullet

Module documentation

class siconos.mechanics.collision.bullet.nullDeleter(*args, **kwargs)[source]

Bases: object

Using a shared_ptr to hold a pointer to a statically allocated

object use create<type>SPtr(<type> &x) cf http://www.boost.org/doc/

class siconos.mechanics.collision.bullet.SiconosBodies[source]

Bases: object

SiconosBodies : a Siconos Model, some plans and space filtering capabilities

class siconos.mechanics.collision.bullet.SiconosContactor(*args)[source]

Bases: object

Class to hold the shape assigned to a body, and to associate each shape with an offset and collision group.

class siconos.mechanics.collision.bullet.ContactR[source]

Bases: siconos.kernel.NewtonEuler3DR

constructor

computeh(time, q0, y)[source]

to compute the output y = h(t,q,z) of the Relation

Parameters
  • time (float) – current time value

  • q – coordinates of the dynamical systems involved in the relation

  • y (SiconosVector) – the resulting vector

updateContactPoints(pos1, pos2, normal)[source]

Update this contact point information.

Parameters
  • pos1 (SiconosVector) – Position on ds1 in ds1 frame.

  • pos2 (SiconosVector) – Position on ds2 in ds2 frame (or world frame if ds2=null).

  • normal (SiconosVector) – Normal in ds2 frame (or world frame if ds2=null).

display()[source]

main relation members display

class siconos.mechanics.collision.bullet.RigidBodyDS(*args)[source]

Bases: siconos.kernel.NewtonEulerDS

Overload 1: Default constructor


Overload 2: constructor from a minimum set of data

Parameters
  • position (SiconosVector) – initial coordinates of this DynamicalSystem

  • twist (SiconosVector) – initial twist of this DynamicalSystem

  • mass (float) – the mass

  • inertia (SiconosMatrix) – the inertia matrix

allowSelfCollide()[source]

Return the value of the _allowSelfCollide flag.

setAllowSelfCollide(x)[source]

Set the value of the _allowSelfCollide flag.

contactors()[source]

Access the contactor set associated with this body.

Return type

SiconosContactorSet

Returns

A SP::SiconosContactorSet

setContactors(c)[source]

Provide a set of contactors to the body.

Parameters

c (SiconosContactorSet) – A SP::SiconosContactorSet

base_position()[source]

Make the base position of the contactors equal to the DS q vector.

Return type

SiconosVector

Returns

a SP::SiconosVector

class siconos.mechanics.collision.bullet.Contact5DR[source]

Bases: siconos.kernel.NewtonEuler5DR

constructor

computeh(time, q0, y)[source]

to compute the output y = h(t,q) of the Relation

Parameters
  • time (float) – current time value

  • q – coordinates of the dynamical systems involved in the relation

  • y (SiconosVector) – the resulting vector

updateContactPoints(pos1, pos2, normal)[source]

Update this contact point information.

Parameters
  • pos1 (SiconosVector) – Position on ds1 in ds1 frame.

  • pos2 (SiconosVector) – Position on ds2 in ds2 frame (or world frame if ds2=null).

  • normal (SiconosVector) – Normal in ds2 frame (or world frame if ds2=null).

class siconos.mechanics.collision.bullet.RigidBody2dDS(*args)[source]

Bases: siconos.kernel.LagrangianLinearTIDS

Overload 1: default constructor


Overload 2: constructor from initial state and all matrix operators.

Parameters
  • q0 (SiconosVector) – initial coordinates

  • v0 (SiconosVector) – initial velocity

  • M (SiconosMatrix) – mass matrix

  • K (SiconosMatrix) – stiffness matrix

  • C (SiconosMatrix) – damping matrix


Overload 3: constructor from initial state and mass matrix only. Leads to \(M\dot v = F_{ext}(t,z) + p\) .

Parameters
  • q0 (SiconosVector) – initial coordinates

  • v0 (SiconosVector) – initial velocity

  • M (SiconosMatrix) – mass matrix

allowSelfCollide()[source]

Return the value of the _allowSelfCollide flag.

setAllowSelfCollide(x)[source]

Set the value of the _allowSelfCollide flag.

contactors()[source]
Return type

SiconosContactorSet

Returns

the contactor set associated with this body

setContactors(c)[source]

Provide a set of contactors to the body.

Parameters

c (SiconosContactorSet) – A SP::SiconosContactorSet

base_position()[source]

Make the base position of the contactors equal to the DS q vector.

Return type

SiconosVector

Returns

a SP::SiconosVector

class siconos.mechanics.collision.bullet.SiconosCollisionQueryResult[source]

Bases: object

Holds one result of a line segment intersection query against the graph of body contactors maintained by a SiconosCollisionManager

property distance

Distance from reference point (start of line segment or query center)

property body

Body owning the contactor that was intersected, may be null for static contactors.

property shape

The shape that was intersected.

property contactor

The contactor that was intersected.

property point

Closest point on contactor in world coordinates.

class siconos.mechanics.collision.bullet.btVector3(*args)[source]

Bases: object

btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when btVector3 is stored in containers. This extra component can be used by derived classes (Quaternion?) or by user Ideally, this class should be replaced by a platform optimized SIMD version that keeps the data in registers

Overload 1: No initialization constructor


Overload 2: Constructor from scalars :param x: X value :param y: Y value :param z: Z value

dot(v)[source]

Return the dot product :type v: btVector3 :param v: The other vector in the dot product

length2()[source]

Return the length of the vector squared

length()[source]

Return the length of the vector

norm()[source]

Return the norm (length) of the vector

safeNorm()[source]

Return the norm (length) of the vector

distance2(v)[source]

Return the distance squared between the ends of this and another vector This is symantically treating the vector like a point

distance(v)[source]

Return the distance between the ends of this and another vector This is symantically treating the vector like a point

normalize()[source]

Normalize this vector x^2 + y^2 + z^2 = 1

normalized()[source]

Return a normalized version of this vector

rotate(wAxis, angle)[source]

Return a rotated version of this vector :type wAxis: btVector3 :param wAxis: The axis to rotate about :type angle: float :param angle: The angle to rotate by

angle(v)[source]

Return the angle between this and another vector :type v: btVector3 :param v: The other vector

absolute()[source]

Return a vector with the absolute values of each element

cross(v)[source]

Return the cross product between this and another vector :type v: btVector3 :param v: The other vector

minAxis()[source]

Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z

maxAxis()[source]

Return the axis with the largest value Note return values are 0,1,2 for x, y, or z

lerp(v, t)[source]

Return the linear interpolation between this and another vector :type v: btVector3 :param v: The other vector :type t: float :param t: The ration of this to v (t = 0 => return this, t=1 => return other)

getX()[source]

Return the x value

getY()[source]

Return the y value

getZ()[source]

Return the z value

setX(_x)[source]

Set the x value

setY(_y)[source]

Set the y value

setZ(_z)[source]

Set the z value

setW(_w)[source]

Set the w value

x()[source]

Return the x value

y()[source]

Return the y value

z()[source]

Return the z value

w()[source]

Return the w value

setMax(other)[source]

Set each element to the max of the current values and the values of another btVector3 :type other: btVector3 :param other: The other btVector3 to compare with

setMin(other)[source]

Set each element to the min of the current values and the values of another btVector3 :type other: btVector3 :param other: The other btVector3 to compare with

maxDot(array, array_count, dotOut)[source]

returns index of maximum dot product between this and vectors in array[] :type array: btVector3 :param array: The other vectors :type array_count: int :param array_count: The number of other vectors :type dotOut: float :param dotOut: The maximum dot product

minDot(array, array_count, dotOut)[source]

returns index of minimum dot product between this and vectors in array[] :type array: btVector3 :param array: The other vectors :type array_count: int :param array_count: The number of other vectors :type dotOut: float :param dotOut: The minimum dot product

siconos.mechanics.collision.bullet.btDot(v1, v2)[source]

Return the dot product between two vectors

siconos.mechanics.collision.bullet.btDistance2(v1, v2)[source]

Return the distance squared between two vectors

siconos.mechanics.collision.bullet.btDistance(v1, v2)[source]

Return the distance between two vectors

siconos.mechanics.collision.bullet.btCross(v1, v2)[source]

Return the cross product of two vectors

siconos.mechanics.collision.bullet.lerp(v1, v2, t)[source]

Return the linear interpolation between two vectors :type v1: btVector3 :param v1: One vector :type v2: btVector3 :param v2: The other vector :type t: float :param t: The ration of this to v (t = 0 => return v1, t=1 => return v2)

siconos.mechanics.collision.bullet.btSwapScalarEndian(sourceVal, destVal)[source]

btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization

siconos.mechanics.collision.bullet.btSwapVector3Endian(sourceVec, destVec)[source]

btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization

siconos.mechanics.collision.bullet.btUnSwapVector3Endian(vector)[source]

btUnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization

class siconos.mechanics.collision.bullet.btQuadWord(*args)[source]

Bases: object

The btQuadWord class is base class for btVector3 and btQuaternion. Some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword.

Overload 1: No initialization constructor


Overload 2: Three argument constructor (zeros w) :param x: Value of x :param y: Value of y :param z: Value of z


Overload 3: Initializing constructor :param x: Value of x :param y: Value of y :param z: Value of z :param w: Value of w

getX()[source]

Return the x value

getY()[source]

Return the y value

getZ()[source]

Return the z value

setX(_x)[source]

Set the x value

setY(_y)[source]

Set the y value

setZ(_z)[source]

Set the z value

setW(_w)[source]

Set the w value

x()[source]

Return the x value

y()[source]

Return the y value

z()[source]

Return the z value

w()[source]

Return the w value

setValue(*args)[source]

Overload 1: Set x,y,z and zero w :param x: Value of x :param y: Value of y :param z: Value of z


Overload 2: Set the values :param x: Value of x :param y: Value of y :param z: Value of z :param w: Value of w

setMax(other)[source]

Set each element to the max of the current values and the values of another btQuadWord :type other: btQuadWord :param other: The other btQuadWord to compare with

setMin(other)[source]

Set each element to the min of the current values and the values of another btQuadWord :type other: btQuadWord :param other: The other btQuadWord to compare with

class siconos.mechanics.collision.bullet.btQuaternion(*args)[source]

Bases: siconos.mechanics.collision.bullet.btQuadWord

The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatrix3x3, btVector3 and btTransform.

Overload 1: No initialization constructor


Overload 2: Constructor from scalars


Overload 3: Axis angle Constructor :param axis: The axis which the rotation is around :param angle: The magnitude of the rotation around the angle (Radians)


Overload 4: Constructor from Euler angles :type yaw: float :param yaw: Angle around Y unless BT_EULER_DEFAULT_ZYX defined then Z :type pitch: float :param pitch: Angle around X unless BT_EULER_DEFAULT_ZYX defined then Y :type roll: float :param roll: Angle around Z unless BT_EULER_DEFAULT_ZYX defined then X

setRotation(axis, _angle)[source]

Set the rotation using axis angle notation :type axis: btVector3 :param axis: The axis around which to rotate :param angle: The magnitude of the rotation in Radians

setEuler(yaw, pitch, roll)[source]

Set the quaternion using Euler angles :type yaw: float :param yaw: Angle around Y :type pitch: float :param pitch: Angle around X :type roll: float :param roll: Angle around Z

setEulerZYX(yawZ, pitchY, rollX)[source]

Set the quaternion using euler angles :param yaw: Angle around Z :param pitch: Angle around Y :param roll: Angle around X

getEulerZYX(yawZ, pitchY, rollX)[source]

Get the euler angles from this quaternion :param yaw: Angle around Z :param pitch: Angle around Y :param roll: Angle around X

dot(q)[source]

Return the dot product between this quaternion and another :type q: btQuaternion :param q: The other quaternion

length2()[source]

Return the length squared of the quaternion

length()[source]

Return the length of the quaternion

normalize()[source]

Normalize the quaternion Such that x^2 + y^2 + z^2 +w^2 = 1

normalized()[source]

Return a normalized version of this quaternion

angle(q)[source]

Return the *half* angle between this quaternion and the other :type q: btQuaternion :param q: The other quaternion

angleShortestPath(q)[source]

Return the angle between this quaternion and the other along the shortest path :type q: btQuaternion :param q: The other quaternion

getAngle()[source]

Return the angle [0, 2Pi] of rotation represented by this quaternion

getAngleShortestPath()[source]

Return the angle [0, Pi] of rotation represented by this quaternion along the shortest path

getAxis()[source]

Return the axis of the rotation represented by this quaternion

inverse()[source]

Return the inverse of this quaternion

farthest(qd)[source]

TODO: document this and it’s use

nearest(qd)[source]

TODO: document this and it’s use

slerp(q, t)[source]

Return the quaternion which is the result of Spherical Linear Interpolation between this and the other quaternion :type q: btQuaternion :param q: The other quaternion to interpolate with :type t: float :param t: The ratio between this and q to interpolate. If t = 0 the result is this, if t=1 the result is q.

Slerp interpolates assuming constant velocity.

siconos.mechanics.collision.bullet.dot(q1, q2)[source]

Calculate the dot product between two quaternions

siconos.mechanics.collision.bullet.length(q)[source]

Return the length of a quaternion

siconos.mechanics.collision.bullet.btAngle(*args)[source]

Overload 1: Return the angle between two vectors


Overload 2: Return the angle between two quaternions

siconos.mechanics.collision.bullet.inverse(q)[source]

Return the inverse of a quaternion

siconos.mechanics.collision.bullet.slerp(q1, q2, t)[source]

Return the result of spherical linear interpolation betwen two quaternions :type q1: btQuaternion :param q1: The first quaternion :type q2: btQuaternion :param q2: The second quaternion :type t: float :param t: The ration between q1 and q2. t = 0 return q1, t=1 returns q2

Slerp assumes constant velocity between positions.

class siconos.mechanics.collision.bullet.btMatrix3x3(*args)[source]

Bases: object

The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with btQuaternion, btTransform and btVector3. Make sure to only include a pure orthogonal matrix without scaling.

getColumn(i)[source]

Get a column of the matrix as a vector :type i: int :param i: Column number 0 indexed

getRow(i)[source]

Get a row of the matrix as a vector :type i: int :param i: Row number 0 indexed

setFromOpenGLSubMatrix(m)[source]

Set from the rotational part of a 4x4 OpenGL matrix :type m: float :param m: A pointer to the beginning of the array of scalars

setValue(xx, xy, xz, yx, yy, yz, zx, zy, zz)[source]

Set the values of the matrix explicitly (row major) :type xx: float :param xx: Top left :type xy: float :param xy: Top Middle :type xz: float :param xz: Top Right :type yx: float :param yx: Middle Left :type yy: float :param yy: Middle Middle :type yz: float :param yz: Middle Right :type zx: float :param zx: Bottom Left :type zy: float :param zy: Bottom Middle :type zz: float :param zz: Bottom Right

setRotation(q)[source]

Set the matrix from a quaternion :type q: btQuaternion :param q: The Quaternion to match

setEulerYPR(yaw, pitch, roll)[source]

Set the matrix from euler angles using YPR around YXZ respectively :type yaw: float :param yaw: Yaw about Y axis :type pitch: float :param pitch: Pitch about X axis :type roll: float :param roll: Roll about Z axis

setEulerZYX(eulerX, eulerY, eulerZ)[source]

Set the matrix from euler angles YPR around ZYX axes

Parameters
  • eulerX (float) – Roll about X axis

  • eulerY (float) – Pitch around Y axis

  • eulerZ (float) – Yaw about Z axis

These angles are used to produce a rotation matrix. The euler angles are applied in ZYX order. I.e a vector is first rotated about X then Y and then Z

setIdentity()[source]

Set the matrix to the identity

setZero()[source]

Set the matrix to the identity

getOpenGLSubMatrix(m)[source]

Fill the rotational part of an OpenGL matrix and clear the shear/perspective :type m: float :param m: The array to be filled

getRotation(q)[source]

Get the matrix represented as a quaternion :type q: btQuaternion :param q: The quaternion which will be set

getEulerYPR(yaw, pitch, roll)[source]

Get the matrix represented as euler angles around YXZ, roundtrip with setEulerYPR :type yaw: float :param yaw: Yaw around Y axis :type pitch: float :param pitch: Pitch around X axis :type roll: float :param roll: around Z axis

getEulerZYX(yaw, pitch, roll, solution_number=1)[source]

Get the matrix represented as euler angles around ZYX :type yaw: float :param yaw: Yaw around Z axis :type pitch: float :param pitch: Pitch around Y axis :type roll: float :param roll: around X axis :type solution_number: int, optional :param solution_number: Which solution of two possible solutions ( 1 or 2) are possible values

scaled(s)[source]

Create a scaled copy of the matrix :type s: btVector3 :param s: Scaling vector The elements of the vector will scale each column

determinant()[source]

Return the determinant of the matrix

adjoint()[source]

Return the adjoint of the matrix

absolute()[source]

Return the matrix with all values non negative

transpose()[source]

Return the transpose of the matrix

inverse()[source]

Return the inverse of the matrix

solve33(b)[source]

Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.

Solve33 is from Box2d, thanks to Erin Catto,

extractRotation(q, tolerance=1e-09, maxIter=100)[source]

extractRotation is from “A robust method to extract the rotational part of deformations” See http://dl.acm.org/citation.cfm?doid=2994258.2994269 decomposes a matrix A in a orthogonal matrix R and a symmetric matrix S: A = R*S. note that R can include both rotation and scaling.

diagonalize(rot, threshold, maxSteps)[source]

diagonalizes this matrix by the Jacobi method. :type rot: btMatrix3x3 :param rot: stores the rotation from the coordinate system in which the matrix is diagonal to the original

coordinate system, i.e., old_this = rot * new_this * rot^T.

Parameters
  • threshold (float) – See iteration

  • iteration – The iteration stops when all off-diagonal elements are less than the threshold multiplied by the sum of the absolute values of the diagonal, or when maxSteps have been executed.

Note that this matrix is assumed to be symmetric.

cofac(r1, c1, r2, c2)[source]

Calculate the matrix cofactor :type r1: int :param r1: The first row to use for calculating the cofactor :type c1: int :param c1: The first column to use for calculating the cofactor :type r1: int :param r1: The second row to use for calculating the cofactor :type c1: int :param c1: The second column to use for calculating the cofactor

class siconos.mechanics.collision.bullet.btMatrix3x3FloatData[source]

Bases: object

for serialization

class siconos.mechanics.collision.bullet.btMatrix3x3DoubleData[source]

Bases: object

for serialization

class siconos.mechanics.collision.bullet.btTransform(*args)[source]

Bases: object

The btTransform class supports rigid transforms with only translation and rotation and no scaling/shear. It can be used in combination with btVector3, btQuaternion and btMatrix3x3 linear algebra classes.

Overload 1: No initialization constructor


Overload 2: Constructor from btQuaternion (optional btVector3 ) :type q: btQuaternion :param q: Rotation from quaternion :type c: btVector3, optional :param c: Translation from Vector (default 0,0,0)


Overload 3: Constructor from btQuaternion (optional btVector3 ) :type q: btQuaternion :param q: Rotation from quaternion :param c: Translation from Vector (default 0,0,0)


Overload 4: Constructor from btMatrix3x3 (optional btVector3) :type b: btMatrix3x3 :param b: Rotation from Matrix :type c: btVector3, optional :param c: Translation from Vector default (0,0,0)


Overload 5: Constructor from btMatrix3x3 (optional btVector3) :type b: btMatrix3x3 :param b: Rotation from Matrix :param c: Translation from Vector default (0,0,0)


Overload 6: Copy constructor

mult(t1, t2)[source]

Set the current transform as the value of the product of two transforms :type t1: btTransform :param t1: Transform 1 :type t2: btTransform :param t2: Transform 2

This = Transform1 * Transform2

getBasis(*args)[source]

Overload 1: Return the basis matrix for the rotation


Overload 2: Return the basis matrix for the rotation

getOrigin(*args)[source]

Overload 1: Return the origin vector translation


Overload 2: Return the origin vector translation

getRotation()[source]

Return a quaternion representing the rotation

setFromOpenGLMatrix(m)[source]

Set from an array :type m: float :param m: A pointer to a 16 element array (12 rotation(row major padded on the right by 1), and 3 translation

getOpenGLMatrix(m)[source]

Fill an array representation :type m: float :param m: A pointer to a 16 element array (12 rotation(row major padded on the right by 1), and 3 translation

setOrigin(origin)[source]

Set the translational element :type origin: btVector3 :param origin: The vector to set the translation to

setBasis(basis)[source]

Set the rotational element by btMatrix3x3

setRotation(q)[source]

Set the rotational element by btQuaternion

setIdentity()[source]

Set this transformation to the identity

inverse()[source]

Return the inverse of this transform

inverseTimes(t)[source]

Return the inverse of this transform times the other transform :type t: btTransform :param t: The other transform

return this.inverse() * the other

static getIdentity()[source]

Return an identity transform

siconos.mechanics.collision.bullet.btTransform_getIdentity()[source]

Return an identity transform

class siconos.mechanics.collision.bullet.btTransformFloatData[source]

Bases: object

for serialization

class siconos.mechanics.collision.bullet.btDefaultCollisionConfiguration(*args)[source]

Bases: object

btCollisionConfiguration allows to configure Bullet collision detection stack allocator, pool memory allocators TODO: : describe the meaning

getPersistentManifoldPool()[source]

memory pools

setConvexConvexMultipointIterations(numPerturbationIterations=3, minimumPointsPerturbationThreshold=3)[source]

Use this method to allow to generate multiple contact points between at once, between two objects using the generic convex-convex algorithm. By default, this feature is disabled for best performance. :type numPerturbationIterations: int, optional :param numPerturbationIterations: controls the number of collision queries. Set it to zero to disable the feature. :type minimumPointsPerturbationThreshold: int, optional :param minimumPointsPerturbationThreshold: is the minimum number of points in the contact cache, above which the feature is disabled

3 is a good value for both params, if you want to enable the feature. This is because the default contact cache contains a maximum of 4 points, and one collision query at the unperturbed orientation is performed first. See Bullet/Demos/CollisionDemo for an example how this feature gathers multiple points.

TODO: we could add a per-object setting of those parameters, for level-of-detail collision detection.

class siconos.mechanics.collision.bullet.btCollisionObject[source]

Bases: object

btCollisionObject can be used to manage collision detection objects. btCollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy. They can be added to the btCollisionWorld.

CO_GHOST_OBJECT = 4

CO_GHOST_OBJECT keeps track of all objects overlapping its AABB and that pass its collision filter It is useful for collision sensors, explosion objects, character controller etc.

setContactProcessingThreshold(contactProcessingThreshold)[source]

the constraint solver can discard solving contacts, if the distance is above this threshold. 0 by default. Note that using contacts with positive distance can improve stability. It increases, however, the chance of colliding with degerate contacts, such as ‘interior’ triangle edges

internalGetExtensionPointer()[source]

Avoid using this internal API call, the extension pointer is used by some Bullet extensions. If you need to store your own user pointer, use ‘setUserPointer/getUserPointer’ instead.

internalSetExtensionPointer(pointer)[source]

Avoid using this internal API call, the extension pointer is used by some Bullet extensions If you need to store your own user pointer, use ‘setUserPointer/getUserPointer’ instead.

getInternalType()[source]

reserved for Bullet internal usage

getCcdSweptSphereRadius()[source]

Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm:

setCcdSweptSphereRadius(radius)[source]

Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm:

setCcdMotionThreshold(ccdMotionThreshold)[source]

Don’t do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold

getUserPointer()[source]

users can point to their objects, userPointer is not used by Bullet

setUserPointer(userPointer)[source]

users can point to their objects, userPointer is not used by Bullet

setUserIndex(index)[source]

users can point to their objects, userPointer is not used by Bullet

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btCollisionObjectDoubleData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btCollisionObjectFloatData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btDispatcher(*args, **kwargs)[source]

Bases: object

The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs. For example for pairwise collision detection, calculating contact points stored in btPersistentManifold or user callbacks (game logic).

class siconos.mechanics.collision.bullet.btBroadphaseInterface(*args, **kwargs)[source]

Bases: object

The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs. Some implementations for this broadphase interface include btAxisSweep3, bt32BitAxisSweep3 and btDbvtBroadphase. The actual overlapping pair management, storage, adding and removing of pairs is dealt by the btOverlappingPairCache class.

calculateOverlappingPairs(dispatcher)[source]

calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb

getBroadphaseAabb(aabbMin, aabbMax)[source]

getAabb returns the axis aligned bounding box in the ‘global’ coordinate frame will add some transform later

resetPool(dispatcher)[source]

reset broadphase internal structures, to ensure determinism/reproducability

class siconos.mechanics.collision.bullet.btCollisionWorld(dispatcher, broadphasePairCache, collisionConfiguration)[source]

Bases: object

CollisionWorld is interface and container for the collision detection

computeOverlappingPairs()[source]

the computeOverlappingPairs is usually already called by performDiscreteCollisionDetection (or stepSimulation) it can be useful to use if you perform ray tests without collision detection/simulation

rayTest(rayFromWorld, rayToWorld, resultCallback)[source]

rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.

convexSweepTest(*args)[source]

convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultCallback This allows for several queries: first hit, all hits, any hit, dependent on the value return by the callback.

contactTest(colObj, resultCallback)[source]

contactTest performs a discrete collision test between colObj against all objects in the btCollisionWorld, and calls the resultCallback. it reports one or more contact points for every overlapping object (including the one with deepest penetration)

contactPairTest(colObjA, colObjB, resultCallback)[source]

contactTest performs a discrete collision test between two collision objects and calls the resultCallback if overlap if detected. it reports one or more contact points (including the one with deepest penetration)

static rayTestSingle(rayFromTrans, rayToTrans, collisionObject, collisionShape, colObjWorldTransform, resultCallback)[source]

rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest. In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape. This allows more customization.

static objectQuerySingle(castShape, rayFromTrans, rayToTrans, collisionObject, collisionShape, colObjWorldTransform, resultCallback, allowedPenetration)[source]

objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.

serialize(serializer)[source]

Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (Bullet/Demos/SerializeDemo)

siconos.mechanics.collision.bullet.btCollisionWorld_rayTestSingle(rayFromTrans, rayToTrans, collisionObject, collisionShape, colObjWorldTransform, resultCallback)[source]

rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest. In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape. This allows more customization.

siconos.mechanics.collision.bullet.btCollisionWorld_objectQuerySingle(castShape, rayFromTrans, rayToTrans, collisionObject, collisionShape, colObjWorldTransform, resultCallback, allowedPenetration)[source]

objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.

class siconos.mechanics.collision.bullet.btManifoldPoint(*args)[source]

Bases: object

ManifoldContactPoint collects and maintains persistent contactpoints. used to improve stability and performance of rigidbody dynamics response.

property m_positionWorldOnA

m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity

getAppliedImpulse()[source]

this returns the most recent applied impulse, to satisfy contact constraints by the constraint solver

class siconos.mechanics.collision.bullet.btPersistentManifold(*args)[source]

Bases: object

btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping in the broadphase. Those contact points are created by the collision narrow phase. The cache can be empty, or hold 1,2,3 or 4 points. Some collision algorithms (GJK) might only add one point at a time. updates/refreshes old contact points, and throw them away if necessary (distance becomes too large) reduces the cache to 4 points, when more then 4 points are added, using following rules: the contact point with deepest penetration is always kept, and it tries to maximuze the area covered by the points note that some pairs of objects might have more then one contact manifold.

setNumContacts(cachedPoints)[source]

the setNumContacts API is usually not used, except when you gather/fill all contacts manually

getContactBreakingThreshold()[source]

TODO: : get this margin from the current physics / collision environment

refreshContactPoints(trA, trB)[source]

calculated new worldspace coordinates and depth, and reject points that exceed the collision margin

class siconos.mechanics.collision.bullet.btCollisionShape(*args, **kwargs)[source]

Bases: object

The btCollisionShape class provides an interface for collision shapes that can be shared among btCollisionObjects.

getAabb(t, aabbMin, aabbMax)[source]

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

getAngularMotionDisc()[source]

getAngularMotionDisc returns the maximum radius needed for Conservative Advancement to handle time-of-impact with rotations.

calculateTemporalAabb(curTrans, linvel, angvel, timeStep, temporalAabbMin, temporalAabbMax)[source]

calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep) result is conservative

isInfinite()[source]

isInfinite is used to catch simulation error (aabb check)

getAnisotropicRollingFrictionDirection()[source]

the getAnisotropicRollingFrictionDirection can be used in combination with setAnisotropicFriction See Bullet/Demos/RollingFrictionDemo for an example

setUserPointer(userPtr)[source]

optional user data pointer

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btCollisionShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btConvexShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btCollisionShape

The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape, btConvexHullShape etc. It describes general convex shapes using the localGetSupportingVertex interface, used by collision detectors such as btGjkPairDetector.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btConvexInternalShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btConvexShape

The btConvexInternalShape is an internal base class, shared by most convex shape implementations. The btConvexInternalShape uses a default collision margin set to CONVEX_DISTANCE_MARGIN. This collision margin used by Gjk and some other algorithms, see also btCollisionMargin.h Note that when creating small shapes (derived from btConvexInternalShape), you need to make sure to set a smaller collision margin, using the ‘setMargin’ API There is a automatic mechanism ‘setSafeMargin’ used by btBoxShape and btCylinderShape

setImplicitShapeDimensions(dimensions)[source]

warning: use setImplicitShapeDimensions with care changing a collision shape while the body is in the world is not recommended, it is best to remove the body from the world, then make the change, and re-add it alternatively flush the contact points, see documentation for ‘cleanProxyFromPairs’

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btConvexInternalShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btConvexInternalAabbCachingShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

btConvexInternalAabbCachingShape adds local aabb caching for convex shapes, to avoid expensive bounding box calculations

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btConvex2dShape(convexChildShape)[source]

Bases: siconos.mechanics.collision.bullet.btConvexShape

The btConvex2dShape allows to use arbitrary convex shapes as 2d convex shapes, with the Z component assumed to be 0. For 2d boxes, the btBox2dShape is recommended.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btPolyhedralConvexShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.

initializePolyhedralFeatures(shiftVerticesByMargin=0)[source]

optional method mainly used to generate multiple contact points by clipping polyhedral features (faces/edges) experimental/work-in-progress

class siconos.mechanics.collision.bullet.btPolyhedralConvexAabbCachingShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexShape

The btPolyhedralConvexAabbCachingShape adds aabb caching to the btPolyhedralConvexShape

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btConvexHullShape(*args)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexAabbCachingShape

The btConvexHullShape implements an implicit convex hull of an array of vertices. Bullet provides a general and fast collision detector for convex shapes based on GJK and EPA using localGetSupportingVertex.

this constructor optionally takes in a pointer to points. Each point is assumed to be 3 consecutive btScalar (x,y,z), the striding defines the number of bytes between each point, in memory. It is easier to not pass any points in the constructor, and just add one point at a time, using addPoint. btConvexHullShape make an internal copy of the points.

getPoints()[source]

getPoints is obsolete, please use getUnscaledPoints

setLocalScaling(scaling)[source]

in case we receive negative scaling

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btConvexHullShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btConvexPointCloudShape(*args)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexAabbCachingShape

The btConvexPointCloudShape implements an implicit convex hull of an array of vertices.

setLocalScaling(scaling)[source]

in case we receive negative scaling

siconos.mechanics.collision.bullet.TEST_INTERNAL_OBJECTS = 1

This file was written by Erwin Coumans

class siconos.mechanics.collision.bullet.btConvexTriangleMeshShape(meshInterface, calcAabb=True)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexAabbCachingShape

The btConvexTriangleMeshShape is a convex hull of a triangle mesh, but the performance is not as good as btConvexHullShape. A small benefit of this class is that it uses the btStridingMeshInterface, so you can avoid the duplication of the triangle mesh data. Nevertheless, most users should use the much better performing btConvexHullShape instead.

calculatePrincipalAxisTransform(principal, inertia, volume)[source]

computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia and the center of mass to the current coordinate system. A mass of 1 is assumed, for other masses just multiply the computed “inertia” by the mass. The resulting transform “principal” has to be applied inversely to the mesh in order for the local coordinate system of the shape to be centered at the center of mass and to coincide with the principal axes. This also necessitates a correction of the world transform of the collision object by the principal transform. This method also computes the volume of the convex mesh.

class siconos.mechanics.collision.bullet.btConcaveShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btCollisionShape

The btConcaveShape class provides an interface for non-moving (static) concave shapes. It has been implemented by the btStaticPlaneShape, btBvhTriangleMeshShape and btHeightfieldTerrainShape.

class siconos.mechanics.collision.bullet.btEmptyShape[source]

Bases: siconos.mechanics.collision.bullet.btConcaveShape

The btEmptyShape is a collision shape without actual collision detection shape, so most users should ignore this class. It can be replaced by another shape during runtime, but the inertia tensor should be recomputed.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btCompoundShape(enableDynamicAabbTree=True, initialChildCapacity=0)[source]

Bases: siconos.mechanics.collision.bullet.btCollisionShape

The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave collision objects. This is more general then the static concave btBvhTriangleMeshShape. It has an (optional) dynamic aabb tree to accelerate early rejection tests. TODO: : This aabb tree can also be use to speed up ray tests on btCompoundShape, see http://code.google.com/p/bullet/issues/detail?id=25 Currently, removal of child shapes is only supported when disabling the aabb tree (pass ‘false’ in the constructor of btCompoundShape)

removeChildShape(shape)[source]

Remove all children shapes that contain the specified shape

updateChildTransform(childIndex, newChildTransform, shouldRecalculateLocalAabb=True)[source]

set a new transform for a child, and update internal data structures (local aabb and dynamic tree)

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

recalculateLocalAabb()[source]

Re-calculate the local Aabb. Is called at the end of removeChildShapes. Use this yourself if you modify the children or their transforms.

calculatePrincipalAxisTransform(masses, principal, inertia)[source]

computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia and the center of mass to the current coordinate system. “masses” points to an array of masses of the children. The resulting transform “principal” has to be applied inversely to all children transforms in order for the local coordinate system of the compound shape to be centered at the center of mass and to coincide with the principal axes. This also necessitates a correction of the world transform of the collision object by the principal transform.

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btCompoundShapeChildData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btCompoundShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btTriangleShape(*args)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexShape

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btTriangleMesh(use32bitIndices=True, use4componentVertices=True)[source]

Bases: object

The btTriangleMesh class is a convenience class derived from btTriangleIndexVertexArray, that provides storage for a concave triangle mesh. It can be used as data for the btBvhTriangleMeshShape. It allows either 32bit or 16bit indices, and 4 (x-y-z-w) or 3 (x-y-z) component vertices. If you want to share triangle/index data between graphics mesh and collision mesh (btBvhTriangleMeshShape), you can directly use btTriangleIndexVertexArray or derive your own class from btStridingMeshInterface. Performance of btTriangleMesh and btTriangleIndexVertexArray used in a btBvhTriangleMeshShape is the same.

addTriangle(vertex0, vertex1, vertex2, removeDuplicateVertices=False)[source]

By default addTriangle won’t search for duplicate vertices, because the search is very slow for large triangle meshes. In general it is better to directly use btTriangleIndexVertexArray instead.

addTriangleIndices(index1, index2, index3)[source]

Add a triangle using its indices. Make sure the indices are pointing within the vertices array, so add the vertices first (and to be sure, avoid removal of duplicate vertices)

findOrAddVertex(vertex, removeDuplicateVertices)[source]

findOrAddVertex is an internal method, use addTriangle instead

addIndex(index)[source]

addIndex is an internal method, use addTriangle instead

class siconos.mechanics.collision.bullet.btTriangleMeshShape(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btConcaveShape

The btTriangleMeshShape is an internal concave triangle mesh interface. Don’t use this class directly, use btBvhTriangleMeshShape instead.

getAabb(t, aabbMin, aabbMax)[source]

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

class siconos.mechanics.collision.bullet.btBox2dShape(boxHalfExtents)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexShape

The btBox2dShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.

a btBox2dShape is a flat 2D box in the X-Y plane (Z extents are zero)

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btBoxShape(boxHalfExtents)[source]

Bases: siconos.mechanics.collision.bullet.btPolyhedralConvexShape

The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btCapsuleShape(radius, height)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned around the X axis and btCapsuleShapeZ around the Z axis. The total height is height+2*radius, so the height is just the height between the center of each ‘sphere’ of the capsule caps. The btCapsuleShape is a convex hull of two spheres. The btMultiSphereShape is a more general collision shape that takes the convex hull of multiple sphere, so it can also represent a capsule when just using two spheres.

calculateLocalInertia(mass, inertia)[source]

CollisionShape Interface

localGetSupportingVertexWithoutMargin(vec)[source]

btConvexShape Interface

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

getAnisotropicRollingFrictionDirection()[source]

the getAnisotropicRollingFrictionDirection can be used in combination with setAnisotropicFriction See Bullet/Demos/RollingFrictionDemo for an example

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btCapsuleShapeX(radius, height)[source]

Bases: siconos.mechanics.collision.bullet.btCapsuleShape

btCapsuleShapeX represents a capsule around the Z axis the total height is height+2*radius, so the height is just the height between the center of each ‘sphere’ of the capsule caps.

class siconos.mechanics.collision.bullet.btCapsuleShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btConeShape(radius, height)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

The btConeShape implements a cone shape primitive, centered around the origin and aligned with the Y axis. The btConeShapeX is aligned around the X axis and btConeShapeZ around the Z axis.

setConeUpIndex(upIndex)[source]

choose upAxis index

getAnisotropicRollingFrictionDirection()[source]

the getAnisotropicRollingFrictionDirection can be used in combination with setAnisotropicFriction See Bullet/Demos/RollingFrictionDemo for an example

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btConeShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btCylinderShape(halfExtents)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

The btCylinderShape class implements a cylinder shape primitive, centered around the origin. Its central axis aligned with the Y axis. btCylinderShapeX is aligned with the X axis and btCylinderShapeZ around the Z axis.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

getAnisotropicRollingFrictionDirection()[source]

the getAnisotropicRollingFrictionDirection can be used in combination with setAnisotropicFriction See Bullet/Demos/RollingFrictionDemo for an example

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btCylinderShapeX(halfExtents)[source]

Bases: siconos.mechanics.collision.bullet.btCylinderShape

class siconos.mechanics.collision.bullet.btCylinderShapeZ(halfExtents)[source]

Bases: siconos.mechanics.collision.bullet.btCylinderShape

class siconos.mechanics.collision.bullet.btCylinderShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btHeightfieldTerrainShape(*args)[source]

Bases: siconos.mechanics.collision.bullet.btConcaveShape

btHeightfieldTerrainShape simulates a 2D heightfield terrain

The caller is responsible for maintaining the heightfield array; this class does not make a copy.

The heightfield can be dynamic so long as the min/max height values capture the extremes (heights must always be in that range).

The local origin of the heightfield is assumed to be the exact center (as determined by width and length and height, with each axis multiplied by the localScaling).

NOTE: be careful with coordinates. If you have a heightfield with a local min height of -100m, and a max height of +500m, you may be tempted to place it at the origin (0,0) and expect the heights in world coordinates to be -100 to +500 meters. Actually, the heights will be -300 to +300m, because bullet will re-center the heightfield based on its AABB (which is determined by the min/max heights). So keep in mind that once you create a btHeightfieldTerrainShape object, the heights will be adjusted relative to the center of the AABB. This is different to the behavior of many rendering engines, but is useful for physics engines.

Most (but not all) rendering and heightfield libraries assume upAxis = 1 (that is, the y-axis is “up”). This class allows any of the 3 coordinates to be “up”. Make sure your choice of axis is consistent with your rendering system.

The heightfield heights are determined from the data type used for the heightfieldData array.

  • PHY_UCHAR: height at a point is the uchar value at the

    grid point, multipled by heightScale. uchar isn’t recommended because of its inability to deal with negative values, and low resolution (8-bit).

  • PHY_SHORT: height at a point is the short int value at that grid

    point, multipled by heightScale.

  • PHY_FLOAT: height at a point is the float value at that grid

    point. heightScale is ignored when using the float heightfield data type.

Whatever the caller specifies as minHeight and maxHeight will be honored. The class will not inspect the heightfield to discover the actual minimum or maximum heights. These values are used to determine the heightfield’s axis-aligned bounding box, multiplied by localScaling.

For usage and testing see the TerrainDemo.

Overload 1:
preferred constructor

This constructor supports a range of heightfield data types, and allows for a non-zero minimum height value. heightScale is needed for any integer-based heightfield data types.


Overload 2:
legacy constructor

The legacy constructor assumes the heightfield has a minimum height of zero. Only unsigned char or floats are supported. For legacy compatibility reasons, heightScale is calculated as maxHeight / 65535 (and is only used when useFloatData = false).

setUseZigzagSubdivision(useZigzagSubdivision=True)[source]

could help compatibility with Ogre heightfields. See https://code.google.com/p/bullet/issues/detail?id=625

getAabb(t, aabbMin, aabbMax)[source]

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

class siconos.mechanics.collision.bullet.btMaterial(*args)[source]

Bases: object

This file was created by Alex Silverman

class siconos.mechanics.collision.bullet.btMinkowskiSumShape(shapeA, shapeB)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

The btMinkowskiSumShape is only for advanced users. This shape represents implicit based minkowski sum of two convex implicit shapes.

class siconos.mechanics.collision.bullet.btSphereShape(radius)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalShape

The btSphereShape implements an implicit sphere, centered around a local origin with radius.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btMultiSphereShape(positions, radi, numSpheres)[source]

Bases: siconos.mechanics.collision.bullet.btConvexInternalAabbCachingShape

The btMultiSphereShape represents the convex hull of a collection of spheres. You can create special capsules or other smooth volumes. It is possible to animate the spheres for deformation, but call ‘recalcLocalAabb’ after changing any sphere position/radius

calculateLocalInertia(mass, inertia)[source]

CollisionShape Interface

localGetSupportingVertexWithoutMargin(vec)[source]

btConvexShape Interface

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btMultimaterialTriangleMeshShape(*args)[source]

Bases: object

This file was created by Alex Silverman

The BvhTriangleMaterialMeshShape extends the btBvhTriangleMeshShape. Its main contribution is the interface into a material array, which allows per-triangle friction and restitution.

Overload 1: optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb


Overload 2: optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb

getMaterialProperties(partID, triIndex)[source]

Obtains the material for a specific triangle

class siconos.mechanics.collision.bullet.btOptimizedBvh[source]

Bases: object

The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.

serializeInPlace(o_alignedDataBuffer, i_dataBufferSize, i_swapEndian)[source]

Data buffer MUST be 16 byte aligned

static deSerializeInPlace(i_alignedDataBuffer, i_dataBufferSize, i_swapEndian)[source]

deSerializeInPlace loads and initializes a BVH from a buffer in memory ‘in place’

siconos.mechanics.collision.bullet.btOptimizedBvh_deSerializeInPlace(i_alignedDataBuffer, i_dataBufferSize, i_swapEndian)[source]

deSerializeInPlace loads and initializes a BVH from a buffer in memory ‘in place’

class siconos.mechanics.collision.bullet.btScaledBvhTriangleMeshShape(childShape, localScaling)[source]

Bases: siconos.mechanics.collision.bullet.btConcaveShape

The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMeshShape. Note that each btBvhTriangleMeshShape still can have its own local scaling, independent from this btScaledBvhTriangleMeshShape ‘localScaling’

getAabb(t, aabbMin, aabbMax)[source]

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btScaledTriangleMeshShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btShapeHull(shape)[source]

Bases: object

btShapeHull implemented by John McCutchan. The btShapeHull class takes a btConvexShape, builds a simplified convex hull using btConvexHull and provides triangle indices and vertices. It can be useful for to simplify a complex convex object and for visualization of a non-polyhedral convex object. It approximates the convex hull using the supporting vertex of 42 directions.

class siconos.mechanics.collision.bullet.btStaticPlaneShape(planeNormal, planeConstant)[source]

Bases: siconos.mechanics.collision.bullet.btConcaveShape

The btStaticPlaneShape simulates an infinite non-moving (static) collision plane.

getAabb(t, aabbMin, aabbMax)[source]

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btStaticPlaneShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btStridingMeshInterface(*args, **kwargs)[source]

Bases: object

The btStridingMeshInterface is the interface class for high performance generic access to triangle meshes, used in combination with btBvhTriangleMeshShape and some other collision shapes. Using index striding of 3*sizeof(integer) it can use triangle arrays, using index striding of 1*sizeof(integer) it can handle triangle strips. It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory.

calculateAabbBruteForce(aabbMin, aabbMax)[source]

brute force method to calculate aabb

getLockedVertexIndexBase(vertexbase, numverts, type, stride, indexbase, indexstride, numfaces, indicestype, subpart=0)[source]

get read and write access to a subpart of a triangle mesh this subpart has a continuous array of vertices and indices in this way the mesh can be handled as chunks of memory with striding very similar to OpenGL vertexarray support make a call to unLockVertexBase when the read and write access is finished

unLockVertexBase(subpart)[source]

unLockVertexBase finishes the access to a subpart of the triangle mesh make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished

getNumSubParts()[source]

getNumSubParts returns the number of separate subparts each subpart has a continuous array of vertices and indices

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btMeshPartData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btStridingMeshInterfaceData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.btTriangleBuffer[source]

Bases: object

The btTriangleBuffer callback can be useful to collect and store overlapping triangles between AABB and concave objects that support ‘processAllTriangles’ Example usage of this class:

btTriangleBuffer triBuf; concaveShape->processAllTriangles(&triBuf,aabbMin, aabbMax); for (int i=0;i<triBuf.getNumTriangles();i++) {

const btTriangle& tri = triBuf.getTriangle(i);

do something useful here with the triangle

}

class siconos.mechanics.collision.bullet.btTriangleCallback(*args, **kwargs)[source]

Bases: object

The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTriangles. This callback is called by processAllTriangles for all btConcaveShape derived class, such as btBvhTriangleMeshShape, btStaticPlaneShape and btHeightfieldTerrainShape.

class siconos.mechanics.collision.bullet.btIndexedMesh[source]

Bases: object

The btIndexedMesh indexes a single vertex and index array. Multiple btIndexedMesh objects can be passed into a btTriangleIndexVertexArray using addIndexedMesh. Instead of the number of indices, we pass the number of triangles.

class siconos.mechanics.collision.bullet.btTriangleIndexVertexArray(*args)[source]

Bases: siconos.mechanics.collision.bullet.btStridingMeshInterface

The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing triangle/index arrays. Additional meshes can be added using addIndexedMesh No duplicate is made of the vertex/index data, it only indexes into external vertex/index arrays. So keep those arrays around during the lifetime of this btTriangleIndexVertexArray.

getLockedVertexIndexBase(vertexbase, numverts, type, vertexStride, indexbase, indexstride, numfaces, indicestype, subpart=0)[source]

get read and write access to a subpart of a triangle mesh this subpart has a continuous array of vertices and indices in this way the mesh can be handled as chunks of memory with striding very similar to OpenGL vertexarray support make a call to unLockVertexBase when the read and write access is finished

unLockVertexBase(subpart)[source]

unLockVertexBase finishes the access to a subpart of the triangle mesh make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished

getNumSubParts()[source]

getNumSubParts returns the number of separate subparts each subpart has a continuous array of vertices and indices

class siconos.mechanics.collision.bullet.btMaterialProperties[source]

Bases: object

This file was created by Alex Silverman

property m_numMaterials

m_materialBase ==========> 2 btScalar values make up one material, friction then restitution

property m_numTriangles
m_numTriangles <=========== This exists in the btIndexedMesh object for the same subpart, but since we’re

padding the structure, it can be reproduced at no real cost

m_triangleMaterials =====> 1 integer value makes up one entry

eg: m_triangleMaterials[1] = 5; // This will set triangle 2 to use material 5

property m_triangleType

m_triangleType <========== Automatically set in addMaterialProperties

class siconos.mechanics.collision.bullet.btTriangleIndexVertexMaterialArray(*args)[source]

Bases: siconos.mechanics.collision.bullet.btTriangleIndexVertexArray

Teh btTriangleIndexVertexMaterialArray is built on TriangleIndexVertexArray The addition of a material array allows for the utilization of the partID and triangleIndex that are returned in the ContactAddedCallback. As with TriangleIndexVertexArray, no duplicate is made of the material data, so it is the users responsibility to maintain the array during the lifetime of the TriangleIndexVertexMaterialArray.

siconos.mechanics.collision.bullet.TRI_INFO_V0V1_CONVEX = 1

for btTriangleInfo m_flags

class siconos.mechanics.collision.bullet.btTriangleInfo[source]

Bases: object

The btTriangleInfo structure stores information to adjust collision normals to avoid collisions against internal edges it can be generated using

class siconos.mechanics.collision.bullet.btTriangleInfoMap[source]

Bases: object

The btTriangleInfoMap stores edge angle information for some triangles. You can compute this information yourself or using btGenerateInternalEdgeInfo.

used to determine if a triangle is degenerate (length squared of cross product of 2 triangle edges < threshold)

property m_planarEpsilon

used to determine if an edge or contact normal is convex, using the dot product

property m_equalVertexThreshold

used to determine if a triangle edge is planar with zero angle

property m_edgeDistanceThreshold

if the distance between two vertices is smaller than m_equalVertexThreshold, they are considered to be ‘shared’

Type

used to compute connectivity

property m_maxEdgeAngleThreshold

if the closest distance between a contact point and an edge is smaller than this distance threshold it is considered to “hit the edge”

Type

used to determine edge contacts

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btTriangleInfoData[source]

Bases: object

those fields have to be float and not btScalar for the serialization to work properly

class siconos.mechanics.collision.bullet.btUniformScalingShape(convexChildShape, uniformScalingFactor)[source]

Bases: siconos.mechanics.collision.bullet.btConvexShape

The btUniformScalingShape allows to re-use uniform scaled instances of btConvexShape in a memory efficient way. Istead of using btUniformScalingShape, it is better to use the non-uniform setLocalScaling method on convex shapes that implement it.

getAabb(t, aabbMin, aabbMax)[source]

getAabb’s default implementation is brute force, expected derived classes to implement a fast dedicated version

class siconos.mechanics.collision.bullet.btTetrahedronShapeEx[source]

Bases: object

Helper class for tetrahedrons

class siconos.mechanics.collision.bullet.btGImpactShapeInterface(*args, **kwargs)[source]

Bases: siconos.mechanics.collision.bullet.btConcaveShape

Base class for gimpact shapes

updateBound()[source]

performs refit operation Updates the entire Box set of this shape.

getAabb(t, aabbMin, aabbMax)[source]

If the Bounding box is not updated, then this class attemps to calculate it.

postUpdate()[source]

Tells to this object that is needed to refit the box set

getLocalBox()[source]

Obtains the local box, which is the global calculated box of the total of subshapes

getGImpactShapeType()[source]

Subshape member functionsBase method for determinig which kind of GIMPACT shape we get

getBoxSet()[source]

gets boxset

hasBoxSet()[source]

Determines if this class has a hierarchy structure for sorting its primitives

getPrimitiveManager()[source]

Obtains the primitive manager

getNumChildShapes()[source]

Gets the number of children

childrenHasTransform()[source]

if true, then its children must get transforms.

needsRetrieveTriangles()[source]

Determines if this shape has triangles

needsRetrieveTetrahedrons()[source]

Determines if this shape has tetrahedrons

lockChildShapes()[source]

call when reading child shapes

getPrimitiveTriangle(index, triangle)[source]

if this trimesh

getChildAabb(child_index, t, aabbMin, aabbMax)[source]

Retrieves the bound from a child

getChildShape(*args)[source]

Overload 1: Gets the children


Overload 2: Gets the child

getChildTransform(index)[source]

Gets the children transform

setChildTransform(index, transform)[source]

Sets the children transform

rayTest(rayFrom, rayTo, resultCallback)[source]

virtual method for ray collision

processAllTriangles(callback, aabbMin, aabbMax)[source]

Function for retrieve triangles. It gives the triangles in local space

processAllTrianglesRay(arg2, arg3, arg4)[source]

Function for retrieve triangles. It gives the triangles in local space

class siconos.mechanics.collision.bullet.btGImpactCompoundShape(children_has_transform=True)[source]

Bases: siconos.mechanics.collision.bullet.btGImpactShapeInterface

btGImpactCompoundShape allows to handle multiple btCollisionShape objects at once

This class only can manage Convex subshapes

childrenHasTransform()[source]

if true, then its children must get transforms.

getPrimitiveManager()[source]

Obtains the primitive manager

getCompoundPrimitiveManager()[source]

Obtains the compopund primitive manager

getNumChildShapes()[source]

Gets the number of children

addChildShape(*args)[source]

Overload 1: Use this method for adding children. Only Convex shapes are allowed.


Overload 2: Use this method for adding children. Only Convex shapes are allowed.

getChildShape(*args)[source]

Overload 1: Gets the children


Overload 2: Gets the children

getChildAabb(child_index, t, aabbMin, aabbMax)[source]

Retrieves the bound from a child

getChildTransform(index)[source]

Gets the children transform

setChildTransform(index, transform)[source]

Sets the children transform

needsRetrieveTriangles()[source]

Determines if this shape has triangles

needsRetrieveTetrahedrons()[source]

Determines if this shape has tetrahedrons

calculateLocalInertia(mass, inertia)[source]

Calculates the exact inertia tensor for this shape

getGImpactShapeType()[source]

Subshape member functionsBase method for determinig which kind of GIMPACT shape we get

class siconos.mechanics.collision.bullet.btGImpactMeshShapePart(*args)[source]

Bases: siconos.mechanics.collision.bullet.btGImpactShapeInterface

This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.

  • Simply create this shape by passing the btStridingMeshInterface to the constructor btGImpactMeshShapePart, then you must call updateBound() after creating the mesh

  • When making operations with this shape, you must call lock before accessing to the trimesh primitives, and then call unlock

  • You can handle deformable meshes with this shape, by calling postUpdate() every time when changing the mesh vertices.

childrenHasTransform()[source]

if true, then its children must get transforms.

lockChildShapes()[source]

call when reading child shapes

getNumChildShapes()[source]

Gets the number of children

getChildShape(*args)[source]

Overload 1: Gets the children


Overload 2: Gets the child

getChildTransform(index)[source]

Gets the children transform

setChildTransform(index, transform)[source]

Sets the children transform

getPrimitiveManager()[source]

Obtains the primitive manager

getGImpactShapeType()[source]

Subshape member functionsBase method for determinig which kind of GIMPACT shape we get

needsRetrieveTriangles()[source]

Determines if this shape has triangles

needsRetrieveTetrahedrons()[source]

Determines if this shape has tetrahedrons

processAllTriangles(callback, aabbMin, aabbMax)[source]

Function for retrieve triangles. It gives the triangles in local space

processAllTrianglesRay(callback, rayFrom, rayTo)[source]

Function for retrieve triangles. It gives the triangles in local space

class siconos.mechanics.collision.bullet.btGImpactMeshShape(meshInterface)[source]

Bases: siconos.mechanics.collision.bullet.btGImpactShapeInterface

This class manages a mesh supplied by the btStridingMeshInterface interface.

Set of btGImpactMeshShapePart parts - Simply create this shape by passing the btStridingMeshInterface to the constructor btGImpactMeshShape, then you must call updateBound() after creating the mesh

  • You can handle deformable meshes with this shape, by calling postUpdate() every time when changing the mesh vertices.

postUpdate()[source]

Tells to this object that is needed to refit all the meshes

getPrimitiveManager()[source]

Obtains the primitive manager

getNumChildShapes()[source]

Gets the number of children

childrenHasTransform()[source]

if true, then its children must get transforms.

needsRetrieveTriangles()[source]

Determines if this shape has triangles

needsRetrieveTetrahedrons()[source]

Determines if this shape has tetrahedrons

lockChildShapes()[source]

call when reading child shapes

getChildAabb(child_index, t, aabbMin, aabbMax)[source]

Retrieves the bound from a child

getChildShape(*args)[source]

Overload 1: Gets the children


Overload 2: Gets the child

getChildTransform(index)[source]

Gets the children transform

setChildTransform(index, transform)[source]

Sets the children transform

getGImpactShapeType()[source]

Subshape member functionsBase method for determinig which kind of GIMPACT shape we get

rayTest(rayFrom, rayTo, resultCallback)[source]

virtual method for ray collision

processAllTriangles(callback, aabbMin, aabbMax)[source]

Function for retrieve triangles. It gives the triangles in local space

processAllTrianglesRay(callback, rayFrom, rayTo)[source]

Function for retrieve triangles. It gives the triangles in local space

serialize(dataBuffer, serializer)[source]

fills the dataBuffer and returns the struct name (and 0 on failure)

class siconos.mechanics.collision.bullet.btGImpactMeshShapeData[source]

Bases: object

do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64

class siconos.mechanics.collision.bullet.BulletR[source]

Bases: siconos.mechanics.collision.bullet.ContactR

constructor

display()[source]

main relation members display

class siconos.mechanics.collision.bullet.Bullet1DR(arg2)[source]

Bases: siconos.kernel.NewtonEuler1DR

constructor

computeh(time, q, y)[source]

to compute the output y = h(t,q,z) of the Relation

Parameters
  • time (float) – current time value

  • q (BlockVector) – coordinates of the dynamical systems involved in the relation

  • y (SiconosVector) – the resulting vector

class siconos.mechanics.collision.bullet.Bullet5DR[source]

Bases: siconos.mechanics.collision.bullet.Contact5DR

constructor