Skip to content

Implement GeneralRoundedRectangle contains() and intersects() methods#9

Open
karlvr wants to merge 3 commits intovioletlib:masterfrom
karlvr:fix/general-round-rectangle
Open

Implement GeneralRoundedRectangle contains() and intersects() methods#9
karlvr wants to merge 3 commits intovioletlib:masterfrom
karlvr:fix/general-round-rectangle

Conversation

@karlvr
Copy link
Copy Markdown

@karlvr karlvr commented Mar 17, 2026

The GeneralRoundedRectangle class came from RoundRectangle2D but the implementations of contains() and intersects() from there were commented-out. We've taken the liberty of producing implementations that handle the rounded rect having non-uniform corners... perhaps that's why the original implementations were rejected?

Because of the nature of this code we've added some unit tests... I couldn't work out the right way to use VBuilder to do this so I've dumped the junit jar (and dependency) into the project... perhaps you can improve that?

@karlvr karlvr force-pushed the fix/general-round-rectangle branch from 29efeff to d411140 Compare March 17, 2026 18:40
karlvr added 2 commits March 18, 2026 07:41
Also adds JUnit 4 jars to lib/test/ and a test target to the Ant build.
The previous implementation would skip sharp corners (arc=0). This caused false negatives when a query rect overlapped a sharp corner: the middle band was too narrow to accept it, and the corner check skipped it.

Also fixes the intersects_cornerOverlap test to use a rect that actually exercises the corner intersection path, and add a test for the mixed sharp/rounded corner case.
@karlvr karlvr force-pushed the fix/general-round-rectangle branch from d411140 to 525d0de Compare March 17, 2026 18:41
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.

1 participant