#vector #geometry #algebra

geologic

以人体工程学为重点的数学和几何抽象

3 个版本

0.0.3 2022 年 7 月 6 日
0.0.2 2022 年 7 月 3 日
0.0.1 2022 年 6 月 26 日

#932 in 数学

MIT 许可证

42KB
926

Geologic

这是一个正在进行中的作品。


lib.rs:

以人体工程学为重点的数学和几何抽象。

免责声明

这个库仍在开发中,版本之间可能会有破坏性的变化。

如果您想添加缺少的功能或报告一个错误,请创建一个 GitHub 上的 issue。

示例

// Import the prelude for convenience
use geologic::*;

let position = point!(0i32, 40);
let size = size!(5; 2);

// Derive a Bounds2D from a position and size.
let bounds = position.with_size(size);

// Translate the bounds with an offset
let moved_bounds = bounds + offset!(3, 5);

// Resize the bounds up with a size
let enlarged_bounds = moved_bounds + size!(10, 10);
assert_eq!(enlarged_bounds, bounds!(3, 45, 15, 15));

// We can also use tuples and types interchangeably for operations like these
let moved_bounds = bounds.with_position((0, 0));
assert_eq!(moved_bounds, bounds!(0, 0, 5, 5))

依赖项

~150KB