mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-30 03:45:55 +00:00
Make method return type more flexible
This prepares for an upcoming change.
This commit is contained in:
parent
c2a28e0644
commit
67d351cea0
@ -106,10 +106,16 @@ impl MaybePartial<GlobalEdge> {
|
||||
|
||||
impl MaybePartial<HalfEdge> {
|
||||
/// Access the vertices
|
||||
pub fn vertices(&self) -> Option<[MaybePartial<Vertex>; 2]> {
|
||||
pub fn vertices(&self) -> [Option<MaybePartial<Vertex>>; 2] {
|
||||
match self {
|
||||
Self::Full(full) => Some(full.vertices().clone().map(Into::into)),
|
||||
Self::Partial(partial) => partial.vertices.clone(),
|
||||
Self::Full(full) => {
|
||||
full.vertices().clone().map(|vertex| Some(vertex.into()))
|
||||
}
|
||||
Self::Partial(partial) => partial
|
||||
.vertices
|
||||
.clone()
|
||||
.map(|vertices| vertices.map(Some))
|
||||
.unwrap_or([None, None]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ impl PartialCycle {
|
||||
.half_edges
|
||||
.last()
|
||||
.map(|half_edge| {
|
||||
let [_, last] = half_edge
|
||||
.vertices()
|
||||
.expect("Need half-edge vertices to extend cycle");
|
||||
let [_, last] = half_edge.vertices().map(|vertex| {
|
||||
vertex.expect("Need half-edge vertices to extend cycle")
|
||||
});
|
||||
let last = last
|
||||
.surface_form()
|
||||
.expect("Need surface vertex to extend cycle");
|
||||
@ -129,7 +129,9 @@ impl PartialCycle {
|
||||
|
||||
let vertices = [first, last].map(|option| {
|
||||
option.map(|half_edge| {
|
||||
half_edge.vertices().expect("Need vertices to close cycle")
|
||||
half_edge
|
||||
.vertices()
|
||||
.map(|vertex| vertex.expect("Need vertices to close cycle"))
|
||||
})
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user