-
Notifications
You must be signed in to change notification settings - Fork 200
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
Added destination trait. #124
Conversation
I'm uneasy about the generality implied by the name of the trait as is. At the very least, the description should make it clear that this is distance projected using the WGS84 spheroid (if I understand correctly). |
@urschrei: yup true, what about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HaversineDestination
makes sense to me!
src/algorithm/destination.rs
Outdated
/// ``` | ||
/// # extern crate geo; | ||
/// # #[macro_use] extern crate approx; | ||
/// # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't need these three lines for this doc example. extern crate geo
is already implicitly added and you aren't using the 'approx' provided assert_relative_eq!
macro
src/algorithm/destination.rs
Outdated
/// use geo::Point; | ||
/// use geo::algorithm::destination::Destination; | ||
/// | ||
/// # fn main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once you remove the three lines above, you can remove this fn main() {
and closing }
src/algorithm/destination.rs
Outdated
} | ||
|
||
#[cfg(test)] | ||
mod destination { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a big deal, but usually tests live in a module named test
@frewsxcv thx for your remarks, I think i covered those. |
bors r+ |
124: Added destination trait. r=frewsxcv The code is inspired from the turf.js equivalent fn in https://github.com/Turfjs/turf/tree/master/packages/turf-destination It basically shoots a ray on the sphere using a distance and an angle from an existing point to create a new point. This is useful when creating pseudo shapes like circles (split circle in _n_ angle angle slices, create _n_ new Points via `destination` from a circle center Point, then combine the new Points to a Polygon.
Build succeeded |
The code is inspired from the turf.js equivalent fn in https://github.com/Turfjs/turf/tree/master/packages/turf-destination
It basically shoots a ray on the sphere using a distance and an angle from an existing point to create a new point.
This is useful when creating pseudo shapes like circles (split circle in n angle angle slices, create n new Points via
destination
from a circle center Point, then combine the new Points to a Polygon.