Skip to content

Commit

Permalink
Use convenient syntax in spacer model
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Mar 17, 2022
1 parent 222bb28 commit fea00dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions models/spacer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::HashMap;

use fj::prelude::*;

#[no_mangle]
pub extern "C" fn model(args: &HashMap<String, String>) -> fj::Shape {
let outer = args
Expand All @@ -22,10 +24,8 @@ pub extern "C" fn model(args: &HashMap<String, String>) -> fj::Shape {
fj::Circle::from_radius(outer).with_color([0, 0, 255, 255]);
let inner_edge = fj::Circle::from_radius(inner);

let footprint =
fj::Difference2d::from_objects(outer_edge.into(), inner_edge.into());

let spacer = fj::Sweep::from_shape_and_length(footprint.into(), height);
let footprint = outer_edge.difference(&inner_edge);
let spacer = footprint.sweep(height);

spacer.into()
}

0 comments on commit fea00dd

Please sign in to comment.