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

Simplify conversion from full to partial objects #1449

Merged
merged 3 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions crates/fj-kernel/src/algorithms/approx/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ mod tests {

let surface = services.objects.surfaces.xz_plane();
let mut curve = PartialCurve {
surface: Partial::from_full_entry_point(surface),
surface: Partial::from(surface),
..Default::default()
};
curve.update_as_line_from_points([[1., 1.], [2., 1.]]);
Expand All @@ -240,7 +240,7 @@ mod tests {
.build(&mut services.objects)
.insert(&mut services.objects);
let mut curve = PartialCurve {
surface: Partial::from_full_entry_point(surface),
surface: Partial::from(surface),
..Default::default()
};
curve.update_as_line_from_points([[1., 1.], [1., 2.]]);
Expand All @@ -263,7 +263,7 @@ mod tests {
.build(&mut services.objects)
.insert(&mut services.objects);
let mut curve = PartialCurve {
surface: Partial::from_full_entry_point(surface.clone()),
surface: Partial::from(surface.clone()),
..Default::default()
};
curve.update_as_line_from_points([[0., 1.], [1., 1.]]);
Expand Down Expand Up @@ -296,7 +296,7 @@ mod tests {

let surface = services.objects.surfaces.xz_plane();
let mut curve = PartialCurve {
surface: Partial::from_full_entry_point(surface),
surface: Partial::from(surface),
..Default::default()
};
curve.update_as_circle_from_radius(1.);
Expand Down
16 changes: 4 additions & 12 deletions crates/fj-kernel/src/algorithms/intersect/curve_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ mod tests {
fn compute_edge_in_front_of_curve_origin() {
let mut services = Services::new();

let surface = Partial::from_full_entry_point(
services.objects.surfaces.xy_plane(),
);
let surface = Partial::from(services.objects.surfaces.xy_plane());
let mut curve = PartialCurve {
surface: surface.clone(),
..Default::default()
Expand Down Expand Up @@ -119,9 +117,7 @@ mod tests {
fn compute_edge_behind_curve_origin() {
let mut services = Services::new();

let surface = Partial::from_full_entry_point(
services.objects.surfaces.xy_plane(),
);
let surface = Partial::from(services.objects.surfaces.xy_plane());
let mut curve = PartialCurve {
surface: surface.clone(),
..Default::default()
Expand Down Expand Up @@ -152,9 +148,7 @@ mod tests {
fn compute_edge_parallel_to_curve() {
let mut services = Services::new();

let surface = Partial::from_full_entry_point(
services.objects.surfaces.xy_plane(),
);
let surface = Partial::from(services.objects.surfaces.xy_plane());
let mut curve = PartialCurve {
surface: surface.clone(),
..Default::default()
Expand All @@ -180,9 +174,7 @@ mod tests {
fn compute_edge_on_curve() {
let mut services = Services::new();

let surface = Partial::from_full_entry_point(
services.objects.surfaces.xy_plane(),
);
let surface = Partial::from(services.objects.surfaces.xy_plane());
let mut curve = PartialCurve {
surface: surface.clone(),
..Default::default()
Expand Down
12 changes: 3 additions & 9 deletions crates/fj-kernel/src/algorithms/intersect/curve_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();

let mut curve = PartialCurve {
surface: Partial::from_full_entry_point(surface.clone()),
surface: Partial::from(surface.clone()),
..Default::default()
};
curve.update_as_line_from_points([[-3., 0.], [-2., 0.]]);
Expand All @@ -187,14 +187,8 @@ mod tests {

let face = {
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface.clone()),
exterior,
);
face.with_interior_polygon_from_points(
Partial::from_full_entry_point(surface),
interior,
);
face.with_exterior_polygon_from_points(surface.clone(), exterior);
face.with_interior_polygon_from_points(surface, interior);

face.build(&mut services.objects)
};
Expand Down
12 changes: 3 additions & 9 deletions crates/fj-kernel/src/algorithms/intersect/face_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ mod tests {
]
.map(|surface| {
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
points,
);
face.with_exterior_polygon_from_points(surface, points);

face.build(&mut services.objects)
});
Expand Down Expand Up @@ -125,10 +122,7 @@ mod tests {
];
let [a, b] = surfaces.clone().map(|surface| {
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
points,
);
face.with_exterior_polygon_from_points(surface, points);

face.build(&mut services.objects)
});
Expand All @@ -138,7 +132,7 @@ mod tests {

let expected_curves = surfaces.map(|surface| {
let mut curve = PartialCurve {
surface: Partial::from_full_entry_point(surface),
surface: Partial::from(surface),
..Default::default()
};
curve.update_as_line_from_points([[0., 0.], [1., 0.]]);
Expand Down
18 changes: 9 additions & 9 deletions crates/fj-kernel/src/algorithms/intersect/face_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ mod tests {
builder::FaceBuilder,
insert::Insert,
iter::ObjectIters,
partial::{Partial, PartialFace, PartialObject},
partial::{PartialFace, PartialObject},
services::Services,
};

Expand All @@ -150,7 +150,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [1., 1.], [0., 2.]],
);
let face = face
Expand All @@ -169,7 +169,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [2., 1.], [0., 2.]],
);
let face = face
Expand All @@ -191,7 +191,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[4., 2.], [0., 4.], [0., 0.]],
);
let face = face
Expand All @@ -213,7 +213,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [2., 1.], [3., 0.], [3., 4.]],
);
let face = face
Expand All @@ -235,7 +235,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [2., 1.], [3., 1.], [0., 2.]],
);
let face = face
Expand All @@ -257,7 +257,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [2., 1.], [3., 1.], [4., 0.], [4., 5.]],
);
let face = face
Expand All @@ -279,7 +279,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [2., 0.], [0., 1.]],
);
let face = face
Expand Down Expand Up @@ -310,7 +310,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[0., 0.], [1., 0.], [0., 1.]],
);
let face = face
Expand Down
16 changes: 8 additions & 8 deletions crates/fj-kernel/src/algorithms/intersect/ray_face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ mod tests {
builder::FaceBuilder,
insert::Insert,
iter::ObjectIters,
partial::{Partial, PartialFace, PartialObject},
partial::{PartialFace, PartialObject},
services::Services,
};

