Learn R Programming

Morpho (version 2.1)

rotmesh.onto: rotate ,scale and translate a mesh based on landmark information.

Description

rotates and reflects a mesh onto by calculating the transformation from two sets of referenced landmarks.

Usage

rotmesh.onto(mesh, refmat, tarmat, adnormals = FALSE, scale = FALSE,
  reflection = FALSE)

Arguments

mesh
object of class mesh3d.
refmat
k x m matrix with landmarks on the mesh
tarmat
k x m matrix as target configuration
adnormals
logical - if TRUE, vertex normals will be recomputed after rotation. If mesh has normals and adnormals=FALSE, the existing normals are rotated by the same rotation matrix as the mesh's vertices.
scale
logical: if TRUE the mesh will be scaled according to the size of the target.
reflection
logical: allow reflection.

Value

  • meshrotated mesh
  • yrotrotated refmat
  • trafo4x4 transformation matrix

See Also

file2mesh,warp.mesh ,rotonto,mesh2ply

Examples

Run this code
require(rgl)
data(boneData)
## rotate, translate and scale the mesh belonging to the first specimen
## onto the landmark configuration of the 10th specimen
rotmesh <- rotmesh.onto(skull_0144_ch_fe.mesh,boneLM[,,1],
                        boneLM[,,10], scale=TRUE)
## render rotated mesh and landmarks
shade3d(rotmesh$mesh, col=2, specular=1)
spheres3d(boneLM[,,1])
## render original mesh
shade3d(skull_0144_ch_fe.mesh, col=3, specular=1)
spheres3d(boneLM[,,10])

Run the code above in your browser using DataLab