DougLau/footile

Path Example That Produces A Panic

Closed this issue · 2 comments

Example triggers panic: #20

use footile::{Plotter, PathOp::*};

mod png;

fn main() -> Result<(), std::io::Error> {
    let path = vec![
        Move(8.0, 4.0),
        Line(8.0, 3.0),
        Cubic(8.0, 3.0, 8.0, 3.0, 9.0, 3.75),
        Line(8.0, 3.75),
        Line(8.5, 3.75),
        Line(8.5, 3.5),
        Close(),
    ];
    let mut p = Plotter::new(64, 64);

    png::write_mask(p.fill(&path, footile::FillRule::NonZero), "./overlapping.png")
}

thread 'main' panicked at 'assertion failed: dy > Fixed::ZERO', src/fig.rs:121:9

  12:     0x560a45c0b21b - footile::fig::Edge::new::ha025b804eef6ddc7
                               at src/fig.rs:121
  13:     0x560a45c0e249 - footile::fig::Scanner::edge_regular::hded8104148dc4b5a
                               at src/fig.rs:636
  14:     0x560a45c0dc4a - footile::fig::Scanner::update_edges::h8eb063b97b6c4e32
                               at src/fig.rs:594
  15:     0x560a45c0d058 - footile::fig::Scanner::scan_vertex::hb7e7c4706bd86814
                               at src/fig.rs:483
  16:     0x560a45c0cd71 - footile::fig::Fig::fill::h494ccc1f0bc5b08e
                               at src/fig.rs:439
  17:     0x560a45b93381 - footile::plotter::Plotter::fill::hf6b17fb11e1691d2
                               at /home/aldaron/lordaldaron/footile/src/plotter.rs:331
  18:     0x560a45b90b7a - overlapping::main::h878a2bc11f333978
                               at examples/overlapping.rs:17

Seems to be fixed now.

Yeah, updated version doesn't panic anymore