Skip to content

Commit f34551a

Browse files
committed
Use clip
1 parent 5c1af4d commit f34551a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/track_linearization/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def project_points_to_segment(
7171
/ sum_squares
7272
)
7373

74-
nx_param[np.where(nx_param < 0)] = 0.0
75-
nx_param[np.where(nx_param > 1)] = 1.0
74+
np.clip(nx_param, 0.0, 1.0, out=nx_param)
75+
7676
return node1[np.newaxis, ...] + (
7777
nx_param[:, :, np.newaxis] * segment_diff[np.newaxis, ...]
7878
)

0 commit comments

Comments
 (0)