Skip to content

Commit

Permalink
Added a Flip Sort Class
Browse files Browse the repository at this point in the history
Class flips the direction of all hatch vectors.
  • Loading branch information
drlukeparry committed Apr 19, 2021
1 parent 1026bba commit 6d4c779
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pyslm/hatching/sorting.py
Expand Up @@ -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.
Expand Down

0 comments on commit 6d4c779

Please sign in to comment.