Box2D Class¶

class plask.geometry.Box2D(lower, upper)
class plask.geometry.Box2D(left, bottom, right, top)
class plask.geometry.Box2D

Rectangular two-dimensional box.

This class holds a rectangular box with its sides along the axes. It provides some basic geometric operations and is used mainly to represent 2D geometry bounding boxes.

Parameters: lower (plask.vec) – Lower left corner of the box. upper (plask.ver) – Upper right corner of the box. left (float) – Left edge of the box. bottom (float) – Bottom edge of the box. right (float) – Right edge of the box. top (float) – Top edge of the box.

Methods¶

 contains(point) Check if the point is inside the box. extension(other) Get the minimal box which include both this and other box. intersection(other) Get the biggest box which is included in both this and the other box. intersects(other) Check if this and the other box have common points. translated(trans) Get translated copy of this box.

Attributes¶

 bottom Bottom edge of the box. center Center of the box. height Height of the box. left Left edge of the box. lower Lower left corner of the box. right Right edge of the box. size Size of the box. top Top edge of the box. upper Upper right corner of the box. width Width of the box.

Descriptions¶

Method Details¶

Box2D.contains(point)

Check if the point is inside the box.

Parameters: point (plask.vec) – Point to test.
Box2D.extension(other)

Get the minimal box which include both this and other box.

Box2D.intersection(other)

Get the biggest box which is included in both this and the other box.

Parameters: other (plask.geometry.Box2D) – Box to make intersection with.
Box2D.intersects(other)

Check if this and the other box have common points.

Parameters: other (plask.geometry.Box2D) – Box to check common points with.
Box2D.translated(trans)

Get translated copy of this box.

Parameters: trans (plask.vec) – Translation vector.

Attribute Details¶

Box2D.bottom

Bottom edge of the box.

Box2D.center

Center of the box.

Box2D.height

Height of the box.

Box2D.left

Left edge of the box.

Box2D.lower

Lower left corner of the box.

Box2D.right

Right edge of the box.

Box2D.size

Size of the box.

Box2D.top

Top edge of the box.

Box2D.upper

Upper right corner of the box.

Box2D.width

Width of the box.