Crates.io | robust2d |
lib.rs | robust2d |
version | 0.1.0 |
source | src |
created_at | 2017-01-07 20:37:28.687806 |
updated_at | 2017-01-07 20:37:28.687806 |
description | Robust geometric predicates based on Jonathan Schewchuk's library https://www.cs.cmu.edu/~quake/robust.html |
homepage | |
repository | https://github.com/andersforsgren/robust2d |
max_upload_size | |
id | 7973 |
size | 181,911 |
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.
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"