mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-30 11:55:57 +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> {
|
impl MaybePartial<HalfEdge> {
|
||||||
/// Access the vertices
|
/// Access the vertices
|
||||||
pub fn vertices(&self) -> Option<[MaybePartial<Vertex>; 2]> {
|
pub fn vertices(&self) -> [Option<MaybePartial<Vertex>>; 2] {
|
||||||
match self {
|
match self {
|
||||||
Self::Full(full) => Some(full.vertices().clone().map(Into::into)),
|
Self::Full(full) => {
|
||||||
Self::Partial(partial) => partial.vertices.clone(),
|
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
|
.half_edges
|
||||||
.last()
|
.last()
|
||||||
.map(|half_edge| {
|
.map(|half_edge| {
|
||||||
let [_, last] = half_edge
|
let [_, last] = half_edge.vertices().map(|vertex| {
|
||||||
.vertices()
|
vertex.expect("Need half-edge vertices to extend cycle")
|
||||||
.expect("Need half-edge vertices to extend cycle");
|
});
|
||||||
let last = last
|
let last = last
|
||||||
.surface_form()
|
.surface_form()
|
||||||
.expect("Need surface vertex to extend cycle");
|
.expect("Need surface vertex to extend cycle");
|
||||||
@ -129,7 +129,9 @@ impl PartialCycle {
|
|||||||
|
|
||||||
let vertices = [first, last].map(|option| {
|
let vertices = [first, last].map(|option| {
|
||||||
option.map(|half_edge| {
|
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