return_difference_of_shapes#

return_difference_of_shapes(domain, shape_A, shape_B)#

Compute the difference between two shapes within a given domain.

Parameters:
domainobject

A muspan domain object containing the shapes to be compared.

shape_Aint

The ID of the first shape within the domain. The shape must be of type ‘shape’.

shape_Bint

The ID of the second shape within the domain. The shape must be of type ‘shape’.

Returns:
list

A list of dictionaries, each representing a region of interest (ROI) resulting from the difference operation. Each dictionary contains keys for ‘global_visited_indices_exterior’, ‘global_visited_indices_interior’, ‘intersection_points’, and ‘interior boundary’.

Raises:
ValueError

If shape_A or shape_B is not recognized as a valid shape ID within the domain, or if the object type is not ‘shape’.

Notes

The function decomposes each shape into its exterior and interior polygons, computes the difference between the exterior polygons, and adjusts for any interior holes. The result can be multiple disconnected shapes.