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

View source: R/rotmesh.onto.r

rotmesh.ontoR Documentation

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.

...

additional parameters passed on to rotonto.

Value

mesh

rotated mesh

yrot

rotated refmat

trafo

4x4 transformation matrix

Author(s)

Stefan Schlager

See Also

file2mesh,tps3d ,rotonto,mesh2ply

Examples


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)
## Not run: 
## 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])

## End(Not run)


Morpho documentation built on Feb. 16, 2023, 10:51 p.m.