From aa77b982e6caefb4d14e64964e0b1009d7a69aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Tue, 14 Dec 2021 22:51:52 +0100 Subject: [PATCH] update dependencies & refactor - bump float_eq & paste. - new `wip` module for WIP work, & exclude it from the crate. - update .gitignore - update docs. --- .gitignore | 3 +++ Cargo.toml | 24 ++++++++++++------------ src/engine/body.rs | 14 -------------- src/lib.rs | 2 +- src/math/mod.rs | 2 +- src/math/vectors.rs | 9 +++------ src/wip/engine/body.rs | 27 +++++++++++++++++++++++++++ src/{ => wip}/engine/mod.rs | 0 src/{ => wip}/engine/scene.rs | 0 src/{ => wip}/engine/shape.rs | 6 ++++++ 10 files changed, 53 insertions(+), 34 deletions(-) delete mode 100644 src/engine/body.rs create mode 100644 src/wip/engine/body.rs rename src/{ => wip}/engine/mod.rs (100%) rename src/{ => wip}/engine/scene.rs (100%) rename src/{ => wip}/engine/shape.rs (79%) diff --git a/.gitignore b/.gitignore index 96ef6c0..6fc0af2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ /target Cargo.lock +*.swp +*.swo +_* diff --git a/Cargo.toml b/Cargo.toml index b1312d5..387bb08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,27 +9,27 @@ repository = "https://github.com/andamira/fisica" documentation = "https://docs.rs/fisica" license = "MIT/Apache-2.0" include = [ - "src/**/*.rs", - "Cargo.toml", - "LICENSE*", - "README.md", + "/src/", + "!/src/wip/", + "/Cargo.toml", + "/LICENSE*", + "/README.md", ] categories = [ "science" ] keywords = [ "physics" ] [dependencies] -paste = "1.0.5" glam = "^0.20" +paste = "^1.0" +# twofloat = "^0.4" -# itoa = "1.0.1" -# dtoa = "1.0.1" -# ryu = "1.0.9" -# pretty_dtoa = "0.3.0" -# num = "0.4.0" +# num = "^0.4" +# ryu = "^1.0" +# pretty_dtoa = "^0.3" [dev-dependencies] -float_eq = "0.6.0" -# approx = "*" +float_eq = "^0.7" +# approx = "^0.5" [build-dependencies] diff --git a/src/engine/body.rs b/src/engine/body.rs deleted file mode 100644 index c309f01..0000000 --- a/src/engine/body.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! - -use crate::{ - engine::Shape, - {Orientation, Position}, -}; - -/// A physical body -#[derive(Debug, Default)] -pub struct Body { - pub pos: Position, - pub orien: Orientation, - pub shape: Shape, -} diff --git a/src/lib.rs b/src/lib.rs index c0e7e5b..37d5329 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,8 +5,8 @@ mod auto_impls; pub mod constants; -// pub mod engine; pub mod math; pub mod units; +#[doc(inline)] pub use math::{Direction, Magnitude, Orientation, Position}; diff --git a/src/math/mod.rs b/src/math/mod.rs index dfda8c5..deb5d2a 100644 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -89,5 +89,5 @@ pub(crate) type V3 = glam::DVec3; /// Orientation pub type Orientation = glam::DQuat; -/// Rotatation Matrix +/// Rotation Matrix pub type Matrix = glam::DMat3; diff --git a/src/math/vectors.rs b/src/math/vectors.rs index 07dc029..93ba919 100644 --- a/src/math/vectors.rs +++ b/src/math/vectors.rs @@ -9,11 +9,9 @@ use super::{Magnitude, V3}; /// `Direction` is a vector quantity that represents a change in [`Position`]. /// -/// Position and Direction are two sides of the same coin. +/// `Position` and `Direction` are two sides of the same coin. /// We can also think of any position as a change of position from the -/// origin (Position::ZERO) to the target location. -// -// https://docs.rs/glam/*/glam/f64/struct.DVec3.html +/// origin (`Position::ZERO`) to the target location. #[repr(transparent)] #[derive(Debug, Copy, Clone, Default, PartialEq)] pub struct Direction { @@ -21,8 +19,7 @@ pub struct Direction { } /// A vector quantity representing a unique location in space. -/// -/// Being equal to [`Direction`], it has a different name for semantic purposes. +/// Semantic alias of [`Direction`]. pub type Position = Direction; /// # Methods diff --git a/src/wip/engine/body.rs b/src/wip/engine/body.rs new file mode 100644 index 0000000..8b97c99 --- /dev/null +++ b/src/wip/engine/body.rs @@ -0,0 +1,27 @@ +//! + +use crate::{ + engine::Shape, + {Orientation, Position}, +}; + +/// A physical body +#[derive(Debug, Default)] +pub struct Body { + pub pos: Position, + pub orien: Orientation, + pub shape: Shape, +} + +// WIP +// impl Body { +// pub fn new() -> Self { +// Self { +// pos: Position::ZERO, +// orien: Orientation::IDENTITY, +// shape: Shape::Sphere { +// radius: Length::new(0.0), +// }, +// } +// } +// } diff --git a/src/engine/mod.rs b/src/wip/engine/mod.rs similarity index 100% rename from src/engine/mod.rs rename to src/wip/engine/mod.rs diff --git a/src/engine/scene.rs b/src/wip/engine/scene.rs similarity index 100% rename from src/engine/scene.rs rename to src/wip/engine/scene.rs diff --git a/src/engine/shape.rs b/src/wip/engine/shape.rs similarity index 79% rename from src/engine/shape.rs rename to src/wip/engine/shape.rs index ca4b45f..4c1d2bf 100644 --- a/src/engine/shape.rs +++ b/src/wip/engine/shape.rs @@ -13,3 +13,9 @@ impl Default for Shape { } } } + +// RETHINK +// impl Shape { +// pub fn new() -> Self { +// } +// }