Skip to content

Commit

Permalink
Return Handle<Surface> from surface_from_uv
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Feb 27, 2024
1 parent 49f8ae9 commit 0dddf0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions crates/fj-core/src/operations/build/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait BuildSurface {
let (u, u_line) = GlobalPath::line_from_points([a, b]);
let v = c - a;

let surface = Surface::surface_from_uv(u, v).insert(core);
let surface = Surface::surface_from_uv(u, v, core);

let points_surface = {
let [a, b] =
Expand All @@ -41,12 +41,13 @@ pub trait BuildSurface {
fn surface_from_uv(
u: impl Into<GlobalPath>,
v: impl Into<Vector<3>>,
) -> Surface {
core: &mut Core,
) -> Handle<Surface> {
let geometry = SurfaceGeometry {
u: u.into(),
v: v.into(),
};
Surface::new(geometry)
Surface::new(geometry).insert(core)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/fj-core/src/operations/sweep/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use fj_math::{Circle, Line, Vector};
use crate::{
geometry::{GlobalPath, SurfaceGeometry, SurfacePath},
objects::Surface,
operations::{build::BuildSurface, insert::Insert},
operations::build::BuildSurface,
storage::Handle,
Core,
};
Expand Down Expand Up @@ -84,6 +84,6 @@ impl SweepSurfacePath for SurfacePath {
}
};

Surface::surface_from_uv(u, path).insert(core)
Surface::surface_from_uv(u, path, core)
}
}
24 changes: 12 additions & 12 deletions crates/fj-core/src/validate/solid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ mod tests {
Surface::surface_from_uv(
GlobalPath::circle_from_radius(1.),
[0., 1., 1.],
)
.insert(&mut core),
&mut core,
),
Region::new(
Cycle::new(vec![
HalfEdge::circle([0., 0.], 1., &mut core).insert(&mut core)
Expand Down Expand Up @@ -258,17 +258,17 @@ mod tests {
Surface::surface_from_uv(
GlobalPath::circle_from_radius(1.),
[0., 1., 1.],
)
.insert(&mut core),
&mut core,
),
shared_region.clone(),
)
.insert(&mut core),
Face::new(
Surface::surface_from_uv(
GlobalPath::circle_from_radius(1.),
[0., 0., 1.],
)
.insert(&mut core),
&mut core,
),
shared_region.clone(),
)
.insert(&mut core),
Expand Down Expand Up @@ -307,17 +307,17 @@ mod tests {
Surface::surface_from_uv(
GlobalPath::circle_from_radius(1.),
[0., 1., 1.],
)
.insert(&mut core),
&mut core,
),
Region::new(shared_cycle.clone(), vec![]).insert(&mut core),
)
.insert(&mut core),
Face::new(
Surface::surface_from_uv(
GlobalPath::circle_from_radius(1.),
[0., 0., 1.],
)
.insert(&mut core),
&mut core,
),
Region::new(shared_cycle, vec![]).insert(&mut core),
)
.insert(&mut core),
Expand Down Expand Up @@ -352,8 +352,8 @@ mod tests {
Surface::surface_from_uv(
GlobalPath::circle_from_radius(1.),
[0., 0., 1.],
)
.insert(&mut core),
&mut core,
),
Region::new(
Cycle::new(vec![shared_edge.clone()]).insert(&mut core),
vec![Cycle::new(vec![shared_edge.clone()]).insert(&mut core)],
Expand Down

0 comments on commit 0dddf0d

Please sign in to comment.