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

expand/shrink rectangle functions #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dennisorlando
Copy link
Contributor

  • added shrink function to rectangle (mutable)
  • added "shrunk" function to rectangle (copy)
  • added expand function to rectangle (mutable)
  • added "expanded" function to rectangle (copy)

@QuantumBadger
Copy link
Owner

Thank you for this, and sorry for the big delay in reviewing.

Would it be possible to make the following changes please?

  • Remove the mutable versions, and rename the copy versions to shrink and expand (for simplicity)
  • Add some tests to ensure this is working correctly -- I think in some places this may be adding instead of subtracting, and vice versa.

@dennisorlando
Copy link
Contributor Author

Thank you for this, and sorry for the big delay in reviewing.

Would it be possible to make the following changes please?

* Remove the mutable versions, and rename the copy versions to `shrink` and `expand` (for simplicity)

* Add some tests to ensure this is working correctly -- I think in some places this may be adding instead of subtracting, and vice versa.

How would we handle when we want to shrink a Rectangle that is contained in another struct? If we only make copies then wouldn't it mean that we either have to replace the Rectangle with a new one (not sure how ownership handles that, I might be messing up) or manually modify the fields of the rectangle?

@dennisorlando
Copy link
Contributor Author

I'll write some tests as I find some time, I'll have to remember to do that tho 😆 😮‍💨
I've currently only tested it locally (on a project that I'm working on) where it appears to be working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants