More (slow) pyramid progress

This commit is contained in:
Chris Hodapp 2020-10-01 14:05:26 -04:00
parent f2ae9f051e
commit 0ba914a7a3

View File

@ -180,10 +180,22 @@ pub fn pyramid() -> Rule<()> {
]; ];
let test = rule_fn!(() => |_s, base_verts| { let test = rule_fn!(() => |_s, base_verts| {
let rt3 = (3.0).sqrt();
let (a0, a1, a2);
let next_verts: Vec<VertexUnion> = vec_indexed![
VertexUnion::Vertex(vertex( rt3/12.0, -1.0/4.0, 0.0)),
VertexUnion::Vertex(vertex( rt3/12.0, 1.0/4.0, 0.0)),
VertexUnion::Vertex(vertex(-rt3/6.0, 0.0, 0.0)),
@a0 VertexUnion::Arg(0),
@a1 VertexUnion::Arg(1),
@a2 VertexUnion::Arg(2),
// TODO: Why do I have index-out-of-range crashes if I move
// the ::Vertex(...) to the end?
];
RuleEval { RuleEval {
geom: Rc::new(MeshFunc { geom: Rc::new(MeshFunc {
verts: vert_args(0..3), verts: next_verts,
faces: vec![ 0, 1, 2 ], //, 0, 3, 1, 2, 3, 0, 1, 3, 2], faces: vec![ a0, 0, 2, a1, 1, 0, a2, 2, 1, 0, 1, 2 ],
}), }),
final_geom: Rc::new(MeshFunc { final_geom: Rc::new(MeshFunc {
verts: vec![], verts: vec![],
@ -191,6 +203,9 @@ pub fn pyramid() -> Rule<()> {
}), }),
children: vec![], children: vec![],
} }
// TODO: The 'mid' vertices still don't connect together - probably
// because each child repeats them?
// I'd have to have 'base' produce them and pass them as args.
}); });
let base_to_side = |i| { let base_to_side = |i| {