Polygon Downsampling

tomni.polygon_downsampling.iterative_downsampling(points: list, n_iter: int) list[source]

Compress a list of 2D points by reducing the number of points by half iteratively.

Parameters
  • points (list) – A list of 2D points, where each point is represented as a dictionary with {“x”: 1, “y”: 0}.

  • n_iter (int) – An integer representing the number of times to apply the recursive compression method.

Returns

A list of 2D points, where each point is represented as a dictionary with {“x”: 1, “y”: 0}.

The number of points in the output list is half the number of points in the input list, repeated n_iter times.

Return type

list