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

Start cleaning up builder API #1433

Merged
merged 25 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
69eaf76
Update documentation of `CurveBuilder`
hannobraun Dec 9, 2022
bbe2f6d
Refactor
hannobraun Dec 9, 2022
257194f
Remove unused vertex builder methods
hannobraun Dec 9, 2022
d70e3fa
Remove unused edge builder methods
hannobraun Dec 9, 2022
7fb7f1f
Update `HalfEdgeBuilder` method to latest style
hannobraun Dec 9, 2022
76d0caa
Update `HalfEdgeBuilder` method to latest style
hannobraun Dec 9, 2022
2fbfa9b
Refactor
hannobraun Dec 9, 2022
4bfdcd6
Update `HalfEdgeBuilder` method to latest style
hannobraun Dec 9, 2022
2922b70
Update documentation of `HalfEdgeBuilder`
hannobraun Dec 9, 2022
0befaef
Remove unused trait bound
hannobraun Dec 9, 2022
503338d
Refactor
hannobraun Dec 9, 2022
d103908
Improve formatting
hannobraun Dec 9, 2022
2d4ca36
Update variable names
hannobraun Dec 9, 2022
466d45a
Simplify code
hannobraun Dec 9, 2022
2065919
Refactor
hannobraun Dec 9, 2022
12a8ad3
Refactor
hannobraun Dec 9, 2022
5d5af31
Make variable name more explicit
hannobraun Dec 9, 2022
f7e9fc5
Refactor
hannobraun Dec 9, 2022
88a700f
Remove redundant code
hannobraun Dec 9, 2022
886061a
Simplify loop
hannobraun Dec 9, 2022
3f0d1cc
Simplify some places that create `PartialHalfEdge`
hannobraun Dec 9, 2022
fabf11b
Modify test not to rely on intermediate `build`s
hannobraun Dec 9, 2022
ed6b2f2
Simplify half-edge construction in test
hannobraun Dec 9, 2022
55bef2a
Simplify half-edge construction in `CycleBuilder`
hannobraun Dec 9, 2022
25d22b3
Simplify half-edge construction in `CycleBuilder`
hannobraun Dec 9, 2022
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
121 changes: 25 additions & 96 deletions crates/fj-kernel/src/algorithms/intersect/curve_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,11 @@ impl CurveEdgeIntersection {

#[cfg(test)]
mod tests {
use std::array;

use fj_interop::ext::ArrayExt;
use fj_math::Point;

use crate::{
builder::{CurveBuilder, HalfEdgeBuilder},
objects::Vertex,
partial::{
Partial, PartialCurve, PartialGlobalEdge, PartialHalfEdge,
PartialObject,
},
partial::{Partial, PartialCurve, PartialHalfEdge, PartialObject},
services::Services,
};

Expand All @@ -103,29 +96,13 @@ mod tests {
curve.update_as_u_axis();
let curve = curve.build(&mut services.objects);
let half_edge = {
let vertices = array::from_fn(|_| Partial::<Vertex>::new());
let global_curve = {
let [vertex, _] = &vertices;
vertex.read().curve.read().global_form.clone()
};
let global_vertices = vertices.each_ref_ext().map(|vertex| {
vertex.read().surface_form.read().global_form.clone()
});

let half_edge = PartialHalfEdge {
vertices,
global_form: Partial::from_partial(PartialGlobalEdge {
curve: global_curve,
vertices: global_vertices,
}),
};
let mut half_edge = PartialHalfEdge::default();
half_edge.update_as_line_segment_from_points(
surface,
[[1., -1.], [1., 1.]],
);

half_edge
.update_as_line_segment_from_points(
surface,
[[1., -1.], [1., 1.]],
)
.build(&mut services.objects)
half_edge.build(&mut services.objects)
};

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);
Expand All @@ -152,29 +129,13 @@ mod tests {
curve.update_as_u_axis();
let curve = curve.build(&mut services.objects);
let half_edge = {
let vertices = array::from_fn(|_| Partial::<Vertex>::new());
let global_curve = {
let [vertex, _] = &vertices;
vertex.read().curve.read().global_form.clone()
};
let global_vertices = vertices.each_ref_ext().map(|vertex| {
vertex.read().surface_form.read().global_form.clone()
});

let half_edge = PartialHalfEdge {
vertices,
global_form: Partial::from_partial(PartialGlobalEdge {
curve: global_curve,
vertices: global_vertices,
}),
};
let mut half_edge = PartialHalfEdge::default();
half_edge.update_as_line_segment_from_points(
surface,
[[-1., -1.], [-1., 1.]],
);

half_edge
.update_as_line_segment_from_points(
surface,
[[-1., -1.], [-1., 1.]],
)
.build(&mut services.objects)
half_edge.build(&mut services.objects)
};

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);
Expand All @@ -201,29 +162,13 @@ mod tests {
curve.update_as_u_axis();
let curve = curve.build(&mut services.objects);
let half_edge = {
let vertices = array::from_fn(|_| Partial::<Vertex>::new());
let global_curve = {
let [vertex, _] = &vertices;
vertex.read().curve.read().global_form.clone()
};
let global_vertices = vertices.each_ref_ext().map(|vertex| {
vertex.read().surface_form.read().global_form.clone()
});

let half_edge = PartialHalfEdge {
vertices,
global_form: Partial::from_partial(PartialGlobalEdge {
curve: global_curve,
vertices: global_vertices,
}),
};
let mut half_edge = PartialHalfEdge::default();
half_edge.update_as_line_segment_from_points(
surface,
[[-1., -1.], [1., -1.]],
);

half_edge
.update_as_line_segment_from_points(
surface,
[[-1., -1.], [1., -1.]],
)
.build(&mut services.objects)
half_edge.build(&mut services.objects)
};

let intersection = CurveEdgeIntersection::compute(&curve, &half_edge);
Expand All @@ -245,29 +190,13 @@ mod tests {
curve.update_as_u_axis();
let curve = curve.build(&mut services.objects);
let half_edge = {
let vertices = array::from_fn(|_| Partial::<Vertex>::new());
let global_curve = {
let [vertex, _] = &vertices;
vertex.read().curve.read().global_form.clone()
};
let global_vertices = vertices.each_ref_ext().map(|vertex| {
vertex.read().surface_form.read().global_form.clone()
});

let half_edge = PartialHalfEdge {
vertices,
global_form: Partial::from_partial(PartialGlobalEdge {
curve: global_curve,
vertices: global_vertices,
}),
};
let mut half_edge = PartialHalfEdge::default();
half_edge.update_as_line_segment_from_points(
surface,
[[-1., 0.], [1., 0.]],
);

half_edge
.update_as_line_segment_from_points(
surface,
[[-1., 0.], [1., 0.]],
)
.build(&mut services.objects)
half_edge.build(&mut services.objects)
};

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