plcurve: Piecewise-Linear Curves (a.k.a. Polygons)

The PlCurve class

class libpl.plcurve.PlCurve

It’s a PlCurve.

Create a new PlCurve, optionally with empty components described by component_spec.

If it is not None, component_spec is a sequence of the form (int num_vertices, bool open, int num_colors).

add_component(component)

Add a component to this PlCurve.

center_of_mass

Center of mass.

fix_wrap()
gyradius

Gyradius of this PlCurve.

num_edges

Number of edges in this PlCurve.

num_vertices

Number of vertices in this PlCurve.

perturb

Randomly perturb this PlCurve

pointset_diameter

Diameter of the points

projection_to_PlanarDiagram(RandomGenerator rng) → new PlanarDiagram

Creates a new PlanarDiagram from a projection of this PlCurve.

random_closed_plane_polygon(int n_edges, RandomGenerator rng) → PlCurve

Create a random closed plane polygon.

random_closed_polygon(int n_edges, RandomGenerator rng) → PlCurve

Create a random closed polygon.

random_equilateral_closed_polygon(int n_edges, RandomGenerator rng) → PlCurve

Generate a random equilateral polygon using the CSU algorithm.

random_equilateral_open_polygon(int n_edges, RandomGenerator rng) → PlCurve

Create a random equilateral open polygon.

random_open_plane_polygon(int n_edges, RandomGenerator rng) → PlCurve

Create a random open plane polygon.

random_open_polygon(int n_edges, RandomGenerator rng) → PlCurve

Create a random open polygon.

Utility classes

class libpl.plcurve.RandomGenerator