Conversation
the Line shape can now go in all directions
buehlefs
left a comment
There was a problem hiding this comment.
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
buehlefs
left a comment
There was a problem hiding this comment.
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
buehlefs
left a comment
There was a problem hiding this comment.
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.
| 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