Skip to content

Commit

Permalink
Kinda closer to correct error phasing for adjacent parallel lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jamwaffles committed Nov 29, 2024
1 parent fceacc0 commit 3838c58
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions debug-tools/examples/thick-line-mul-256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ fn thickline(
},
);

let mut parallel_error = 2 * parallel_delta.minor + parallel_delta.major;

while thickness_accumulator.pow(2) <= thickness_threshold {
let p = Point::new(
if seed_is_y_major {
Expand Down Expand Up @@ -248,6 +250,7 @@ fn thickline(

if prev.x != p.x {
mul_point += parallel_step_full.major;
parallel_error += 2 * parallel_delta.minor;
}

parallel_line_2(
Expand All @@ -258,6 +261,7 @@ fn thickline(
Rgb888::CSS_AQUAMARINE,
display,
true,
parallel_error,
)?;

thickness_accumulator += 2 * thickness_dy;
Expand All @@ -277,7 +281,7 @@ fn thickline(
thickness_accumulator += 2 * thickness_dx;
seed_point += seed_step.major * 2;
mul_point += parallel_step_full.minor * -1 * 2;

// parallel_error += 2 * parallel_delta.minor;
prev = p;
}

Expand Down Expand Up @@ -441,6 +445,7 @@ fn parallel_line_2(
c: Rgb888,
display: &mut impl DrawTarget<Color = Rgb888, Error = std::convert::Infallible>,
extra: bool,
initial_error: i32,
) -> Result<(), std::convert::Infallible> {
let mut point = start;

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

for _i in 0..length {
let p = Point::new(
Expand Down

0 comments on commit 3838c58

Please sign in to comment.