-
Notifications
You must be signed in to change notification settings - Fork 199
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
Closest Point #161
Comments
Do you mean between all combinations of geometries? It's certainly possible, but it would be a lot of work; some of the current distance algorithms check for intersection first and stop if one is found, without calculating the point at which it occurs, or are implemented using algorithms that don't retain the nearest point. Also, the |
If we had buffer, union, and intersection (all planned as far as I know), I think this would be straightforward: |
Good point, but I don’t think anyone’s made progress on #80, and buffer ops on polygons require a half-edge data structure and straight-skeleton algorithm, so quite a lot of work. |
I should preface this by saying I'm actually using this as a general-purpose geometry library instead of anything geography related... My use case is I want to let a user click on an object ( How I'd implement this is by first implementing it for the line-point combination, then for closest point between a In this case I'm mainly interested in the closest distance between a point and something else, but it'd be nice to do something like line-line or polygon-polygon. That's not critical though. |
I've implemented a version of this for trying to find the closest place on pretty much any object to a |
167: Closest point r=frewsxcv a=Michael-F-Bryan The initial implementation of a `ClosestPoint` algorithm. The trait itself looks something like this: ```rust pub trait ClosestPoint<F: Float, Rhs = Point<F>> { fn closest_point(&self, other: &Rhs) -> Closest<F>; } pub enum Closest<F: Float> { Intersection(Point<F>), SinglePoint(Point<F>), Indeterminate, } ``` If you can think of a better name for `Closest` please let me know (names are hard!). (fixes #161)
Would it be possible to add a closest Points algorithm? I'm guessing that it's be a trait which returns either a single point (intersection), a pair of points (closest Points on object A and B), or some sort of "infinite points" marker for when two lines are exactly parallel.
The text was updated successfully, but these errors were encountered: