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
/// ///
/// Panics, if the curve has not been defined on that surface. /// Panics, if the curve has not been defined on that surface.
pub fn local_on(&self, surface: &Handle<Surface>) -> &LocalCurveGeom { pub fn local_on(
self.definitions &self,
.get(surface) surface: &Handle<Surface>,
.expect("Curve not defined on provided surface") ) -> Option<&LocalCurveGeom> {
self.definitions.get(surface)
} }
} }

View File

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

View File

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

View File

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