Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand operations API; replace HalfEdgeBuilder #1738

Merged
merged 29 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1bda47c
Add `BuildHalfEdge`
hannobraun Mar 30, 2023
2513d3b
Make use of `BuildHalfEdge::circle`
hannobraun Mar 30, 2023
b626792
Remove unused `HalfEdgeBuilder::circle`
hannobraun Mar 30, 2023
c5a36b1
Add `BuildHalfEdge::line_segment`
hannobraun Mar 30, 2023
5220872
Make use of `BuildHalfEdge::line_segment`
hannobraun Mar 30, 2023
8cd7040
Add `BuildCycle`
hannobraun Mar 28, 2023
bd286c8
Add `UpdateCycle::add_half_edges`
hannobraun Mar 30, 2023
c83fc71
Refactor code to prepare for follow-on change
hannobraun Mar 30, 2023
d9c14b5
Replace use of `HalfEdgeBuilder`/`CycleBuilder`
hannobraun Mar 30, 2023
d5888e7
Add `BuildHalfEdge::arc`
hannobraun Mar 30, 2023
b85b4c0
Replace use of `HalfEdgeBuilder`/`CycleBuilder`
hannobraun Mar 30, 2023
00d5bfb
Remove unused `HalfEdgeBuilder::arc`
hannobraun Mar 30, 2023
db75ff6
Refactor code to simplify it
hannobraun Mar 30, 2023
289f070
Add `UpdateHalfEdge::update_start_vertex`
hannobraun Mar 30, 2023
841f9ba
Replace use of `HalfEdgeBuilder`
hannobraun Mar 30, 2023
57654a0
Update variable name
hannobraun Mar 30, 2023
093c797
Update variable name
hannobraun Mar 30, 2023
2ab0244
Add new `BuildHalfEdge` method
hannobraun Mar 30, 2023
c2d9992
Replace use of `HalfEdgeBuilder`
hannobraun Mar 30, 2023
3d980be
Update variable name
hannobraun Mar 30, 2023
8a0dda9
Remove unused `HalfEdgeBuilder` method
hannobraun Mar 30, 2023
3adefe4
Refactor code to prepare for follow-on change
hannobraun Mar 30, 2023
e72e288
Replace use of `HalfEdgeBuilder`
hannobraun Mar 30, 2023
205d565
Remove unused `HalfEdgeBuilder::line_segment`
hannobraun Mar 30, 2023
7a4e0d6
Replace use of `HalfEdgeBuilder`
hannobraun Mar 30, 2023
b3c6ae9
Remove unused `HalfEdgeBuilder` methods
hannobraun Mar 30, 2023
2ca7945
Remove unused `CycleBuilder` method
hannobraun Mar 30, 2023
fe69359
Clean up `CycleBuilder`
hannobraun Mar 30, 2023
da6cc2e
Remove unused `HalfEdgeBuilder`
hannobraun Mar 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions crates/fj-kernel/src/algorithms/approx/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ mod tests {

use crate::{
algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint},
builder::HalfEdgeBuilder,
geometry::{curve::GlobalPath, surface::SurfaceGeometry},
objects::Surface,
operations::Insert,
objects::{HalfEdge, Surface},
operations::{BuildHalfEdge, Insert},
services::Services,
};

Expand All @@ -274,9 +273,11 @@ mod tests {
let mut services = Services::new();

let surface = services.objects.surfaces.xz_plane();
let half_edge =
HalfEdgeBuilder::line_segment([[1., 1.], [2., 1.]], None)
.build(&mut services.objects);
let half_edge = HalfEdge::line_segment(
[[1., 1.], [2., 1.]],
None,
&mut services.objects,
);

let tolerance = 1.;
let approx = (&half_edge, surface.deref()).approx(tolerance);
Expand All @@ -293,9 +294,11 @@ mod tests {
v: [0., 0., 1.].into(),
})
.insert(&mut services.objects);
let half_edge =
HalfEdgeBuilder::line_segment([[1., 1.], [2., 1.]], None)
.build(&mut services.objects);
let half_edge = HalfEdge::line_segment(
[[1., 1.], [2., 1.]],
None,
&mut services.objects,
);

let tolerance = 1.;
let approx = (&half_edge, surface.deref()).approx(tolerance);
Expand All @@ -315,11 +318,11 @@ mod tests {
v: [0., 0., 1.].into(),
})
.insert(&mut services.objects);
let half_edge = HalfEdgeBuilder::line_segment(
let half_edge = HalfEdge::line_segment(
[[0., 1.], [TAU, 1.]],
Some(range.boundary),
)
.build(&mut services.objects);
&mut services.objects,
);

