Commit e1cddff
committed
Account for fractions of a pixel when drawing
Previously, the endpoint of the line was always moved
along in increments of 1 pixel, so that the endpoint would always be
rounded down. This could accumulate to give quite large differences
from what the program intended.
Ensure that "goto" always ends up storing the floating point endpoints
and that the line is drawn from the rounded-integer starting coordinate
and rounded-integer ending coordinate.
This makes the 3 test lines in the OP's "turtle_truncate.txt" example
be the same length.
Closes: #411 parent 06de267 commit e1cddff
1 file changed
+9
-70
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 49 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 50 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 51 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 52 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 53 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 54 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 55 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 56 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 57 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 58 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 59 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 60 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 61 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | 62 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 63 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 64 | | |
128 | 65 | | |
129 | 66 | | |
| |||
234 | 171 | | |
235 | 172 | | |
236 | 173 | | |
| 174 | + | |
237 | 175 | | |
238 | 176 | | |
239 | | - | |
240 | | - | |
241 | | - | |
| 177 | + | |
| 178 | + | |
242 | 179 | | |
243 | 180 | | |
244 | 181 | | |
| |||
414 | 351 | | |
415 | 352 | | |
416 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
417 | 360 | | |
418 | 361 | | |
419 | 362 | | |
| |||
444 | 387 | | |
445 | 388 | | |
446 | 389 | | |
447 | | - | |
448 | | - | |
449 | 390 | | |
450 | 391 | | |
451 | 392 | | |
452 | 393 | | |
453 | 394 | | |
454 | | - | |
455 | | - | |
456 | 395 | | |
457 | 396 | | |
458 | 397 | | |
| |||
0 commit comments