diff --git a/Cargo.lock b/Cargo.lock index e428d2605..2768effd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,12 +59,14 @@ dependencies = [ name = "all" version = "0.1.0" dependencies = [ + "color", "cuboid", "fj", "holes", "spacer", "split", "star", + "vertices-indices", ] [[package]] diff --git a/models/all/Cargo.toml b/models/all/Cargo.toml index 8963edec7..4e46b4fb2 100644 --- a/models/all/Cargo.toml +++ b/models/all/Cargo.toml @@ -6,6 +6,9 @@ edition = "2021" [dependencies.fj] path = "../../crates/fj" +[dependencies.color] +path = "../color" + [dependencies.cuboid] path = "../cuboid" @@ -20,3 +23,6 @@ path = "../split" [dependencies.star] path = "../star" + +[dependencies.vertices-indices] +path = "../vertices-indices" diff --git a/models/all/src/lib.rs b/models/all/src/lib.rs index d50aab1c3..59e1c5c7b 100644 --- a/models/all/src/lib.rs +++ b/models/all/src/lib.rs @@ -1,7 +1,9 @@ use fj::{ core::{ objects::Solid, - operations::{merge::Merge, transform::TransformObject}, + operations::{ + build::BuildSolid, merge::Merge, transform::TransformObject, + }, services::Services, }, math::{Scalar, Vector}, @@ -16,25 +18,27 @@ pub fn model(services: &mut Services) -> Solid { let axis = Vector::from([1., 1., 1.]).normalize(); let angle_rad = Scalar::PI / 6.; - let cuboid = cuboid::model([1., 2., 3.], services) - .translate(offset * 1., services) - .rotate(axis * angle_rad * 1., services); - let spacer = spacer::model(2., 1., 1., services) - .translate(offset * 2., services) - .rotate(axis * angle_rad * 2., services); - let star = star::model(5, 2., 1., 1., services) - .translate(offset * 3., services) - .rotate(axis * angle_rad * 3., services); - let split = split::model(1., 0.2, services) - .translate(offset * 4., services) - .rotate(axis * angle_rad * 4., services); - let holes = holes::model(0.5, services) - .translate(offset * 5., services) - .rotate(axis * angle_rad * 5., services); - - cuboid - .merge(&spacer) - .merge(&star) - .merge(&split) - .merge(&holes) + let models = [ + color::model(services), + cuboid::model([1., 2., 3.], services), + holes::model(0.5, services), + spacer::model(2., 1., 1., services), + split::model(1., 0.2, services), + star::model(5, 2., 1., 1., services), + vertices_indices::model(services), + ]; + + let mut all = Solid::empty(); + + for (i, model) in models.into_iter().enumerate() { + let f = i as f64; + + let model = model + .translate(offset * f, services) + .rotate(axis * angle_rad * f, services); + + all = all.merge(&model); + } + + all }