Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Mar 8, 2022
1 parent ef056a1 commit 79e2296
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/kernel/algorithms/sweep.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
use std::collections::HashMap;

use crate::{
kernel::{shape::Shape, topology::faces::Face},
kernel::{
shape::Shape,
topology::{edges::Edge, faces::Face},
},
math::{Scalar, Transform, Vector},
};

Expand All @@ -22,6 +27,45 @@ pub fn sweep_shape(
let mut top_faces = Vec::new();
let mut side_faces = Vec::new();

// Create new vertices.
let mut vertices = HashMap::new();
for vertex_orig in shape_orig.vertices().all() {
let point = vertex_orig.point() + path;

let vertex = shape.vertices().add(point);

vertices.insert(vertex_orig, vertex);
}

// Create top edges.
// let mut edges = HashMap::new();
// for cycle_orig in shape_orig.cycles().all() {
// for edge_orig in cycle_orig.edges {
// let curve =
// shape.curves().add(edge_orig.curve.transform(&translation));

// let vertices = edge_orig.vertices.map(|vs| {
// vs.map(|v| {
// *vertices.get(&v).expect(
// "Edge is referring to vertex that doesn't exist in shape",
// )
// })
// });

// let edge = Edge { curve, vertices };
// // TASK: We need to insert `edge` into `shape` here, but that
// // doesn't quite work. We're losing the cycles here, but we
// // need to faithfully reproduce those too.

// edges.insert(edge_orig, edge);
// }
// }

// Create top faces.

// We could use `vertices` to create the side edges and faces here, but the
// side walls is created below, in triangle representation.

for face in shape_orig.faces().all() {
bottom_faces.push(face.clone());

Expand Down
8 changes: 8 additions & 0 deletions src/kernel/shape/vertices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ impl Vertices<'_> {

handle
}

/// Access iterator over all vertices
///
/// The caller must not make any assumptions about the order of vertices.
pub fn all(&self) -> impl Iterator<Item = Vertex> {
// TASK: Implement
std::iter::empty()
}
}

#[cfg(test)]
Expand Down

0 comments on commit 79e2296

Please sign in to comment.