pyrobosim.utils.polygon

Polygon representation and maniupulation utilities.

These tools rely heavily on the Shapely package.

Functions

add_coords(coords, offset)

Adds an offset (x,y) vector to a Shapely compatible list of coordinate tuples.

box_to_coords(dims[, origin, ang])

Converts box dimensions and origin to a Shapely compatible list of coordinate tuples.

convhull_to_rectangle(points)

Find the smallest bounding rectangle for a set of points.

get_polygon_centroid(poly)

Gets a Shapely polygon centroid as a list.

inflate_polygon(poly, radius)

Inflates a Shapely polygon with options preconfigured for this world modeling framework.

polygon_and_height_from_footprint(footprint)

Returns a Shapely polygon and vertical (Z) height given footprint metadata.

polygon_and_height_from_mesh(mesh_data)

Returns the 2D footprint and the max height from a mesh NOTE: Right now this supports only DAE files, which is a commonly used format for Gazebo models.

sample_from_polygon(polygon[, max_tries])

Samples a valid (x, y) tuple that is inside a Shapely polygon.

transform_polygon(polygon, pose)

Transforms a Shapely polygon by a Pose object.