Merge pull request #378 from hannobraun/operations

Extract `fj-operations` from `fj-app`
This commit is contained in:
Hanno Braun 2022-03-17 18:13:55 +01:00 committed by GitHub
commit 71dda7a72a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 67 additions and 14 deletions

14
Cargo.lock generated
View File

@ -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"

View File

@ -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",
]

View File

@ -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"]

View File

@ -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,
};

32
fj-operations/Cargo.toml Normal file
View File

@ -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"

View File

@ -1,15 +1,23 @@
pub mod circle;
pub mod difference_2d;
pub mod group;
pub mod sketch;
pub mod sweep;
pub mod transform;
//! 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.
#![deny(missing_docs)]
mod circle;
mod difference_2d;
mod group;
mod sketch;
mod sweep;
mod transform;
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;