-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for signed distance for nonuniform grids #359
Conversation
With this merge, geometry is subdivided first before computing distance and mask (then signed distance).
This requires interpolating to "pixel" or "index" space and is only effective if the geometry is sampled at a resolution close to the finest on the grid.
@dengwirda, could you review this at your convenience? I included an example I played around with in my testing in the documentation. The resulting distance, mask and signed-distance functions look like this: |
Thanks @xylar, I checked this via an ICoM config., and all works as advertised. |
@dengwirda, that's disappointing. Let's chat about alternative approaches (for both ICoM and COMPASS). Would it be hard to add some print statements to find out which part of the process is slow? If it's transforming the geometry, I could look into that. But I assume the speed issue is from finding the distance, not the sign or transforming the geometry into index space. FLANN (what we use to find nearest-neighbor distance) has been pretty performant for the tests I've done but it still gets slower the more points you have in the shapes you're using or in your reference grid. |
@xylar, okay, I've tried to dig into this a little further, and am seeing the following:
This is for quite a big problem ( Since the |
As an additional aside, I typically use
I think there's no problem using Euclidean distances, but there are some interesting differences compared to the geodesic results: |
@dengwirda, thanks a lot of looking into this so extensively. I don't think we are particularly attached to the methods we're using. If jigsaw can be used in place of the tools we have, it would be worth rewriting the signed-distance code to use it instead. I believe @sbrus89 used Euclidean distance, rather than geodesic distance, out of convenience, not because of any particular preference for that metric. We could certainly add support for using |
@xylar, no worries --- I'll approve this now, and put together a different PR (when this is merged) to add the |
Thanks @dengwirda! |
This requires interpolating to "pixel" or "index" space and is only effective if the geometry is sampled at a resolution close to the finest on the grid.
To support this, some refactoring has been done so that geometry is subdivided first before computing distance and mask (then signed distance).