Removes redundant variables and duplicated logic. Some expressions simplified. Refactored to make use of `OffsetIndices`. For example, `Span<IndexRange> curve_interval_ranges` is rewritten into `OffsetIndices<int> intervals_by_curve`. Pull Request: https://projects.blender.org/blender/blender/pulls/130229