-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fixed cropping polygon in some corner cases #3184
Conversation
(p1.x === p2.x || Math.sign(resultPoints[0] - resultPoints[2]) !== Math.sign(p1.x - p2.x)) | ||
&& (p1.y === p2.y || Math.sign(resultPoints[1] - resultPoints[3]) !== Math.sign(p1.y - p2.y)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core change to fix (others are to satisfy eslint, minor refactoring, and some minor bug fixes).
As I understand the issue was following:
After the first (Horizontal) crop p1.x in a corner case could be equal to p2.x).
The same if we reverse crop order (first is Vertical), then p1.y in a corner case could be equal to p2.y.
In these corner cases the condition is false and we do not reverse points when it is actually necessary.
Sure. A test will be prepared. |
const dx = offsetCoords[0] ** 2; | ||
const dy = offsetCoords[1] ** 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflict between prettier and eslint.
There were suggestion to split to several lines:
https://github.com/prettier/eslint-config-prettier#no-mixed-operators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Motivation and context
Resolved #3178
Hi @dvkruchinin
A test for this case would be good.
How has this been tested?
Manual testing
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.