Merge pull request #2350 from hannobraun/geometry

Return `Option` from `CurveGeom::local_on`
This commit is contained in:
Hanno Braun 2024-05-07 14:55:29 +02:00 committed by GitHub
commit 8ca2fbb7e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 6 deletions

View File

@ -33,10 +33,11 @@ impl CurveGeom {
/// ## Panics
///
/// Panics, if the curve has not been defined on that surface.
pub fn local_on(&self, surface: &Handle<Surface>) -> &LocalCurveGeom {
self.definitions
.get(surface)
.expect("Curve not defined on provided surface")
pub fn local_on(
&self,
surface: &Handle<Surface>,
) -> Option<&LocalCurveGeom> {
self.definitions.get(surface)
}
}

View File

@ -135,6 +135,7 @@ pub trait BuildHalfEdge {
.of_curve(half_edge.curve())
.expect("Curve geometry was just defined in same function")
.local_on(&surface)
.expect("Curve geometry was just defined in same function")
.path,
boundary: boundary.unwrap_or_default(),
},

View File

@ -112,6 +112,10 @@ pub trait BuildShell {
defined in same function",
)
.local_on(&surface)
.expect(
"Curve geometry was just \
defined in same function",
)
.path,
boundary,
},

View File

@ -141,10 +141,14 @@ impl SweepHalfEdge for Handle<HalfEdge> {
.geometry
.of_curve(&curve)
.expect(
"Curve geometry was just \
defined in same function",
"Curve geometry was just defined in same \
function",
)
.local_on(&surface)
.expect(
"Curve geometry was just defined in same \
function",
)
.path,
boundary,
},