Transforms all vertex positions in a mesh by a 4x4 homogeneous
matrix (applied as M * (x, y, z, 1)^T). Vertex colors and
normals are untouched.
Arguments
- mesh
A mesh descriptor list with
verticesandtriangles, as returned byrender_mesh()or built byscimesh_generate_multi_spheres()etc.- matrix
A 4x4 numeric matrix.
Examples
mesh <- generate_cuboid(c(0, 0, 0), c(1, 1, 1))
mat <- diag(4)
mat[1:3, 4] <- c(2, 3, 4)
translated <- transform_mesh(mesh, mat)
translated$vertices[1, ]
#> [1] 1 2 5