4 releases
Uses old Rust 2015
0.0.5 | Jan 28, 2018 |
---|---|
0.0.3 | Jan 14, 2018 |
0.0.2 | Jan 13, 2018 |
0.0.1 | Jan 12, 2018 |
#53 in #collision
24KB
556 lines
simple-fcl
simple-fcl implements Rust bindings for a subset of FCL functionality.
Usage
You can add the crate to your project with:
[dependencies]
simple-fcl = "0.0.3"
Usage examples are provided in the documentation.
The package requires you to install FCL for it to work. You can, for example, do this on Ubuntu with:
sudo apt-get install libfcl-dev
License
rust-simple-fcl is distributed under the MIT license.
lib.rs
:
Library for using FCL to do collision and distance checks between meshes
Examples
let mut model_builder_a = simple_fcl::ModelBuilder::default();
model_builder_a.add_triangle(
simple_fcl::Vec3f::new(10.0, 0.0, 0.0),
simple_fcl::Vec3f::new(0.0, 0.0, 1.0),
simple_fcl::Vec3f::new(0.0, 0.0, -1.0),
);
let model_a = model_builder_a.build();
let mut model_builder_b = simple_fcl::ModelBuilder::default();
model_builder_b.add_triangle(
simple_fcl::Vec3f::new(5.0, -10.0, -10.0),
simple_fcl::Vec3f::new(5.0, -10.0, 10.0),
simple_fcl::Vec3f::new(5.0, 10.0, 0.0),
);
let model_b = model_builder_b.build();
let rotation_none = simple_fcl::Rotation3f::identity();
let translation_none = simple_fcl::Translation3f::new(0.0, 0.0, 0.0);
assert!(simple_fcl::collide(
&model_a,
&rotation_none,
&translation_none,
&model_b,
&rotation_none,
&translation_none,
));
assert!(simple_fcl::distance(
&model_a,
&rotation_none,
&translation_none,
&model_b,
&rotation_none,
&translation_none,
&simple_fcl::DistanceOptions::default(),
).is_none());
Dependencies
~3.5–6MB
~112K SLoC