polylidar.polylidarutil.plane_filtering.filter_planes

polylidar.polylidarutil.plane_filtering.filter_planes(polygons, points, config_pp, rm=None)

Converts polygons from Polylidar to Shapely polygons. This function performs post-processing of the Polygons returned by Polylidar3D using the Shapely library. If the polygons are 3D you must provide a scipy rotation matrix such that the polygon align with they XY plane (Shapely can only handle 2D polygons with XY coordinates).

The basic steps are:
  • Simplification of Polygon by config_pp[‘simplify]

  • Positive buffer of Polygon by config_pp[‘positive_buffer]

  • Negative Buffer of POlygons by config_pp[‘negative_buffer]

  • Simplification of Polygon by config_pp[‘simplify]

  • Remove polygons whose area is less or greater than data in config_pp[‘filter][‘plane_area’]

  • Remove holes whose vertices are less than data in config_pp[‘filter][‘hole_vertices’]

  • Remove holes whose area is less or greater than data in config_pp[‘filter][‘hole_area’]

It then returns the shapely polygons of the polygons and holes (obstacles)

An example config_pp

{
    positive_buffer: 0.005 # m, Positively expand polygon.  Fills in small holes
    negative_buffer: 0.03 # m, Negative buffer to polygon. Expands holes and constricts outer hull of polygon
    simplify: 0.02  # m, simplify edges of polygon
    filter: # obstacles must have these characteristics
        hole_area:
            min: 0.025   # m^2
            max: 0.785 # m^2
        hole_vertices:
            min: 6
        plane_area:
            min: .5 # m^2
}
Parameters
  • polylidar (polygons {list[Polygons]} -- A list of polygons returned from) –

  • array (points {ndarray} -- MX3) –

  • filtering (config_pp {dict} -- Configuration for post processing) –

  • 2D (rm {scipy.spatial.RotationMatrix} -- Rotation matrix applied to 3D polygons to make) –

Returns

List – A list of planar shapely polygons