process_lines#

ifermi.slice.process_lines(segments, face_idxs)[source]#

Process segments and face_idxs from mesh_multiplane.

The key issue is that the segments from mesh_multiplane do not correspond to individual lines, nor are they sorted in a continuous order. Instead they are just a list of randomly ordered segments. This causes trouble later on when trying to interpolate the lines or add equally spaced arrows.

The goal of this function is to identify the separate paths in the segments (a path is a collection of segments that are connected together), and return these segments in the order that they are connected. By looping through each segment, you will be proceeding along the line in a certain direction.

Because the original segments may contain multiple paths, a list of segments and their corresponding face indices are returned.

Lastly, note that there is no guarantee that all of the original segments will be used in the processed segments. This is because some of the original segments are very small and will be filtered out.

Parameters:
  • segments (ndarray) – A (n, 2, 2) float array of the line segments.

  • face_idxs (ndarray) – The face indices that each segment belongs to.

Return type:

list[tuple[ndarray, ndarray]]

Returns:

A list of (segments, faces) for each path.