#computational-geometry #geometry #2d #computational #spatial #graphics

cavalier_contours

2D polyline/shape library for offsetting, combining, etc

4 releases (breaking)

0.4.0 Feb 22, 2024
0.3.0 Feb 19, 2023
0.2.0 May 13, 2022
0.1.0 Mar 11, 2021

#194 in Math

Download history 21/week @ 2024-08-09 18/week @ 2024-08-16 15/week @ 2024-08-23 25/week @ 2024-08-30 20/week @ 2024-09-06 23/week @ 2024-09-13 35/week @ 2024-09-20 33/week @ 2024-09-27 16/week @ 2024-10-04 41/week @ 2024-10-11 54/week @ 2024-10-18 38/week @ 2024-10-25 60/week @ 2024-11-01 52/week @ 2024-11-08 43/week @ 2024-11-15 73/week @ 2024-11-22

234 downloads per month
Used in cavalier_contours_ffi

MIT/Apache

395KB
8K SLoC

Summary

This project is a continuation of the C++ CavalierContours library rewritten in Rust with the goal of building out more functionality, better documentation, and creating a stable C FFI. This project has all of the functionality of the C++ repository with more code documentation, test coverage, and some additional functions for working with polylines. For tracking progress and contributing checkout the project GitHub issues. For more information about the parallel offset algorithm and background information see the old C++ repository README.md here.

This library uses no unsafe code (#![forbid(unsafe_code)] is applied) in the main cavalier_contours crate. Unsafe is used in the cavalier_contours_ffi crate for C bindings.

Interactive Web Page for Visualizing and Testing

This project is compiled to wasm to create an interactive web demo page for visualing and testing.

Why go to Rust?

  • All the same benefits of using C or C++ (great performance/optimizations, native compile, no garbage collection, no run time) for creating fast portable libraries with a C FFI
  • Great builtin tooling around builds and packages (cargo + crates)
  • Great builtin tooling for writing and maintaining tests
  • All of the great builtin tooling makes open source contribution and participation easier to facilitate
  • Borrow checker + lifetimes allow for more advanced memory allocation optimizations without the risk of memory errors/corruption bugs
  • Type system allows for leaning heavily on threads/concurrency without the risk of memory errors/corruption bugs
  • Discriminated unions and pattern matching as first class language features
  • Great tooling for targeting wasm

New to Rust but still want to contribute?

I recommend the official rust book here. Visual Studio Code + rust-analyzer extension work great for editing. If you're looking for something specific to work on check the project issues labeled good first issue.

License

Licensed under either of

at your option.

Contribution

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.

Dependencies

~155–370KB