// Get a random deformation field and apply to the reference
val
sampleDeformation1 : DiscreteField[_3D, UnstructuredPointsDomain[_3D], EuclideanVector[_3D]] =
faceGP.sample
// Interpolate in order to apply to a mesh
val
interpolator = NearestNeighborInterpolator[_3D, EuclideanVector[_3D]]()
val
continuousDeformationField1: Field[_3D, EuclideanVector[_3D] ] =
sampleDeformation1.interpolate(
interpolator)
// Apply continuous transformation
import scalismo.registration.Transformation
val
sampleTransformation1 =
Transformation( (pt: Point[_3D]) => pt +
continuousDeformationField1(pt))
// Apply to faceReference
val
sampleMesh =
faceReference.transform(
sampleTransformation1)