I also noticed that your definition of the “clip” function was fairly inefficient. If you use the built-in “truncate” function instead, time is shaved to 15 seconds in the latest version.
Happy to report that it’s now ~3s using the truncate function, and ~7s using the original code (though they have slightly different functionality, one crops the function and the other one moves all the points outside the range into the nearest point in the range).
I also noticed that your definition of the “clip” function was fairly inefficient. If you use the built-in “truncate” function instead, time is shaved to 15 seconds in the latest version.
Happy to report that it’s now ~3s using the truncate function, and ~7s using the original code (though they have slightly different functionality, one crops the function and the other one moves all the points outside the range into the nearest point in the range).