From 1c44590defad850c4d577480e5bdd0189ee72a11 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Fri, 24 Jul 2026 10:40:52 +0200 Subject: [PATCH] Meshing: unsigned distance to be able to mesh reach with start_rk > end_rk --- src/Meshing/Internal.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Meshing/Internal.py b/src/Meshing/Internal.py index e597a339..48a84a94 100644 --- a/src/Meshing/Internal.py +++ b/src/Meshing/Internal.py @@ -57,6 +57,13 @@ class InternalMeshing(AMeshingTool): # we never modify original profiles, we work on the copies m_profiles = self.st_to_m(profiles, guide_list) + + # Adapt the spacing to the kilometre-point direction. The value from + # the dialog is a distance, so only its magnitude is significant. + step = self.signed_step( + step, m_profiles[0].rk, m_profiles[-1].rk + ) + new_profiles = self.interpolate_transversal_step(m_profiles, step) for new_profiles2 in new_profiles: @@ -65,6 +72,12 @@ class InternalMeshing(AMeshingTool): return new_profiles + @staticmethod + def signed_step(step, begin_rk, end_rk): + if end_rk < begin_rk: + return -abs(step) + return abs(step) + def st_to_m(self, profiles, guide_list): guide_list = ["un"] + guide_list + ["np"] max_values = [0] * (len(guide_list) - 1)