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

Impl Polygon convexity function on the type #195

Merged
merged 2 commits into from
Mar 29, 2018

Conversation

urschrei
Copy link
Member

The convexity function was previously only available within the
Extremes module, but it's generally useful and will be required by
other algorithms. This moves the function and implements it directly
on the type.

The convexity function was previously only available within the
Extremes module, but it's generally useful and will be required by
other algorithms. This moves the function and implements it directly
on the type.
src/types.rs Outdated
false
} else {
true
}
Copy link
Member

Choose a reason for hiding this comment

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

these last five lines can just be convex != ListSign::Mixed

src/types.rs Outdated
// The polygon is convex if the z-components of the cross products are either
// all positive or all negative. Otherwise, the polygon is non-convex.
// see: http://stackoverflow.com/a/1881201/416626
pub fn convex(&self) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

most things that return bool usually start with is_ or has_. what do you think about calling this is_convex?

@urschrei
Copy link
Member Author

Addressed!

@frewsxcv
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Mar 29, 2018
195: Impl Polygon convexity function on the type r=frewsxcv a=urschrei

The convexity function was previously only available within the
Extremes module, but it's generally useful and will be required by
other algorithms. This moves the function and implements it directly
on the type.
@bors
Copy link
Contributor

bors bot commented Mar 29, 2018

Build succeeded

@bors bors bot merged commit a61d20a into georust:master Mar 29, 2018
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.

2 participants