-
Notifications
You must be signed in to change notification settings - Fork 8
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
Improve Shapes #121
base: master
Are you sure you want to change the base?
Improve Shapes #121
Conversation
the Line shape can now go in all directions
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 new line implementation breaks rectangles. And for some lines the start and end coordinates are not part of the line (e.g. a line from 1,5 to 13,7).
…/jvk into feature/better-better-better-shapes
project/src/main/java/de/unistuttgart/informatik/fius/jvk/provided/shapes/Circle.java
Outdated
Show resolved
Hide resolved
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 line implementation should still be broken (see previous reviews)
project/src/main/java/de/unistuttgart/informatik/fius/jvk/provided/shapes/Circle.java
Outdated
Show resolved
Hide resolved
the last commit had the worng file
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.
This fixes Rectangles but lines like (4,5)--(13,7) and (1,4)--(3,13) are off by one on one axis.
The error goes in the direction away from 0 of the axis.
The line (4,5)--(13,7) is drawn as (4,6)--(13,8) with a y error of +1
The line (4,-5)--(13,-7) is drawn as (4,-6)--(13,-8) with a y error of -1
If the coordinates are flipped (x := y and y := x) then the error is in the x axis direction
This could be a rounding problem.
if (pos.getX() < x1) { | ||
x1 = pos.getX(); | ||
} | ||
if (pos.getX() > x2) { | ||
x2 = pos.getX(); | ||
} | ||
if (pos.getY() < y1) { | ||
y1 = pos.getY(); | ||
} | ||
if (pos.getY() > y2) { | ||
y2 = pos.getY(); | ||
} |
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.
if (pos.getX() < x1) { | |
x1 = pos.getX(); | |
} | |
if (pos.getX() > x2) { | |
x2 = pos.getX(); | |
} | |
if (pos.getY() < y1) { | |
y1 = pos.getY(); | |
} | |
if (pos.getY() > y2) { | |
y2 = pos.getY(); | |
} | |
x1 = Math.min(x1, pos.getX()); | |
x2 = Math.max(x2, pos.getX()); | |
y1 = Math.min(y1, pos.getY()); | |
y2 = Math.min(y2, pos.getY()); |
Lines can now be diagonal
add Circle