Merge pull request #2309 from hannobraun/planes

Prevent accidental re-definition of basis plane geometry
This commit is contained in:
Hanno Braun 2024-04-04 11:09:51 +02:00 committed by GitHub
commit b158c3feb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -69,6 +69,14 @@ impl Geometry {
surface: Handle<Surface>,
geometry: SurfaceGeom,
) {
if self.surface.contains_key(&surface)
&& (surface == self.xy_plane
|| surface == self.xz_plane
|| surface == self.yz_plane)
{
panic!("Attempting to redefine basis plane.");
}
self.surface.insert(surface, geometry);
}

View File

@ -25,7 +25,12 @@ impl Layer<Geometry> {
);
}
/// Define the geometry of the provided surface
/// # Define the geometry of the provided surface
///
/// ## Panics
///
/// Panics, if the surface is a special pre-defined plane, like the basis
/// planes (xy-, xz-, or yz-plane).
pub fn define_surface(
&mut self,
surface: Handle<Surface>,