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

Add angle and destinationOnSegment #71

Merged
merged 1 commit into from
Jan 6, 2018

Conversation

trandaison
Copy link
Contributor

@trandaison trandaison commented Dec 13, 2017

  • Add 2 new functions:
    • angle: Returns the the angle of the given segment and the meridian in degrees, clockwise from 0 degrees east.
    • destinationOnSegment: Returns the point that is a distance and heading away from the given origin point and snap on the given segment.
  • Update the docs.

Please review and merge this one, thank you!

@mdartic
Copy link
Member

mdartic commented Dec 16, 2017

Thank you @trandaison !
Will you agree adding some test case for your two new methods ?
If edge cases exist, please integrate them too ?

Copy link
Collaborator

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a few unit tests, it'd be perfect.

@param {float}: heading in degrees, clockwise from 0 degrees north.
@param {float}: distance in meters
@param {float} heading: heading in degrees, clockwise from 0 degrees north.
@param {float} distance: distance in meters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/leaflet.geometryutil.js Outdated Show resolved Hide resolved
src/leaflet.geometryutil.js Show resolved Hide resolved
src/leaflet.geometryutil.js Outdated Show resolved Hide resolved
src/leaflet.geometryutil.js Outdated Show resolved Hide resolved
@trandaison
Copy link
Contributor Author

trandaison commented Jan 5, 2018

@mdartic
Thanks for your comment.
If edge cases exist, it would be anticlockwise.This function returns an angle clockwise from 0 degrees east. In case you want to get the edge angle, 360 - anggle would do the job.

@trandaison trandaison force-pushed the master branch 8 times, most recently from dd0b3a5 to c534c6e Compare January 5, 2018 07:36
@mdartic mdartic merged commit 560f87d into makinacorpus:master Jan 6, 2018
@mdartic
Copy link
Member

mdartic commented Jan 6, 2018

Thanks @trandaison !

mdartic added a commit that referenced this pull request Jun 26, 2018
* Fix `interpolateOnLine()` doesn't return correct predecessor (#66, thanks @jb2b38)
* Add `angle()` and `destinationOnSegment()` (#71, thanks @trandaison)
* migrate mocha to 5.2.0 following instructions on npm audit
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