From 29051fabdcfeab22eb9648d558c4143bb343957b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 21 Dec 2023 21:17:32 +0100 Subject: [PATCH] Add `vertices-indices` model --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + models/vertices-indices/Cargo.toml | 7 +++++++ models/vertices-indices/src/lib.rs | 21 +++++++++++++++++++++ models/vertices-indices/src/main.rs | 8 ++++++++ 5 files changed, 44 insertions(+) create mode 100644 models/vertices-indices/Cargo.toml create mode 100644 models/vertices-indices/src/lib.rs create mode 100644 models/vertices-indices/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 75125075e..09dff2952 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3513,6 +3513,13 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vertices-indices" +version = "0.1.0" +dependencies = [ + "fj", +] + [[package]] name = "walkdir" version = "2.4.0" diff --git a/Cargo.toml b/Cargo.toml index cd3864d13..26b18ba89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ members = [ "models/spacer", "models/split", "models/star", + "models/vertices-indices", "tools/autolib", "tools/automator", diff --git a/models/vertices-indices/Cargo.toml b/models/vertices-indices/Cargo.toml new file mode 100644 index 000000000..33aff7f9a --- /dev/null +++ b/models/vertices-indices/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "vertices-indices" +version = "0.1.0" +edition = "2021" + +[dependencies.fj] +path = "../../crates/fj" diff --git a/models/vertices-indices/src/lib.rs b/models/vertices-indices/src/lib.rs new file mode 100644 index 000000000..15050e57e --- /dev/null +++ b/models/vertices-indices/src/lib.rs @@ -0,0 +1,21 @@ +use fj::core::{ + objects::{Shell, Solid}, + operations::{ + build::{BuildShell, BuildSolid}, + insert::Insert, + update::UpdateSolid, + }, + services::Services, + storage::Handle, +}; + +pub fn model(services: &mut Services) -> Handle { + Solid::empty() + .add_shells([Shell::from_vertices_and_indices( + [[0., 0., 0.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.]], + [[2, 1, 0], [0, 1, 3], [1, 2, 3], [2, 0, 3]], + services, + ) + .insert(services)]) + .insert(services) +} diff --git a/models/vertices-indices/src/main.rs b/models/vertices-indices/src/main.rs new file mode 100644 index 000000000..2587df58c --- /dev/null +++ b/models/vertices-indices/src/main.rs @@ -0,0 +1,8 @@ +use fj::{core::services::Services, handle_model}; + +fn main() -> fj::Result { + let mut services = Services::new(); + let model = vertices_indices::model(&mut services); + handle_model(model, services)?; + Ok(()) +}