Skip to content
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

Merged
merged 2 commits into from
Jul 24, 2017
Merged

Added destination trait. #124

merged 2 commits into from
Jul 24, 2017

Conversation

mkulke
Copy link
Contributor

@mkulke mkulke commented Jun 27, 2017

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.

@urschrei
Copy link
Member

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).

@mkulke
Copy link
Contributor Author

mkulke commented Jun 28, 2017

@urschrei: yup true, what about HaversineDestination?

Copy link
Member

@frewsxcv frewsxcv left a 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!

/// ```
/// # extern crate geo;
/// # #[macro_use] extern crate approx;
/// #
Copy link
Member

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

/// use geo::Point;
/// use geo::algorithm::destination::Destination;
///
/// # fn main() {
Copy link
Member

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 }

}

#[cfg(test)]
mod destination {
Copy link
Member

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

@mkulke
Copy link
Contributor Author

mkulke commented Jul 4, 2017

@frewsxcv thx for your remarks, I think i covered those.

@frewsxcv
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Jul 24, 2017
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.
@bors
Copy link
Contributor

bors bot commented Jul 24, 2017

Build succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants