4 个版本
使用旧的 Rust 2015
0.0.5 | 2018年1月28日 |
---|---|
0.0.3 | 2018年1月14日 |
0.0.2 | 2018年1月13日 |
0.0.1 | 2018年1月12日 |
#53 in #collision
24KB
556 代码行数(不含注释)
simple-fcl
simple-fcl 实现了 FCL 功能子集的 Rust 绑定。
使用方法
您可以使用以下命令将包添加到项目中:
[dependencies]
simple-fcl = "0.0.3"
使用示例在文档中提供。
此包需要您安装 FCL 才能正常工作。例如,您可以在 Ubuntu 上使用以下命令安装:
sudo apt-get install libfcl-dev
许可证
rust-simple-fcl 在 MIT 许可证下分发。
lib.rs
:
使用 FCL 进行网格之间的碰撞和距离检查的库
示例
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());
依赖项
~3.5–5.5MB
~106K SLoC