Skip to content

cycle_winding_number

CycleWindingNumber

Bases: BoundaryParameterization

Calculates the winding number of a cycle around a boundary. The winding number determines if a cycle loops around a point. If this is the case, the winding number is 2π, otherwise it's 0.

calculate_winding_number(vertices, point)

Calculates the winding number of a cycle around a point. The winding number is 2π if the cycle loops around the boundary and 0 outherwise

Parameters:

Name Type Description Default
vertices ndarray

2D coordinates of all vertices in the cycle.

required
point ndarray

2D coordinates of a point around which the winding number will be calculated.

required

Returns:

Name Type Description
float float

The winding number of the cycle.

compute()

Calculates the winding number of a cycle around a boundary. This number is within the interval [0, 2π]

For each boundary, a boundary different to itself is selected. Then, using this boundary's normal and centroid, the mesh is rotated such that its normal is along the z-axis. Next, the data is mapped (stretched out) onto a sphere. Finally, the data will be projected onto a plane.

This procedure prevents cycles looping around boundaries on differnt sides of the mesh to be detected as looping around both boundaries.

Returns:

Name Type Description
cycles DataFrame

Dataframe of cycles with an additional column 'winding number'.