Graph

class spherical_geometry.graph.Graph(polygons)[source]

Bases: object

A graph of nodes connected by edges. The graph is used to build unions between polygons.

Note

This class is not meant to be used directly. Instead, use union and intersection.

Parameters:
polygonssequence of SphericalPolygon instances

Build a graph from this initial set of polygons.

Methods Summary

add_polygon(polygon)

Add a single polygon to the graph.

add_polygons(polygons)

Add more polygons to the graph.

disjoint_polygons()

Convert a graph containing cut lines and self intersections into a list of disjoint polygons

intersection()

Once all of the polygons have been added to the graph, calculate the intersection.

union()

Once all of the polygons have been added to the graph, join the polygons together.

Methods Documentation

add_polygon(polygon)[source]

Add a single polygon to the graph.

Note

Must be called before union or intersection.

Parameters:
polygonSphericalPolygon instance

Polygon to add to the graph

add_polygons(polygons)[source]

Add more polygons to the graph.

Note

Must be called before union or intersection.

Parameters:
polygonssequence of SphericalPolygon instances

Set of polygons to add to the graph

disjoint_polygons()[source]

Convert a graph containing cut lines and self intersections into a list of disjoint polygons

intersection()[source]

Once all of the polygons have been added to the graph, calculate the intersection.

Returns:
pointsNx3 array of (x, y, z) points

This is a list of points outlining the intersection of the polygons that were given to the constructor.

union()[source]

Once all of the polygons have been added to the graph, join the polygons together.

Returns:
pointsNx3 array of (x, y, z) points

This is a list of points outlining the union of the polygons that were given to the constructor.