#predicates #robust #geometry

robust2d

Robust geometric predicates based on Jonathan Schewchuk's library https://www.cs.cmu.edu/~quake/robust.html

1 unstable release

Uses old Rust 2015

0.1.0 Jan 7, 2017

#7 in #predicates

MIT license

185KB
3.5K SLoC

C 3.5K SLoC // 0.1% comments Rust 122 SLoC // 0.0% comments

robust2d

Robust geometric predicates based on Jonathan Schewchuk's library https://www.cs.cmu.edu/~quake/robust.html Provides a simple ffi wrapper for the C library as well as some ergonomic Rust types and functions.

Example

let _ = arithmetic::Library::init();  // Must initialize some static constants for the robust arithmetic

// Circle center at (0.0, 1.0) r=1.0
let a = Point::new(-1.0, 1.0);
let b = Point::new(1.0, 1.0);
let c = Point::new(0.0, 2.0);

// Test point
let p2 = Point::new(0.1, 0.5);

println!("{:?}", p2.orient_to_circle(&a, &b, &c)); // "Inside"

Dependencies

~0.2–1MB
~24K SLoC