-
Notifications
You must be signed in to change notification settings - Fork 205
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 centroid implementation for MultiPoint #322
Conversation
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.
lgtm, apart from the nit
} | ||
let sum = self.0.iter().fold( | ||
Point::new(T::zero(), T::zero()), | ||
|a: Point<T>, b: &Point<T>| Point::new(a.x() + b.x(), a.y() + b.y()), |
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.
do we need b
to be &
Point<T>
?
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.
.iter()
returns a Iterator<Item=&Point<T>>
thus you can't really do any other thing (type inference might work here).
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.
maybe adding a test?
the test is in the comment ;) |
That's OK for me, @urschrei I let you merge if everything is good on your side. |
bors r+ |
Build failed |
bors retry |
Build succeeded |
Adds missing implementation of centroid on MultiPoint struct.