maddux.objects package

Submodules

maddux.objects.ball module

A ball object to throw.

class maddux.objects.ball.Ball(position, radius, target=False)[source]

Bases: maddux.objects.throwable.ThrowableObject

plot(ax)[source]

Plots the ball at its current location.

Parameters:ax (matplotlib.axes) – Figure to plot on.
Returns:Matplotlib figure
Return type:matplotlib.axes

maddux.objects.dynamic module

An abstract base class for dynamic objects.

class maddux.objects.dynamic.DynamicObject(position, target=False)[source]

Bases: object

attach()[source]

Attach to an object (stop moving)

display()[source]

Display information

plot(ax)[source]

Plot the dynamic object at its current location

step()[source]

Step forward in time (one ms)

maddux.objects.obstacle module

A stationary rectangular solid that something may collide with

class maddux.objects.obstacle.Obstacle(pt1, pt2, color='r')[source]

Bases: maddux.objects.static.StaticObject

display()[source]

Display obstacle properties

Return type:None
get_paths()[source]

Returns the paths for each of the surfaces of the rectangle for plotting.

:returns (bottom, top, front, back, left, right) :rtype: list of 6 4x3 numpy.ndarrays

is_hit(position)[source]

Checks if the rectangle is hit by a point or path

Parameters:position (numpy.ndarray or numpy.matrix) – An objects position (x, y, z) or positions if it is a path([x1, x2, ..], [y1, y2, ..], [z1, z2, ..]
Returns:Whether the obstacle was hit by a point or path
Return type:bool
is_hit_by_sphere(center, radius)[source]

Checks if the rectangle is hit by a sphere

Parameters:
  • center (numpy.ndarray) – Sphere’s center (x, y, z)
  • radius (int) – The sphere’s radius
Returns:

Whether obstacle was hit by a sphere

Return type:

bool

plot(ax)[source]

Plots the obstacle at its location

Parameters:ax (matplotlib.axes) – Figure to plot on
Rtpye:None

maddux.objects.static module

An abstract base class for static objects.

class maddux.objects.static.StaticObject[source]

Bases: object

display()[source]

Display relevant data about static object.

is_hit(position)[source]

Tells whether another object hit the static object

plot(ax)[source]

Plot static object.

maddux.objects.target module

A stationary object that something may collide with.

class maddux.objects.target.Target(position, radius)[source]

Bases: maddux.objects.static.StaticObject

display()[source]

Display target properties :rtpye: None

is_hit(position)[source]

Check if the target is hit.

Parameters:position (numpy.array) – A object’s position
Return type:Boolean
plot(ax)[source]

Plots the target at its location. :param ax: Figure to plot on. :type ax: matplotlib figure :rtype: matplotlib figure

plot_data()[source]

Gets the plot data at the targets location :rtype: 3-tuple of integers

maddux.objects.throwable module

A base throwable object class that encodes traits like gravity, velocity, etc.

class maddux.objects.throwable.ThrowableObject(position, target=False)[source]

Bases: maddux.objects.dynamic.DynamicObject

attach()[source]

Attach an object to its current position

display()[source]

Display information about object

step()[source]

Update one timestep (one ms)

throw(velocity)[source]

Throw an object.

Parameters:velocity (np.ndarray) – Velocity to throw at (vx, vy, vz)
Return type:None

Module contents