uxarray.grid.integrate._process_overlapped_intervals

uxarray.grid.integrate._process_overlapped_intervals#

uxarray.grid.integrate._process_overlapped_intervals(intervals_df)#

Process the overlapped intervals using the sweep line algorithm, considering multiple intervals per face.

Parameters:

intervals_df (pd.DataFrame) – The DataFrame that contains the intervals and the corresponding face index. The columns of the DataFrame are: [‘start’, ‘end’, ‘face_index’]

Returns:

  • dict – A dictionary where keys are face indices and values are their respective contributions to the total length.

  • float – The total length of all intervals considering their overlaps.

Example

>>> intervals_data = [
...     {'start': 0.0, 'end': 100.0, 'face_index': 0},
...     {'start': 50.0, 'end': 150.0, 'face_index': 1},
...     {'start': 140.0, 'end': 150.0, 'face_index': 2}
... ]
>>> intervals_df = pd.DataFrame(intervals_data)
>>> overlap_contributions, total_length = _process_overlapped_intervals(intervals_df)
>>> print(overlap_contributions)
>>> print(total_length)