Remove file write

This commit is contained in:
Dennis Kobert 2025-01-12 00:48:02 +01:00
parent 3e384acf4d
commit d49dafbfc0
No known key found for this signature in database
GPG key ID: 5A4358CB9530F933

View file

@ -115,14 +115,14 @@ pub fn path_segment_intersection(seg0: &PathSegment, seg1: &PathSegment, endpoin
let path2 = path_segment_cubic_to_lyon(*s2, *c12, *c22, *e2); let path2 = path_segment_cubic_to_lyon(*s2, *c12, *c22, *e2);
let intersections = path1.cubic_intersections_t(&path2); let intersections = path1.cubic_intersections_t(&path2);
let mut file = std::fs::File::options().append(true).create(true).open("/tmp/intersections").unwrap(); // let mut file = std::fs::File::options().append(true).create(true).open("/tmp/intersections").unwrap();
let format_curve = |seg0: &PathSegment| seg0.to_cubic().map(|point| format!("{} {}", point.x, point.y)).join(" "); // let format_curve = |seg0: &PathSegment| seg0.to_cubic().map(|point| format!("{} {}", point.x, point.y)).join(" ");
let intersections: Vec<_> = intersections.into_iter().map(|(s, t)| [s, t]).collect(); let intersections: Vec<_> = intersections.into_iter().map(|(s, t)| [s, t]).collect();
let intersections_fmt: Vec<_> = intersections.iter().map(|[s, t]| format!("{},{}", s, t)).collect(); // let intersections_fmt: Vec<_> = intersections.iter().map(|[s, t]| format!("{},{}", s, t)).collect();
if !intersections.is_empty() { // if !intersections.is_empty() {
writeln!(&mut file, "{}\n{}\n{}\n", format_curve(seg0), format_curve(seg1), intersections_fmt.join(" "),).unwrap(); // writeln!(&mut file, "{}\n{}\n{}\n", format_curve(seg0), format_curve(seg1), intersections_fmt.join(" "),).unwrap();
file.flush().unwrap(); // file.flush().unwrap();
} // }
// let intersections: Vec<_> = intersections.into_iter().map(|(s, t)| [s, t]).collect(); // let intersections: Vec<_> = intersections.into_iter().map(|(s, t)| [s, t]).collect();
return intersections; return intersections;
} }