Skip to content

Commit

Permalink
moved prism to using faces
Browse files Browse the repository at this point in the history
  • Loading branch information
coillteoir committed May 5, 2024
1 parent f05f732 commit d344f88
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,23 @@ fn prism(origin: Point, _radius: f32) -> Result<String, String> {
),
];

let faces = [
Face::new(points.to_vec(), vec![1, 2, 3]),
Face::new(points.to_vec(), vec![0, 2, 3]),
Face::new(points.to_vec(), vec![0, 1, 3]),
Face::new(points.to_vec(), vec![0, 2, 1]),
];

Ok(format!(
r#"{0}
f -3 -2 -1
f -4 -2 -1
f -4 -3 -1
f -4 -2 -3
{1}
"#,
vertex_string(points.to_vec())
vertex_string(points.to_vec()),
faces
.into_iter()
.map(|f| f.to_obj_string())
.collect::<Vec<String>>()
.join("\n")
))
}

Expand Down

0 comments on commit d344f88

Please sign in to comment.