From a6bf96ed441736bd8e5d2e4c5515608fbffa8459 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 17 Mar 2022 17:51:51 +0100 Subject: [PATCH 1/4] Extract `fj-operations` from `fj-app` --- Cargo.lock | 14 +++++++- Cargo.toml | 2 ++ fj-app/Cargo.toml | 8 ++--- fj-app/src/main.rs | 3 +- fj-operations/Cargo.toml | 32 +++++++++++++++++++ .../src}/circle.rs | 0 .../src}/difference_2d.rs | 0 .../operations => fj-operations/src}/group.rs | 0 .../mod.rs => fj-operations/src/lib.rs | 0 .../src}/sketch.rs | 0 .../operations => fj-operations/src}/sweep.rs | 0 .../src}/transform.rs | 0 12 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 fj-operations/Cargo.toml rename {fj-app/src/operations => fj-operations/src}/circle.rs (100%) rename {fj-app/src/operations => fj-operations/src}/difference_2d.rs (100%) rename {fj-app/src/operations => fj-operations/src}/group.rs (100%) rename fj-app/src/operations/mod.rs => fj-operations/src/lib.rs (100%) rename {fj-app/src/operations => fj-operations/src}/sketch.rs (100%) rename {fj-app/src/operations => fj-operations/src}/sweep.rs (100%) rename {fj-app/src/operations => fj-operations/src}/transform.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 5de234255..485132769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -631,8 +631,8 @@ dependencies = [ "figment", "fj", "fj-debug", - "fj-kernel", "fj-math", + "fj-operations", "futures", "libloading", "nalgebra", @@ -684,6 +684,18 @@ dependencies = [ "parry3d-f64", ] +[[package]] +name = "fj-operations" +version = "0.5.0" +dependencies = [ + "fj", + "fj-debug", + "fj-kernel", + "fj-math", + "nalgebra", + "parry3d-f64", +] + [[package]] name = "flate2" version = "1.0.22" diff --git a/Cargo.toml b/Cargo.toml index 961bb9076..b0c38349e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "fj-debug", "fj-kernel", "fj-math", + "fj-operations", "models/cuboid", "models/group", @@ -19,4 +20,5 @@ default-members = [ "fj-debug", "fj-kernel", "fj-math", + "fj-operations", ] diff --git a/fj-app/Cargo.toml b/fj-app/Cargo.toml index 663310e2e..51a6df9fe 100644 --- a/fj-app/Cargo.toml +++ b/fj-app/Cargo.toml @@ -42,14 +42,14 @@ path = "../fj" version = "0.5.0" path = "../fj-debug" -[dependencies.fj-kernel] -version = "0.5.0" -path = "../fj-kernel" - [dependencies.fj-math] version = "0.5.0" path = "../fj-math" +[dependencies.fj-operations] +version = "0.5.0" +path = "../fj-operations" + [dependencies.serde] version = "1.0.136" features = ["derive"] diff --git a/fj-app/src/main.rs b/fj-app/src/main.rs index 39a547cf4..6b5819866 100644 --- a/fj-app/src/main.rs +++ b/fj-app/src/main.rs @@ -5,7 +5,6 @@ mod graphics; mod input; mod mesh; mod model; -mod operations; mod window; use std::collections::HashSet; @@ -15,6 +14,7 @@ use std::{collections::HashMap, sync::mpsc, time::Instant}; use fj_debug::DebugInfo; use fj_math::Scalar; +use fj_operations::ToShape as _; use futures::executor::block_on; use notify::Watcher as _; use tracing::trace; @@ -32,7 +32,6 @@ use crate::{ graphics::{DrawConfig, Renderer}, mesh::MeshMaker, model::Model, - operations::ToShape as _, window::Window, }; diff --git a/fj-operations/Cargo.toml b/fj-operations/Cargo.toml new file mode 100644 index 000000000..023bede6e --- /dev/null +++ b/fj-operations/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "fj-operations" +version = "0.5.0" +edition = "2021" + +description = "The world needs another CAD program." +readme = "../README.md" +repository = "https://github.com/hannobraun/fornjot" +license = "0BSD" +keywords = ["cad", "programmatic", "code-cad"] +categories = ["mathematics"] + + +[dependencies] +nalgebra = "0.30.0" +parry3d-f64 = "0.8.0" + +[dependencies.fj] +version = "0.5.0" +path = "../fj" + +[dependencies.fj-math] +version = "0.5.0" +path = "../fj-math" + +[dependencies.fj-debug] +version = "0.5.0" +path = "../fj-debug" + +[dependencies.fj-kernel] +version = "0.5.0" +path = "../fj-kernel" diff --git a/fj-app/src/operations/circle.rs b/fj-operations/src/circle.rs similarity index 100% rename from fj-app/src/operations/circle.rs rename to fj-operations/src/circle.rs diff --git a/fj-app/src/operations/difference_2d.rs b/fj-operations/src/difference_2d.rs similarity index 100% rename from fj-app/src/operations/difference_2d.rs rename to fj-operations/src/difference_2d.rs diff --git a/fj-app/src/operations/group.rs b/fj-operations/src/group.rs similarity index 100% rename from fj-app/src/operations/group.rs rename to fj-operations/src/group.rs diff --git a/fj-app/src/operations/mod.rs b/fj-operations/src/lib.rs similarity index 100% rename from fj-app/src/operations/mod.rs rename to fj-operations/src/lib.rs diff --git a/fj-app/src/operations/sketch.rs b/fj-operations/src/sketch.rs similarity index 100% rename from fj-app/src/operations/sketch.rs rename to fj-operations/src/sketch.rs diff --git a/fj-app/src/operations/sweep.rs b/fj-operations/src/sweep.rs similarity index 100% rename from fj-app/src/operations/sweep.rs rename to fj-operations/src/sweep.rs diff --git a/fj-app/src/operations/transform.rs b/fj-operations/src/transform.rs similarity index 100% rename from fj-app/src/operations/transform.rs rename to fj-operations/src/transform.rs From b1c3b2c2a27ca89fe84d37a02f2419d429b55e79 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 17 Mar 2022 18:02:43 +0100 Subject: [PATCH 2/4] Simplify public API of `fj-operations` --- fj-operations/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fj-operations/src/lib.rs b/fj-operations/src/lib.rs index 0c180610e..680d050f0 100644 --- a/fj-operations/src/lib.rs +++ b/fj-operations/src/lib.rs @@ -1,9 +1,9 @@ -pub mod circle; -pub mod difference_2d; -pub mod group; -pub mod sketch; -pub mod sweep; -pub mod transform; +mod circle; +mod difference_2d; +mod group; +mod sketch; +mod sweep; +mod transform; use fj_debug::DebugInfo; use fj_kernel::shape::Shape; From ef3bed51f099ae6ce1d81ef1a70c6825bc39e3fb Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 17 Mar 2022 18:04:01 +0100 Subject: [PATCH 3/4] Update documentation of `fj-operations` --- fj-operations/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fj-operations/src/lib.rs b/fj-operations/src/lib.rs index 680d050f0..8be50fb9b 100644 --- a/fj-operations/src/lib.rs +++ b/fj-operations/src/lib.rs @@ -1,3 +1,9 @@ +//! Connection between the Fornjot kernel and Fornjot models +//! +//! Fornjot models use the [`fj`] crate to define a shape. This crate provides +//! the connection between [`fj`] and the Fornjot kernel. It translates those +//! operations into terms the kernel can understand. + mod circle; mod difference_2d; mod group; @@ -9,7 +15,7 @@ use fj_debug::DebugInfo; use fj_kernel::shape::Shape; use fj_math::{Aabb, Scalar}; -/// Implemented by all shapes +/// Implemented for all operations from the [`fj`] crate pub trait ToShape { /// Compute the boundary representation of the shape fn to_shape(&self, tolerance: Scalar, debug: &mut DebugInfo) -> Shape; From 150e9d04986fe318138acf219e2e89dafcd1f2b2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 17 Mar 2022 18:04:11 +0100 Subject: [PATCH 4/4] Deny missing documentation in `fj-operations` --- fj-operations/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fj-operations/src/lib.rs b/fj-operations/src/lib.rs index 8be50fb9b..1632f444d 100644 --- a/fj-operations/src/lib.rs +++ b/fj-operations/src/lib.rs @@ -4,6 +4,8 @@ //! the connection between [`fj`] and the Fornjot kernel. It translates those //! operations into terms the kernel can understand. +#![deny(missing_docs)] + mod circle; mod difference_2d; mod group;