Expand All @@ -168,7 +168,7 @@ mod tests {
let surface = services.objects.surfaces.yz_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand All @@ -188,7 +188,7 @@ mod tests {
let surface = services.objects.surfaces.yz_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand All @@ -211,7 +211,7 @@ mod tests {
let surface = services.objects.surfaces.yz_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand All @@ -231,7 +231,7 @@ mod tests {
let surface = services.objects.surfaces.yz_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand Down Expand Up @@ -262,7 +262,7 @@ mod tests {
let surface = services.objects.surfaces.yz_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand Down Expand Up @@ -291,7 +291,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand All @@ -313,7 +313,7 @@ mod tests {
let surface = services.objects.surfaces.xy_plane();
let mut face = PartialFace::default();
face.with_exterior_polygon_from_points(
Partial::from_full_entry_point(surface),
surface,
[[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]],
);
let face = face
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ mod tests {
);

let mut expected_xy = PartialCurve {
surface: Partial::from_full_entry_point(xy.clone()),
surface: Partial::from(xy.clone()),
..Default::default()
};
expected_xy.update_as_u_axis();
let expected_xy = expected_xy
.build(&mut services.objects)
.insert(&mut services.objects);
let mut expected_xz = PartialCurve {
surface: Partial::from_full_entry_point(xz.clone()),
surface: Partial::from(xz.clone()),
..Default::default()
};
expected_xz.update_as_u_axis();
Expand Down
14 changes: 5 additions & 9 deletions crates/fj-kernel/src/algorithms/sweep/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl Sweep for (Handle<HalfEdge>, Color) {
};

let face = PartialFace {
exterior: Partial::from_full_entry_point(cycle),
exterior: Partial::from(cycle),
color: Some(color),
..Default::default()
};
Expand Down Expand Up @@ -205,9 +205,7 @@ mod tests {
let half_edge = {
let mut half_edge = PartialHalfEdge::default();
half_edge.update_as_line_segment_from_points(
Partial::from_full_entry_point(
services.objects.surfaces.xy_plane(),
),
services.objects.surfaces.xy_plane(),
[[0., 0.], [1., 0.]],
);

Expand All @@ -220,9 +218,7 @@ mod tests {
.sweep([0., 0., 1.], &mut services.objects);

let expected_face = {
let surface = Partial::from_full_entry_point(
services.objects.surfaces.xz_plane(),
);
let surface = Partial::from(services.objects.surfaces.xz_plane());

let bottom = {
let mut half_edge = PartialHalfEdge::default();
Expand Down Expand Up @@ -275,7 +271,7 @@ mod tests {

top.update_as_line_segment();

Partial::from_full_entry_point(
Partial::from(
top.build(&mut services.objects)
.insert(&mut services.objects)
.reverse(&mut services.objects),
Expand All @@ -301,7 +297,7 @@ mod tests {

side_down.update_as_line_segment();

Partial::from_full_entry_point(
Partial::from(
side_down
.build(&mut services.objects)
.insert(&mut services.objects)
Expand Down
Loading