Commit 256e90b8 authored by SirBlueRabbit's avatar SirBlueRabbit
Browse files

clean up comments

parent 373bfa9c
use super::{HalfEdge, Label, Step, Triangulation, Vertex};
/* #[derive(Copy, Clone, Debug)]
struct Shard {
a1: Label<HalfEdge>,
a2: Label<HalfEdge>,
a3: Label<HalfEdge>,
b1: Label<HalfEdge>,
b2: Label<HalfEdge>,
b3: Label<HalfEdge>,
}
enum ShardLocation {
A1,
A2,
A3,
B1,
B2,
B3,
}
enum Boundary {
Absolute {
label: Label<HalfEdge>,
},
Relative {
location: ShardLocation,
rotation: Rotation,
},
} */
impl Triangulation {
pub fn do_step(&mut self, step: Step) {
match step {
......@@ -132,9 +103,6 @@ impl Triangulation {
a,
];
// update dummy adjacency
//self.update_dummy_adj(dummy, boundary2, boundary3);
// replace dummy with new simplex
for i in 0..4 {
self.half_edges
......@@ -227,133 +195,5 @@ impl Triangulation {
// update vertices
self.half_edges.set_vertices(a, [v1, v2, v3, v4]);
self.half_edges.set_vertices(b, [v1, v3, v2, v0]);
/* // identify halfedges
let a = label.next().next().adj_int().next();
let b = label
.adj_int()
.adj_ext(&self.half_edges)
.next()
.adj_int()
.next()
.next();
let c = label
.adj_ext(&self.half_edges)
.next()
.adj_int()
.next()
.next();
// identify vertices
let v0 = self.half_edges[label].vertex_tail;
let v1 = self.half_edges[a].vertex_tail;
let v2 = self.half_edges[a].vertex_head;
let v3 = self.half_edges[b].vertex_tail;
let v4 = self.half_edges[label].vertex_head;
// identify old boundary
let boundary3 = [b.adj_int(), c, a.adj_int(), c.adj_int()];
// create dummy simplex
let dummy_label = self.insert_tet([v0, v0, v0, v0]);
let dummy = [
dummy_label,
dummy_label.adj_int(),
dummy_label.next().adj_int(),
dummy_label.next().next().adj_int(),
];
// glue dummy to old simplex neighbours
for i in 0..4 {
self.half_edges
.glue_triangles(dummy[i], boundary3[i].adj_ext(&self.half_edges));
}
// internal gluing
self.half_edges
.glue_triangles(a.adj_int(), b.adj_int().next().next());
// identify new boundary
let boundary2 = [
label.next().next().adj_int(),
label.next().adj_int(),
label.adj_ext(&self.half_edges).adj_int(),
label.adj_ext(&self.half_edges).next().next().adj_int(),
];
// update dummy adjacency
self.update_dummy_adj(dummy, boundary3, boundary2);
// glue dummy neighbours to new simplex
for i in 0..4 {
self.half_edges
.glue_triangles(dummy[i].adj_ext(&self.half_edges), boundary2[i]);
}
// remove dummy and spare simplex
self.remove_tet(dummy_label);
self.remove_tet(c);
// update vertices
self.half_edges.set_vertices(a, [v1, v2, v0, v3]);
self.half_edges.set_vertices(b, [v3, v2, v4, v1]); */
}
/*
fn update_dummy_adj(
&mut self,
dummy: [Label<HalfEdge>; 4],
old: [Label<HalfEdge>; 4],
new: [Label<HalfEdge>; 4],
) {
for i in 0..4 {
for j in 0..4 {
if dummy[i].adj_ext(&self.half_edges).same_triangle(old[j]) {
self.half_edges[dummy[i]].adj_ext =
Label::<HalfEdge>::from(new[j].value() / 3 * 3 + dummy[i].value() % 3);
}
}
}
}
*/
/* fn shard_boundary(&self, label: Label<HalfEdge>, shard: Shard) -> Boundary {
let ext = label.adj_ext(&self.half_edges);
let location = if ext.same_triangle(shard.a1) {
ShardLocation::A1
} else if ext.same_triangle(shard.a2) {
ShardLocation::A2
} else if ext.same_triangle(shard.a3) {
ShardLocation::A3
} else if ext.same_triangle(shard.b1) {
ShardLocation::B1
} else if ext.same_triangle(shard.b2) {
ShardLocation::B2
} else if ext.same_triangle(shard.b3) {
ShardLocation::B3
} else {
return Boundary::Absolute { label: ext };
};
let rotation = label.rotation(ext);
Boundary::Relative { location, rotation }
}
fn glue_boundary(&mut self, label: Label<HalfEdge>, boundary: Boundary, shard: Shard) {
match boundary {
Boundary::Absolute { label: ext } => self.half_edges.glue_triangles(label, ext),
Boundary::Relative { location, rotation } => {
let ext = match location {
ShardLocation::A1 => shard.a1,
ShardLocation::A2 => shard.a2,
ShardLocation::A3 => shard.a3,
ShardLocation::B1 => shard.b1,
ShardLocation::B2 => shard.b2,
ShardLocation::B3 => shard.b3,
};
match rotation {
Rotation::Aligned => self.half_edges.glue_triangles(label, ext),
Rotation::OneThird => self.half_edges.glue_triangles(label, ext.next()),
Rotation::TwoThirds => self.half_edges.glue_triangles(label, ext.next().next()),
}
}
}
} */
}
......@@ -95,12 +95,6 @@ pub enum Step {
Rejected,
}
/* pub enum Rotation {
Aligned,
OneThird,
TwoThirds,
} */
impl fmt::Display for StepCount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(f, "move02: {}", self.move02)?;
......@@ -259,18 +253,6 @@ impl Triangulation {
// insert a tetrahedron
let _ = triangulation.insert_tet([v0, v0, v1, v1]);
// glue tetrahedra together
//triangulation.half_edges.glue_triangles(a, b);
//triangulation
// .half_edges
// .glue_triangles(a.adj_int(), b.adj_int());
//triangulation
// .half_edges
// .glue_triangles(a.next().adj_int(), b.next().next().adj_int());
//triangulation
// .half_edges
// .glue_triangles(a.next().next().adj_int(), b.next().adj_int());
triangulation
}
......@@ -344,19 +326,6 @@ impl Label<HalfEdge> {
pub fn same_tetrahedron(&self, other: Label<HalfEdge>) -> bool {
self.value() / 12 == other.value() / 12
}
/* pub fn same_triangle(&self, other: Label<HalfEdge>) -> bool {
self.value() / 3 == other.value() / 3
} */
/*
pub fn rotation(&self, other: Label<HalfEdge>) -> Rotation {
match (self.value() + other.value()) % 3 {
0 => Rotation::Aligned,
1 => Rotation::TwoThirds,
2 => Rotation::OneThird,
_ => unreachable!(),
}
} */
}
impl Pool<HalfEdge> {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment