Skip to content

Commit

Permalink
Modify tolerance checking in column_track()
Browse files Browse the repository at this point in the history
  • Loading branch information
acroucher committed Apr 4, 2024
1 parent 61c6db3 commit d346f2f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mulgrids.py
Original file line number Diff line number Diff line change
Expand Up @@ -2003,12 +2003,10 @@ def column_track(self, line):
line.
"""

dl = max(norm(line[1] - line[0]), 1)
tol = 1e-3

def track_dist(p):
"""Non-dimensionalised distance of point along track"""
return norm(p - line[0]) / dl
def track_dist(p): return norm(p - line[0])
dl = track_dist(line[1])
tol_dl = tol * dl

track, dist = [], []
start_col, end_col = None, None
Expand All @@ -2034,7 +2032,7 @@ def track_dist(p):
elif col == end_col:
pts = [pts[0], line[-1]]
din, dout = track_dist(pts[0]), track_dist(pts[-1])
if abs(dout - din) > tol:
if abs(dout - din) > tol_dl:
track.append((col, pts[0], pts[-1]))
dist.append(din)

Expand Down

0 comments on commit d346f2f

Please sign in to comment.