mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-20 00:46:10 +00:00
Add Sibling
This commit is contained in:
parent
6afc3c1718
commit
cf6e1626c5
@ -43,7 +43,8 @@ impl SplitEdge for Shell {
|
|||||||
let [half_edge_a, half_edge_b] = half_edge.split_half_edge(point, core);
|
let [half_edge_a, half_edge_b] = half_edge.split_half_edge(point, core);
|
||||||
|
|
||||||
let siblings = {
|
let siblings = {
|
||||||
let [sibling_a, sibling_b] = sibling.split_half_edge(point, core);
|
let [sibling_a, sibling_b] =
|
||||||
|
sibling.sibling.split_half_edge(point, core);
|
||||||
let sibling_b = sibling_b
|
let sibling_b = sibling_b
|
||||||
.update_start_vertex(
|
.update_start_vertex(
|
||||||
|_, _| half_edge_b.start_vertex().clone(),
|
|_, _| half_edge_b.start_vertex().clone(),
|
||||||
@ -65,7 +66,7 @@ impl SplitEdge for Shell {
|
|||||||
core,
|
core,
|
||||||
)
|
)
|
||||||
.into_inner()
|
.into_inner()
|
||||||
.replace_half_edge(&sibling, siblings.clone(), core)
|
.replace_half_edge(&sibling.sibling, siblings.clone(), core)
|
||||||
.into_inner();
|
.into_inner();
|
||||||
|
|
||||||
(shell, [[half_edge_a, half_edge_b], siblings])
|
(shell, [[half_edge_a, half_edge_b], siblings])
|
||||||
|
@ -16,5 +16,5 @@ mod sibling_of_half_edge;
|
|||||||
pub use self::{
|
pub use self::{
|
||||||
all_half_edges_with_surface::AllHalfEdgesWithSurface,
|
all_half_edges_with_surface::AllHalfEdgesWithSurface,
|
||||||
bounding_vertices_of_half_edge::BoundingVerticesOfHalfEdge,
|
bounding_vertices_of_half_edge::BoundingVerticesOfHalfEdge,
|
||||||
sibling_of_half_edge::SiblingOfHalfEdge,
|
sibling_of_half_edge::{Sibling, SiblingOfHalfEdge},
|
||||||
};
|
};
|
||||||
|
@ -15,10 +15,7 @@ pub trait SiblingOfHalfEdge {
|
|||||||
/// Returns `None`, if the provided half-edge is not part of the object this
|
/// Returns `None`, if the provided half-edge is not part of the object this
|
||||||
/// method is called on, or if the provided half-edge has no sibling within
|
/// method is called on, or if the provided half-edge has no sibling within
|
||||||
/// the object.
|
/// the object.
|
||||||
fn get_sibling_of(
|
fn get_sibling_of(&self, half_edge: &Handle<HalfEdge>) -> Option<Sibling>;
|
||||||
&self,
|
|
||||||
half_edge: &Handle<HalfEdge>,
|
|
||||||
) -> Option<Handle<HalfEdge>>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SiblingOfHalfEdge for Shell {
|
impl SiblingOfHalfEdge for Shell {
|
||||||
@ -40,15 +37,12 @@ impl SiblingOfHalfEdge for Shell {
|
|||||||
same_curve && same_vertices
|
same_curve && same_vertices
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_sibling_of(
|
fn get_sibling_of(&self, half_edge: &Handle<HalfEdge>) -> Option<Sibling> {
|
||||||
&self,
|
|
||||||
half_edge: &Handle<HalfEdge>,
|
|
||||||
) -> Option<Handle<HalfEdge>> {
|
|
||||||
for face in self.faces() {
|
for face in self.faces() {
|
||||||
for cycle in face.region().all_cycles() {
|
for cycle in face.region().all_cycles() {
|
||||||
for h in cycle.half_edges() {
|
for h in cycle.half_edges() {
|
||||||
if self.are_siblings(half_edge, h) {
|
if self.are_siblings(half_edge, h) {
|
||||||
return Some(h.clone());
|
return Some(Sibling { sibling: h.clone() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,3 +51,9 @@ impl SiblingOfHalfEdge for Shell {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The sibling of a half-edge, plus some extra information
|
||||||
|
pub struct Sibling {
|
||||||
|
/// The sibling
|
||||||
|
pub sibling: Handle<HalfEdge>,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user