Don't implicitly copy SurfaceGeometry

This commit is contained in:
Hanno Braun 2024-03-27 12:10:29 +01:00
parent 0fde6449da
commit 54b7332eba
4 changed files with 12 additions and 13 deletions

View File

@ -32,7 +32,7 @@ impl Approx for (&Handle<Curve>, &HalfEdgeGeometry, &Handle<Surface>) {
None => {
let approx = approx_curve(
&half_edge.path,
&geometry.of_surface(surface),
geometry.of_surface(surface),
half_edge.boundary,
tolerance,
geometry,

View File

@ -91,25 +91,24 @@ impl Geometry {
/// ## Panics
///
/// Panics, if the geometry of the surface is not defined.
pub fn of_surface(&self, surface: &Handle<Surface>) -> SurfaceGeometry {
pub fn of_surface(&self, surface: &Handle<Surface>) -> &SurfaceGeometry {
self.surface
.get(surface)
.copied()
.expect("Expected geometry of surface to be defined")
}
/// Access the geometry of the xy-plane
pub fn xy_plane(&self) -> SurfaceGeometry {
pub fn xy_plane(&self) -> &SurfaceGeometry {
self.of_surface(&self.xy_plane)
}
/// Access the geometry of the xz-plane
pub fn xz_plane(&self) -> SurfaceGeometry {
pub fn xz_plane(&self) -> &SurfaceGeometry {
self.of_surface(&self.xz_plane)
}
/// Access the geometry of the yz-plane
pub fn yz_plane(&self) -> SurfaceGeometry {
pub fn yz_plane(&self) -> &SurfaceGeometry {
self.of_surface(&self.yz_plane)
}
}

View File

@ -59,7 +59,7 @@ impl SweepHalfEdge for Handle<HalfEdge> {
let path = path.into();
let half_edge_geom = *core.layers.geometry.of_half_edge(self);
let surface_geom = core.layers.geometry.of_surface(&surface);
let surface_geom = *core.layers.geometry.of_surface(&surface);
let surface =
half_edge_geom
.path

View File

@ -150,18 +150,18 @@ impl ShellValidationError {
compare_curve_coords(
edge_a,
&geometry.of_surface(surface_a),
geometry.of_surface(surface_a),
edge_b,
&geometry.of_surface(surface_b),
geometry.of_surface(surface_b),
geometry,
config,
&mut mismatches,
);
compare_curve_coords(
edge_b,
&geometry.of_surface(surface_b),
geometry.of_surface(surface_b),
edge_a,
&geometry.of_surface(surface_a),
geometry.of_surface(surface_a),
geometry,
config,
&mut mismatches,
@ -254,9 +254,9 @@ impl ShellValidationError {
// `distinct_min_distance`, that's a problem.
if distances(
half_edge_a.clone(),
&geometry.of_surface(surface_a),
geometry.of_surface(surface_a),
half_edge_b.clone(),
&geometry.of_surface(surface_b),
geometry.of_surface(surface_b),
geometry,
)
.all(|d| d < config.distinct_min_distance)