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

Improved GeometricUtilities #332

Merged
merged 8 commits into from
Apr 7, 2020
Merged

Conversation

Gamebuster19901
Copy link
Contributor

  • Added getMidPoint(Line2D)
  • Optimized getMidpoint(Point2D, Point2D)
  • Added getMidPoint(double x1, double y1, double x2, double y2)
  • Added getMidPoint(RectangularShape)
  • Added unit tests for the above methods

getMidPoint(Point2D, Point2D) is more optimized now because it no longer calls getAveragePosition(Point2D...). This is faster because an array is no longer created or iterated, and there are no unnecessary calls to Point2D[].length

Copy link
Member

@nightm4re94 nightm4re94 left a comment

Choose a reason for hiding this comment

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

I see some useful utilities right here, thank you!
To comply with other nomenclatures of LITIengine, I would suggest renaming the methods to retrieve center points to getCenter(...).
Furthermore, it would be more convenient to define one base method for retrieving center points, and then let all method overloads with different parameters just call that base method instead of defining the calculations separately for each overload.

Copy link
Member

@nightm4re94 nightm4re94 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the suggestions!

@nightm4re94 nightm4re94 merged commit d9b5a03 into gurkenlabs:master Apr 7, 2020
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