Skip to content

Extending Rectangle #123

@nishirken

Description

@nishirken

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions