Skip to content

Commit

Permalink
Merge pull request #2192 from hannobraun/instance
Browse files Browse the repository at this point in the history
Use `fj_core::Instance` in more places
  • Loading branch information
hannobraun authored Feb 5, 2024
2 parents 0198586 + 830b87e commit 491c66d
Show file tree
Hide file tree
Showing 41 changed files with 538 additions and 596 deletions.
28 changes: 8 additions & 20 deletions crates/fj-core/src/algorithms/intersect/curve_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ mod tests {
let mut core = Instance::new();

let path = SurfacePath::u_axis();
let edge = HalfEdge::line_segment(
[[1., -1.], [1., 1.]],
None,
&mut core.services,
);
let edge =
HalfEdge::line_segment([[1., -1.], [1., 1.]], None, &mut core);

let intersection = CurveEdgeIntersection::compute(&path, &edge);

Expand All @@ -104,11 +101,8 @@ mod tests {
let mut core = Instance::new();

let path = SurfacePath::u_axis();
let edge = HalfEdge::line_segment(
[[-1., -1.], [-1., 1.]],
None,
&mut core.services,
);
let edge =
HalfEdge::line_segment([[-1., -1.], [-1., 1.]], None, &mut core);

let intersection = CurveEdgeIntersection::compute(&path, &edge);

Expand All @@ -125,11 +119,8 @@ mod tests {
let mut core = Instance::new();

let path = SurfacePath::u_axis();
let edge = HalfEdge::line_segment(
[[-1., -1.], [1., -1.]],
None,
&mut core.services,
);
let edge =
HalfEdge::line_segment([[-1., -1.], [1., -1.]], None, &mut core);

let intersection = CurveEdgeIntersection::compute(&path, &edge);

Expand All @@ -141,11 +132,8 @@ mod tests {
let mut core = Instance::new();

let path = SurfacePath::u_axis();
let edge = HalfEdge::line_segment(
[[-1., 0.], [1., 0.]],
None,
&mut core.services,
);
let edge =
HalfEdge::line_segment([[-1., 0.], [1., 0.]], None, &mut core);

let intersection = CurveEdgeIntersection::compute(&path, &edge);

Expand Down
30 changes: 14 additions & 16 deletions crates/fj-core/src/algorithms/intersect/curve_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,21 @@ mod tests {
[ 1., -1.],
];

let face = Face::unbound(
core.services.objects.surfaces.xy_plane(),
&mut core.services,
)
.update_region(|region| {
region
.update_exterior(|_| {
Cycle::polygon(exterior_points, &mut core.services)
let face =
Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core)
.update_region(|region| {
region
.update_exterior(|_| {
Cycle::polygon(exterior_points, &mut core)
.insert(&mut core.services)
})
.add_interiors([Cycle::polygon(
interior_points,
&mut core,
)
.insert(&mut core.services)])
.insert(&mut core.services)
})
.add_interiors([Cycle::polygon(
interior_points,
&mut core.services,
)
.insert(&mut core.services)])
.insert(&mut core.services)
});
});

let expected =
CurveFaceIntersection::from_intervals([[[1.], [2.]], [[4.], [5.]]]);
Expand Down
8 changes: 4 additions & 4 deletions crates/fj-core/src/algorithms/intersect/face_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ mod tests {
core.services.objects.surfaces.xz_plane(),
]
.map(|surface| {
Face::unbound(surface, &mut core.services).update_region(|region| {
Face::unbound(surface, &mut core).update_region(|region| {
region
.update_exterior(|_| {
Cycle::polygon(points, &mut core.services)
Cycle::polygon(points, &mut core)
.insert(&mut core.services)
})
.insert(&mut core.services)
Expand All @@ -120,10 +120,10 @@ mod tests {
core.services.objects.surfaces.xz_plane(),
];
let [a, b] = surfaces.clone().map(|surface| {
Face::unbound(surface, &mut core.services).update_region(|region| {
Face::unbound(surface, &mut core).update_region(|region| {
region
.update_exterior(|_| {
Cycle::polygon(points, &mut core.services)
Cycle::polygon(points, &mut core)
.insert(&mut core.services)
})
.insert(&mut core.services)
Expand Down
Loading

0 comments on commit 491c66d

Please sign in to comment.