Crates.io | line-clipping |
lib.rs | line-clipping |
version | 0.3.3 |
created_at | 2024-11-18 21:48:03.500577+00 |
updated_at | 2025-05-19 03:07:47.864251+00 |
description | A simple crate implementing line clipping algorithms. |
homepage | |
repository | https://github.com/joshka/line-clipping |
max_upload_size | |
id | 1452691 |
size | 49,661 |
A rust crate to implement several line clipping algorithms. See the documentation for more information. The choice of algorithms is based on the following article which contains a good summary of the options:
Matthes D, Drakopoulos V. Line Clipping in 2D: Overview, Techniques and Algorithms. J Imaging. 2022 Oct 17;8(10):286. doi: 10.3390/jimaging8100286. PMID: 36286380; PMCID: PMC9605407.
Supports:
TODO
cargo add line-clipping
use line_clipping::cohen_sutherland::clip_line;
use line_clipping::{LineSegment, Point, Window};
let line = LineSegment::new(Point::new(-10.0, -10.0), Point::new(20.0, 20.0));
let window = Window::new(0.0, 10.0, 0.0, 10.0);
let clipped_line = clip_line(line, window);
Copyright (c) Josh McKinney
This project is licensed under either of
at your option.
Contributions are welcome! Please open an issue or submit a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.