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

Unify Face and PartialFace #1684

Merged
merged 36 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
05e22bc
Refactor test code to simplify it
hannobraun Mar 15, 2023
3f3e04a
Avoid using `PartialFace::new` in test code
hannobraun Mar 15, 2023
0e96fc9
Refactor code to simplify it
hannobraun Mar 15, 2023
f5a8b84
Avoid using `PartialFace::new` in edge sweep code
hannobraun Mar 15, 2023
a557e09
Refactor code to prepare for follow-on change
hannobraun Mar 15, 2023
b394eba
Refactor code to prepare for follow-on change
hannobraun Mar 15, 2023
952829a
Avoid using `PartialFace::new` in face sweep code
hannobraun Mar 15, 2023
33cf3f3
Avoid using `PartialFace::new`
hannobraun Mar 15, 2023
3fdafbc
Avoid using `PartialFace::new`
hannobraun Mar 15, 2023
c4928cf
Remove unused code
hannobraun Mar 15, 2023
9326af1
Make surface in `PartialFace` mandatory
hannobraun Mar 15, 2023
4532776
Inline redundant variable
hannobraun Mar 15, 2023
350c893
Refactor code to prepare for follow-on change
hannobraun Mar 15, 2023
0c1603d
Make color in `FaceApprox` optional
hannobraun Mar 15, 2023
09958fb
Refactor code to prepare for follow-on change
hannobraun Mar 15, 2023
9bcebc1
Make color in `Face` optional
hannobraun Mar 15, 2023
3f12197
Inline redundant variable
hannobraun Mar 15, 2023
c840cc5
Avoid using `FaceBuilder`
hannobraun Mar 15, 2023
525ee65
Remove unused `FaceBuilder::add_interior`
hannobraun Mar 15, 2023
7898820
Avoid using `PartialFace` in test code
hannobraun Mar 15, 2023
dab6ec0
Remove redundant block
hannobraun Mar 15, 2023
9113765
Relax requirements of face-point intersection test
hannobraun Mar 15, 2023
252cc67
Relax requirements of ray-face intersection test
hannobraun Mar 15, 2023
dd07b8e
Remove redundant `deref` call
hannobraun Mar 15, 2023
6d3028e
Simplify test helper function
hannobraun Mar 15, 2023
0dc0f11
Remove redundant block
hannobraun Mar 15, 2023
0cb4ab4
Avoid using `PartialFace` in edge sweep code
hannobraun Mar 15, 2023
83269f2
Avoid using `PartialFace` in face sweep code
hannobraun Mar 15, 2023
53ccc29
Switch `FaceBuilder` implementation to `Face`
hannobraun Mar 15, 2023
4a20c1f
Use `Handle<Face>` in `PartialSketch`
hannobraun Mar 15, 2023
4242606
Inline redundant variable
hannobraun Mar 15, 2023
830fc9c
Replace use of `PartialFace`
hannobraun Mar 15, 2023
d0b0fd7
Replace use of `PartialFace`
hannobraun Mar 15, 2023
2b28f6f
Use `Handle<Face>` in `PartialShell`
hannobraun Mar 15, 2023
94454df
Inline redundant variable
hannobraun Mar 15, 2023
026846c
Remove `PartialFace`
hannobraun Mar 15, 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
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/approx/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub struct FaceApprox {
pub interiors: BTreeSet<CycleApprox>,

/// The color of the approximated face
pub color: Color,
pub color: Option<Color>,

/// The handedness of the approximated face's front-side coordinate system
pub coord_handedness: Handedness,
Expand Down
30 changes: 13 additions & 17 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,10 @@ where
#[cfg(test)]
mod tests {
use crate::{
builder::{CycleBuilder, FaceBuilder},
builder::CycleBuilder,
geometry::curve::Curve,
insert::Insert,
objects::Cycle,
partial::{PartialFace, PartialObject},
objects::{Cycle, Face},
services::Services,
};

Expand All @@ -181,29 +180,26 @@ mod tests {
[ 1., -1.],
];

let face = {
let mut face = PartialFace::new(&mut services.objects);

face.surface = Some(services.objects.surfaces.xy_plane());
let face = Face::new(
services.objects.surfaces.xy_plane(),
{
let (exterior, _) =
face.exterior.clone_object().update_as_polygon_from_points(
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
exterior_points,
&mut services.objects,
);
face.exterior = exterior.insert(&mut services.objects);
}
{
exterior.insert(&mut services.objects)
},
vec![{
let (interior, _) = Cycle::new([])
.update_as_polygon_from_points(
interior_points,
&mut services.objects,
);
face.add_interior(interior, &mut services.objects);
}

face.build(&mut services.objects)
};
interior.insert(&mut services.objects)
}],
None,
);

let expected =
CurveFaceIntersection::from_intervals([[[1.], [2.]], [[4.], [5.]]]);
Expand Down
54 changes: 27 additions & 27 deletions crates/fj-kernel/src/algorithms/intersect/face_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ mod tests {
builder::CycleBuilder,
geometry::curve::Curve,
insert::Insert,
partial::{PartialFace, PartialObject},
objects::{Cycle, Face},
services::Services,
};

Expand All @@ -87,19 +87,19 @@ mod tests {
services.objects.surfaces.xz_plane(),
]
.map(|surface| {
let mut face = PartialFace::new(&mut services.objects);

face.surface = Some(surface);
{
let (exterior, _) =
face.exterior.clone_object().update_as_polygon_from_points(
points,
&mut services.objects,
);
face.exterior = exterior.insert(&mut services.objects);
}

face.build(&mut services.objects)
Face::new(
surface,
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
points,
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
Vec::new(),
None,
)
});

let intersection = FaceFaceIntersection::compute([&a, &b]);
Expand All @@ -123,19 +123,19 @@ mod tests {
services.objects.surfaces.xz_plane(),
];
let [a, b] = surfaces.clone().map(|surface| {
let mut face = PartialFace::new(&mut services.objects);

face.surface = Some(surface);
{
let (exterior, _) =
face.exterior.clone_object().update_as_polygon_from_points(
points,
&mut services.objects,
);
face.exterior = exterior.insert(&mut services.objects);
}

face.build(&mut services.objects)
Face::new(
surface,
{
let (exterior, _) = Cycle::new([])
.update_as_polygon_from_points(
points,
&mut services.objects,
);
exterior.insert(&mut services.objects)
},
Vec::new(),
None,
)
});

let intersection = FaceFaceIntersection::compute([&a, &b]);
Expand Down
Loading