Fix display issue with >= 5 variables

Previously, the initial window would be too small.

Resolves #2
This commit is contained in:
Arne Keller 2023-11-09 11:36:14 +01:00
parent 77805f75cf
commit 07e0ce40c4
2 changed files with 6 additions and 4 deletions

View File

@ -7,10 +7,11 @@ const SIZE_FACTOR: usize = 64;
fn main() {
let args = args().collect::<Vec<_>>();
let vars = [A, B, C, D];
let vars = [A, B, C, D, E];
//let function = vec![0, 0, 1, 1, 1, 1, 1, 0].into_iter().map(Into::into).collect();
//let function = vec![0, 0, 1, 1, 1, 1, 1, 2].into_iter().map(Into::into).collect();
let function = parse_function("-1111000-1-01---");
//let function = parse_function("-1111000-1-01---");
let function = parse_function("11101111111111111111101111111101");
let groups = find_groups(&function, &vars, One);
eprintln!("all:");
for x in &groups {
@ -45,5 +46,5 @@ fn main() {
.collect()
};
println!("{}", svg::get_svg(SIZE_FACTOR, false, &function, &vars, &block_masks));
println!("{}", svg::get_svg(SIZE_FACTOR, true, &function, &vars, &block_masks));
}

View File

@ -74,7 +74,8 @@ pub fn get_svg(size_factor: usize, print_labels: bool,
if print_labels {
for i in 0..vars.len() {
let offset = (i / 4) as f32 * size2 + size16;
let initial_window = 2usize.pow(((i + 2) / 4) as u32);
let initial_window = 2usize.pow((i / 2) as u32);
//eprintln!("i = {i}, offset = {offset}, initial_window = {initial_window}");
let mut start = vec![false; initial_window];
start.extend(vec![true; initial_window]);
let desired_len = if i % 2 == 0 { w } else { h };