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

Convert CycleBuilder into a builder struct #1692

Merged
merged 25 commits into from
Mar 17, 2023
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
e112160
Accept `HalfEdgeBuilder` in `Cycle::add_half_edge`
hannobraun Mar 15, 2023
374489a
Refactor code to make it more explicit
hannobraun Mar 15, 2023
a3b769c
Remove unused return value
hannobraun Mar 15, 2023
44f504a
Replace use of `ObjectArgument`
hannobraun Mar 15, 2023
096e8c6
Add `CycleBuilder2`
hannobraun Mar 15, 2023
6dfe07a
Update doc comment
hannobraun Mar 15, 2023
2ef8ed0
Replace uses of `CycleBuilder` with `CycleBuilder2`
hannobraun Mar 15, 2023
8e7c100
Remove unused builder method
hannobraun Mar 15, 2023
67a9536
Remove redundant blocks
hannobraun Mar 15, 2023
18238c1
Remove unused return value
hannobraun Mar 17, 2023
d3a61ca
Remove redundant variable
hannobraun Mar 17, 2023
30c1053
Update name of type parameter
hannobraun Mar 17, 2023
decb4cc
Refactor code to prepare for follow-on change
hannobraun Mar 17, 2023
c5c47d1
Replace use of `ObjectArgument`
hannobraun Mar 17, 2023
4d7b43d
Remove unused `ObjectArgument` infrastructure
hannobraun Mar 17, 2023
11a5a29
Add `CycleBuilder2::connect_to_edges`
hannobraun Mar 17, 2023
da0c50f
Replace use of `CycleBuilder`
hannobraun Mar 17, 2023
74596f2
Remove unused builder method
hannobraun Mar 17, 2023
9769db7
Add `CycleBuilder2::new`
hannobraun Mar 17, 2023
d43696b
Add `CycleBuilder2::add_half_edge`
hannobraun Mar 17, 2023
4074b3c
Replace use of `CycleBuilder`
hannobraun Mar 17, 2023
8148770
Replace use of `CycleBuilder`
hannobraun Mar 17, 2023
1934d50
Replace use of `CycleBuilder`
hannobraun Mar 17, 2023
c51a805
Remove unused trait `CycleBuilder`
hannobraun Mar 17, 2023
8d8bcca
Rename `CycleBuilder2` to `CycleBuilder`
hannobraun Mar 17, 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
29 changes: 8 additions & 21 deletions crates/fj-kernel/src/algorithms/intersect/curve_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,8 @@ where
#[cfg(test)]
mod tests {
use crate::{
builder::CycleBuilder,
geometry::curve::Curve,
insert::Insert,
objects::{Cycle, Face},
services::Services,
builder::CycleBuilder, geometry::curve::Curve, insert::Insert,
objects::Face, services::Services,
};

use super::CurveFaceIntersection;
Expand Down Expand Up @@ -182,22 +179,12 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
exterior_points,
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
vec![{
let (interior, _) = Cycle::new([])
.update_as_polygon_from_points(
interior_points,
&mut services.objects,
);
interior.insert(&mut services.objects)
}],
CycleBuilder::polygon(exterior_points)
.build(&mut services.objects)
.insert(&mut services.objects),
vec![CycleBuilder::polygon(interior_points)
.build(&mut services.objects)
.insert(&mut services.objects)],
None,
);

Expand Down
29 changes: 8 additions & 21 deletions crates/fj-kernel/src/algorithms/intersect/face_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ mod tests {
use pretty_assertions::assert_eq;

use crate::{
algorithms::intersect::CurveFaceIntersection,
builder::CycleBuilder,
geometry::curve::Curve,
insert::Insert,
objects::{Cycle, Face},
algorithms::intersect::CurveFaceIntersection, builder::CycleBuilder,
geometry::curve::Curve, insert::Insert, objects::Face,
services::Services,
};

Expand All @@ -89,14 +86,9 @@ mod tests {
.map(|surface| {
Face::new(
surface,
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
points,
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon(points)
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
)
Expand Down Expand Up @@ -125,14 +117,9 @@ mod tests {
let [a, b] = surfaces.clone().map(|surface| {
Face::new(
surface,
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
points,
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon(points)
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
)
Expand Down
96 changes: 31 additions & 65 deletions crates/fj-kernel/src/algorithms/intersect/face_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ mod tests {
algorithms::intersect::{face_point::FacePointIntersection, Intersect},
builder::CycleBuilder,
insert::Insert,
objects::{Cycle, Face},
objects::Face,
services::Services,
};

Expand All @@ -150,14 +150,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [1., 1.], [0., 2.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[0., 0.], [1., 1.], [0., 2.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -173,14 +168,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [2., 1.], [0., 2.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[0., 0.], [2., 1.], [0., 2.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -199,14 +189,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[4., 2.], [0., 4.], [0., 0.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[4., 2.], [0., 4.], [0., 0.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -225,14 +210,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [2., 1.], [3., 0.], [3., 4.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[0., 0.], [2., 1.], [3., 0.], [3., 4.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -251,14 +231,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [2., 1.], [3., 1.], [0., 2.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[0., 0.], [2., 1.], [3., 1.], [0., 2.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -277,14 +252,15 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [2., 1.], [3., 1.], [4., 0.], [4., 5.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([
[0., 0.],
[2., 1.],
[3., 1.],
[4., 0.],
[4., 5.],
])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -303,14 +279,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [2., 0.], [0., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[0., 0.], [2., 0.], [0., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -335,14 +306,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[0., 0.], [1., 0.], [0., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[0., 0.], [1., 0.], [0., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand Down
79 changes: 22 additions & 57 deletions crates/fj-kernel/src/algorithms/intersect/ray_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ mod tests {
},
builder::CycleBuilder,
insert::Insert,
objects::{Cycle, Face},
objects::Face,
services::Services,
};

Expand All @@ -165,14 +165,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.yz_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -189,14 +184,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.yz_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -216,14 +206,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.yz_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -240,14 +225,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.yz_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -272,14 +252,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.yz_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand Down Expand Up @@ -307,14 +282,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand All @@ -333,14 +303,9 @@ mod tests {

let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
CycleBuilder::polygon([[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]])
.build(&mut services.objects)
.insert(&mut services.objects),
Vec::new(),
None,
);
Expand Down
Loading