pycollision.objects

This is the base module which hold all base objects and implementations.

class pycollision.objects.BasicObject(verbose=False)

Bases: pycollision.position.Position, pycollision.collision.Collision

This is a combined object for 3D objects, containing the position and the collision routines.

Parameters

verbose (bool, optional) – make the object verbose, default is False

class pycollision.objects.Box(x1: typevalidation.types.Vector, x2: typevalidation.types.Vector, verbose: bool = False)

Bases: pycollision.objects.BasicObject

This is the implementation of a Box Object.

Parameters
  • x1 (Vector) – the lower front left corner of the box

  • x2 (Vector) – the upper back right corner of the box

  • verbose (bool, optional) – make the object verbose, default=False

Raises
  • TypeError – if the input types are not compatible

  • ValueError – if the input values fit not into the contraints, e.g. PosFloat with Floats <= 0.

Examples

s = Box([0., 0., 0.,], [1., 1., 1.]) # creates a box starting at
                                  # position [0.,0.,0.] with
                                  # length = width = height = 1.
class pycollision.objects.Plane(n: typevalidation.types.Vector, d: float, verbose: bool = False)

Bases: pycollision.objects.BasicObject

This is the implementation of a Plane Object.

class pycollision.objects.Sphere(x: typevalidation.types.Vector, radius: typevalidation.types.PosFloat, verbose: bool = False)

Bases: pycollision.objects.BasicObject

This is the implementation of a Sphere Object.

Parameters
  • x (Vector) – the center position of the sphere

  • radius (PosFloat) – a positive float for the radius

  • verbose (bool, optional) – make the object verbose, default=False

Raises
  • TypeError – if the input types are not compatible

  • ValueError – if the input values fit not into the contraints, e.g. PosFloat with Floats <= 0.

Examples

s = Sphere([1., 1., 1.,], 2.) # creates a Sphere at the
                              # position [1.,1.,1.] with
                              # a radius of 2.
position

returns the center position of the sphere, after applying all positional transformations

Returns

the 3D vector of the sphere center

Return type

Vector

radius

returns the radius of the sphere

Returns

the radius of the sphere

Return type

float