mirror of https://codeberg.org/topola/topola.git
triangulation: for refs consistently use structs instead of tuples
This commit is contained in:
parent
8d59242f3f
commit
44bbb20e62
|
|
@ -175,13 +175,13 @@ impl<'a, I: Copy + PartialEq + GetNodeIndex, W: GetVertexIndex<I> + HasPosition<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct TriangulationVertexReference<I: Copy, W> {
|
pub struct TriangulationVertexReference<'a, I: Copy, W> {
|
||||||
index: I,
|
index: I,
|
||||||
weight: &'a W,
|
weight: &'a W,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I: Copy> visit::NodeRef for TriangulationVertexReference<I, W> {
|
impl<'a, I: Copy, W: Copy> visit::NodeRef for TriangulationVertexReference<'a, I, W> {
|
||||||
type NodeId = I;
|
type NodeId = I;
|
||||||
type Weight = W;
|
type Weight = W;
|
||||||
|
|
||||||
|
|
@ -192,25 +192,25 @@ impl<I: Copy> visit::NodeRef for TriangulationVertexReference<I, W> {
|
||||||
fn weight(&self) -> &Self::Weight {
|
fn weight(&self) -> &Self::Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
impl<'a, I: Copy + PartialEq + GetNodeIndex, W: GetVertexIndex<I> + HasPosition<Scalar = f64>>
|
impl<
|
||||||
visit::IntoNodeReferences for &'a Triangulation<I, W>
|
'a,
|
||||||
|
I: Copy + PartialEq + GetNodeIndex,
|
||||||
|
W: Copy + GetVertexIndex<I> + HasPosition<Scalar = f64>,
|
||||||
|
> visit::IntoNodeReferences for &'a Triangulation<I, W>
|
||||||
{
|
{
|
||||||
/*type NodeRef = TriangulationVertexReference<I, W>;
|
type NodeRef = TriangulationVertexReference<'a, I, W>;
|
||||||
type NodeReferences = Box<dyn Iterator<Item = TriangulationVertexReference<I, W>> + 'a>;*/
|
type NodeReferences = Box<dyn Iterator<Item = TriangulationVertexReference<'a, I, W>> + 'a>;
|
||||||
type NodeRef = (I, &'a W);
|
|
||||||
type NodeReferences = Box<dyn Iterator<Item = (I, &'a W)> + 'a>;
|
|
||||||
|
|
||||||
fn node_references(self) -> Self::NodeReferences {
|
fn node_references(self) -> Self::NodeReferences {
|
||||||
Box::new(
|
Box::new(
|
||||||
spade::Triangulation::fixed_vertices(&self.triangulation).map(|vertex| {
|
spade::Triangulation::fixed_vertices(&self.triangulation).map(|vertex| {
|
||||||
let weight = spade::Triangulation::s(&self.triangulation).vertex_data(vertex);
|
let weight = spade::Triangulation::s(&self.triangulation).vertex_data(vertex);
|
||||||
/*TriangulationVertexReference {
|
TriangulationVertexReference {
|
||||||
index: weight.vertex_index(),
|
index: weight.vertex_index(),
|
||||||
weight,
|
weight,
|
||||||
}*/
|
}
|
||||||
(weight.vertex_index(), weight)
|
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue