geometry module

class geometry.Point(x, y)[source]

Bases: object

distance(point)[source]

Compute the Euclidean distance to another point.

class geometry.Rectangle(center, width, height)[source]

Bases: object

area()[source]

Computes the area of the rectangle.

bottom_right()[source]

Return the bottom right point of the rectangle.

contains(point)[source]

Check if the point is contained within the rectangle.

overlap(other)[source]

Check if two rectangles overlap by any margin.

overlap_area(other)[source]

Measure the area of the overlap between two rectangles.

top_left()[source]

Return the top left point of the rectangle.

update(center, width, height)[source]

Update the position of the rectangle.

geometry.distance(point_one, point_two)[source]

Compute the Euclidean distance between two points.

geometry.overlap_area(rectangle_one, rectangle_two)[source]

Compute the area of the overlap between two rectangles.