Misc fix from last commit; move something to a reference

This commit is contained in:
hodapp 2020-02-22 12:11:42 -05:00
parent e37d49f7e0
commit 751df8274f
3 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ pub struct OpenMesh {
impl OpenMesh { impl OpenMesh {
pub fn transform(&self, xfm: Mat4) -> OpenMesh { pub fn transform(&self, xfm: &Mat4) -> OpenMesh {
OpenMesh { OpenMesh {
verts: self.verts.iter().map(|v| xfm * v).collect(), verts: self.verts.iter().map(|v| xfm * v).collect(),
// TODO: Is the above faster if I pack vectors into a // TODO: Is the above faster if I pack vectors into a

View File

@ -35,5 +35,5 @@ pub fn cube() -> OpenMesh {
Tag::Body(0), Tag::Body(1), Tag::Body(5), Tag::Body(0), Tag::Body(1), Tag::Body(5),
Tag::Body(0), Tag::Body(5), Tag::Body(4), Tag::Body(0), Tag::Body(5), Tag::Body(4),
], ],
}.transform(geometry::Translation3::new(-0.5, -0.5, -0.5).to_homogeneous()) }.transform(&geometry::Translation3::new(-0.5, -0.5, -0.5).to_homogeneous())
} }

View File

@ -105,9 +105,9 @@ impl Rule {
// Get sub-geometry (still un-transformed): // Get sub-geometry (still un-transformed):
let (submesh, eval) = sub.rule.to_mesh(iters_left - 1); let (submesh, eval) = sub.rule.to_mesh(iters_left - 1);
// Tally up eval count: // Tally up eval count:
evals += n; evals += eval;
let m2 = submesh.transform(sub.xf); let m2 = submesh.transform(&sub.xf);
(m2, &sub.vmap) (m2, &sub.vmap)
}).collect(); }).collect();