Skip to content

Commit 3838c58

Browse files
committed
Kinda closer to correct error phasing for adjacent parallel lines
1 parent fceacc0 commit 3838c58

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

debug-tools/examples/thick-line-mul-256.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ fn thickline(
191191
},
192192
);
193193

194+
let mut parallel_error = 2 * parallel_delta.minor + parallel_delta.major;
195+
194196
while thickness_accumulator.pow(2) <= thickness_threshold {
195197
let p = Point::new(
196198
if seed_is_y_major {
@@ -248,6 +250,7 @@ fn thickline(
248250

249251
if prev.x != p.x {
250252
mul_point += parallel_step_full.major;
253+
parallel_error += 2 * parallel_delta.minor;
251254
}
252255

253256
parallel_line_2(
@@ -258,6 +261,7 @@ fn thickline(
258261
Rgb888::CSS_AQUAMARINE,
259262
display,
260263
true,
264+
parallel_error,
261265
)?;
262266

263267
thickness_accumulator += 2 * thickness_dy;
@@ -277,7 +281,7 @@ fn thickline(
277281
thickness_accumulator += 2 * thickness_dx;
278282
seed_point += seed_step.major * 2;
279283
mul_point += parallel_step_full.minor * -1 * 2;
280-
284+
// parallel_error += 2 * parallel_delta.minor;
281285
prev = p;
282286
}
283287

@@ -441,6 +445,7 @@ fn parallel_line_2(
441445
c: Rgb888,
442446
display: &mut impl DrawTarget<Color = Rgb888, Error = std::convert::Infallible>,
443447
extra: bool,
448+
initial_error: i32,
444449
) -> Result<(), std::convert::Infallible> {
445450
let mut point = start;
446451

@@ -453,7 +458,8 @@ fn parallel_line_2(
453458
let e_major = 2 * dy;
454459
let length = dx;
455460
// Setting this to zero causes the first segment before the minor step to be too long
456-
let mut error = 2 * dy - dx;
461+
// let mut error = 2 * dy - dx;
462+
let mut error = initial_error;
457463

458464
for _i in 0..length {
459465
let p = Point::new(

0 commit comments

Comments
 (0)