Skip to content

Commit

Permalink
Pass surface directly into method that needs it
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 30, 2022
1 parent 1ced108 commit cb46029
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
14 changes: 10 additions & 4 deletions crates/fj-kernel/src/algorithms/sweep/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ mod tests {

let surface = services.objects.surfaces.xy_plane();
let solid = Sketch::builder()
.with_surface(surface.clone())
.with_polygon_from_points(TRIANGLE, &mut services.objects)
.with_polygon_from_points(
surface.clone(),
TRIANGLE,
&mut services.objects,
)
.build(&mut services.objects)
.sweep(UP, &mut services.objects);

Expand Down Expand Up @@ -148,8 +151,11 @@ mod tests {

let surface = services.objects.surfaces.xy_plane();
let solid = Sketch::builder()
.with_surface(surface.clone())
.with_polygon_from_points(TRIANGLE, &mut services.objects)
.with_polygon_from_points(
surface.clone(),
TRIANGLE,
&mut services.objects,
)
.build(&mut services.objects)
.sweep(DOWN, &mut services.objects);

Expand Down
7 changes: 2 additions & 5 deletions crates/fj-kernel/src/builder/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@ impl SketchBuilder {
/// Construct a polygon from a list of points
pub fn with_polygon_from_points(
mut self,
surface: Handle<Surface>,
points: impl IntoIterator<Item = impl Into<Point<2>>>,
objects: &mut Service<Objects>,
) -> Self {
let surface = self
.surface
.as_ref()
.expect("Can't build `Sketch` without `Surface`");
self.faces.extend([Face::partial()
.with_exterior_polygon_from_points(surface.clone(), points)
.with_exterior_polygon_from_points(surface, points)
.build(objects)
.insert(objects)]);
self
Expand Down

0 comments on commit cb46029

Please sign in to comment.