Skip to content

cycle_boundary

CycleBoundary

Bases: BoundaryParameterization

Using the boundaries calculated by BoundaryFilter, this class calculates for each cycle around which of the boundaries it is going.

compute()

Compute the boundaries for each cycle. Labels have values 0 to len(boundaries).

Returns:

Type Description
ndarray[int]

np.ndarray[int]: labels for each boundary

fit_plane(bnd)

For each cycle, project it to the best fitting 2D plane of the boundary.

Parameters:

Name Type Description Default
bnd Boundary

The boundary to be projected.

required

Returns:

Type Description
tuple

pd.series: the projected coordinates for each cycle.

tuple

np.ndarray: the centroid of the projected boundary.

runs_around_hole(point, vertices) staticmethod

Function to find if a 2D point is enclosed by a loop. It does this by first converting the 2D space into a complex plane. The x coordinates become the real parts and the y coordinates the imaginary parts. It then uses the residue theorem with the point as a pole. This will yield either 0 or 2pii. If it is 0, the point does not lie within the loop. residue > 6 is returned to account for rounding errors.

Parameters:

Name Type Description Default
point tuple[float, float]

2D point for which to test if the loop runs around it.

required
vertices tuple[float, float]

2D vertex coordinates of the loop.

required

Returns:

Name Type Description
bool bool

True if the point lies within the loop.