let tolerance = 1.;
let approx = (&half_edge, surface.deref()).approx(tolerance);
Expand All @@ -343,8 +346,7 @@ mod tests {
let mut services = Services::new();

let surface = services.objects.surfaces.xz_plane();
let half_edge =
HalfEdgeBuilder::circle(1.).build(&mut services.objects);
let half_edge = HalfEdge::circle(1., &mut services.objects);

let tolerance = 1.;
let approx = (&half_edge, surface.deref()).approx(tolerance);
Expand Down
35 changes: 22 additions & 13 deletions crates/fj-kernel/src/algorithms/intersect/curve_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ mod tests {
use fj_math::Point;

use crate::{
builder::HalfEdgeBuilder, geometry::curve::Curve, services::Services,
geometry::curve::Curve, objects::HalfEdge, operations::BuildHalfEdge,
services::Services,
};

use super::CurveEdgeIntersection;
Expand All @@ -82,9 +83,11 @@ mod tests {
let mut services = Services::new();

let curve = Curve::u_axis();
let half_edge =
HalfEdgeBuilder::line_segment([[1., -1.], [1., 1.]], None)
.build(&mut services.objects);
let half_edge = HalfEdge::line_segment(
[[1., -1.], [1., 1.]],
None,
&mut services.objects,
);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand All @@ -101,9 +104,11 @@ mod tests {
let mut services = Services::new();

let curve = Curve::u_axis();
let half_edge =
HalfEdgeBuilder::line_segment([[-1., -1.], [-1., 1.]], None)
.build(&mut services.objects);
let half_edge = HalfEdge::line_segment(
[[-1., -1.], [-1., 1.]],
None,
&mut services.objects,
);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand All @@ -120,9 +125,11 @@ mod tests {
let mut services = Services::new();

let curve = Curve::u_axis();
let half_edge =
HalfEdgeBuilder::line_segment([[-1., -1.], [1., -1.]], None)
.build(&mut services.objects);
let half_edge = HalfEdge::line_segment(
[[-1., -1.], [1., -1.]],
None,
&mut services.objects,
);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand All @@ -134,9 +141,11 @@ mod tests {
let mut services = Services::new();

let curve = Curve::u_axis();
let half_edge =
HalfEdgeBuilder::line_segment([[-1., 0.], [1., 0.]], None)
.build(&mut services.objects);
let half_edge = HalfEdge::line_segment(
[[-1., 0.], [1., 0.]],
None,
&mut services.objects,
);

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);

Expand Down
10 changes: 8 additions & 2 deletions crates/fj-kernel/src/algorithms/intersect/curve_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,14 @@ mod tests {
];

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon(exterior_points))
.with_interior(CycleBuilder::polygon(interior_points))
.with_exterior(CycleBuilder::polygon(
exterior_points,
&mut services.objects,
))
.with_interior(CycleBuilder::polygon(
interior_points,
&mut services.objects,
))
.build(&mut services.objects);

let expected =
Expand Down
10 changes: 8 additions & 2 deletions crates/fj-kernel/src/algorithms/intersect/face_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ mod tests {
]
.map(|surface| {
FaceBuilder::new(surface)
.with_exterior(CycleBuilder::polygon(points))
.with_exterior(CycleBuilder::polygon(
points,
&mut services.objects,
))
.build(&mut services.objects)
});

Expand All @@ -112,7 +115,10 @@ mod tests {
];
let [a, b] = surfaces.clone().map(|surface| {
FaceBuilder::new(surface)
.with_exterior(CycleBuilder::polygon(points))
.with_exterior(CycleBuilder::polygon(
points,
&mut services.objects,
))
.build(&mut services.objects)
});

Expand Down
76 changes: 32 additions & 44 deletions crates/fj-kernel/src/algorithms/intersect/face_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[1., 1.],
[0., 2.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [1., 1.], [0., 2.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([2., 1.]);

Expand All @@ -164,11 +163,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[2., 1.],
[0., 2.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [2., 1.], [0., 2.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 1.]);

Expand All @@ -184,11 +182,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[4., 2.],
[0., 4.],
[0., 0.],
]))
.with_exterior(CycleBuilder::polygon(
[[4., 2.], [0., 4.], [0., 0.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 2.]);

Expand All @@ -204,12 +201,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[2., 1.],
[3., 0.],
[3., 4.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [2., 1.], [3., 0.], [3., 4.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 1.]);

Expand All @@ -225,12 +220,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[2., 1.],
[3., 1.],
[0., 2.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [2., 1.], [3., 1.], [0., 2.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 1.]);

Expand All @@ -246,13 +239,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[2., 1.],
[3., 1.],
[4., 0.],
[4., 5.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [2., 1.], [3., 1.], [4., 0.], [4., 5.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 1.]);

Expand All @@ -268,11 +258,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[2., 0.],
[0., 1.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [2., 0.], [0., 1.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 0.]);

Expand All @@ -294,11 +283,10 @@ mod tests {
let mut services = Services::new();

let face = FaceBuilder::new(services.objects.surfaces.xy_plane())
.with_exterior(CycleBuilder::polygon([
[0., 0.],
[1., 0.],
[0., 1.],
]))
.with_exterior(CycleBuilder::polygon(
[[0., 0.], [1., 0.], [0., 1.]],
&mut services.objects,
))
.build(&mut services.objects);
let point = Point::from([1., 0.]);

Expand Down
Loading