Open
Conversation
when one or both circles increase to some size, the method returns true even when no intersection is occuring; removes unused resolved_circle_(one|two) vars; properly handles anchor_(x|y); removes necessity for anchor_(x|y) on args without radius; uses the center points of the circles in distance_squared; adds error message;
I didn't notice it was in the docs and removed it preemptively;
re-implemented to work more closely to the docs descriptions;
removes necessity for anchor_(x|y) on args without a radius;
allows anchor_(x|y) to work on args with a radius;
original implementation returns {x:, y:, radius:}
but the docs implies that what is returned is a rect,
re-implementation returns {x:, y:, w:, h:, radius:} for
the best of both worlds
utilize Geometry.rect_to_circle now that it works as intended
also adds anchor(x|y) functionality
Jealrock
reviewed
Dec 21, 2024
| end | ||
| shape.respond_to?(:x) && | ||
| shape.respond_to?(:y) && | ||
| shape.respond_to?(:radius) |
There was a problem hiding this comment.
This returns true when passed shape is a Hash without radius key, so circle? would return true for a Hash describing rect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A bunch of the new circle methods either work incorrectly or are inaccurate to the docs descriptions.
Fixed
circle_intersect_line?and added ability to useanchor_(x|y).rect_to_circlewould either return the input object if aradiusproperty exists or a new hash with{x:, y:, radius: }, neither of which are what the docs says it should return which is a rectangle. But that's also counterintuitive to the method name so I changed it to always return a new hash with{x:, y:, w:, h:, radius: }for consistency. I also removed the necessity foranchor_(x|y)with inputs without aradiuswhile allowing any input to useanchor_(x|y).To be honest, I just didn't know why
rect?andcircle?require truthy values for Hash inputs but only needrespond_to?to be true for non Hash inputs and it bothered me so I simplified them.Fixed
intersect_circle?and removed the necessity foranchor_(x|y)with inputs without aradiuswhile allowing any input to useanchor_(x|y).