From 6d4c77984a25d80e9c4061860416fd75804a476f Mon Sep 17 00:00:00 2001 From: Luke Parry Date: Mon, 19 Apr 2021 22:50:43 +0100 Subject: [PATCH] Added a Flip Sort Class Class flips the direction of all hatch vectors. --- pyslm/hatching/sorting.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pyslm/hatching/sorting.py b/pyslm/hatching/sorting.py index 941e5e1..2d76e47 100644 --- a/pyslm/hatching/sorting.py +++ b/pyslm/hatching/sorting.py @@ -38,6 +38,23 @@ def sort(self, scanVectors: np.ndarray) -> np.ndarray: """ This approach simply flips the odd pair of hatches""" +class FlipSort(BaseSort): + """ + Sort method flips all pairs of scan vectors so that their direction alternates across the input + """ + def __init__(self): + super().__init__() + + def __str__(self): + return 'Alternating Hatch Sort' + + def sort(self, scanVectors: np.ndarray) -> np.ndarray: + """ This approach simply flips the odd pair of hatches""" + sv = to3DHatchArray(scanVectors) + sv = np.flip(sv, 1) + return from3DHatchArray(sv) + + class AlternateSort(BaseSort): """ Sort method flips pairs of scan vectors so that their direction alternates across adjacent vectors.