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

Extending Rectangle #123

Open
nishirken opened this issue Sep 4, 2022 · 0 comments
Open

Extending Rectangle #123

nishirken opened this issue Sep 4, 2022 · 0 comments

Comments

@nishirken
Copy link

nishirken commented Sep 4, 2022

Hello, some functionality can be added to the Rectangle class:

/**
Restricts the rectangle within another larger rectangle.
{x: -50, y: -50, w: 100, y: 100} restrictWithin {x: 0: y: 0, w: 500, h: 500} -> {x: 0, y: 0, w: 100, y: 100}
*/
restrictWithin(rect: Rectangle): Rectangle;

This also can be added to Circle and Ellipse classes. The method can be overloaded:

restrictWithin(rect: Rectangle): Rectangle;
restrictWithin(rect: Circle): Rectangle;
restrictWithin(rect: Ellipse): Rectangle;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant