View source: R/displacementField.r
interpolateDisplacementField | R Documentation |
evaluate a displacement field using gaussian smoothed interpolation of a given discrete displacement field
interpolateDisplacementField(
dispfield,
points,
k = 10,
sigma = 20,
gamma = 1,
type = c("Gauss", "Laplace", "Exponential", "Bspline", "TPS"),
subsample = 2000,
lambda = 1e-08,
threads = 0,
...
)
dispfield |
@param dispfield displacement field of class "DisplacementField", e.g. created using |
points |
matrix or mesh3d at which to evaluate the interpolated displacement field |
k |
integer: number of k closest points to evaluate. |
sigma |
kernel bandwidth used for smoothing. For all kernels except B-spline, sigma controls the importance of the neighbourhood by defining the bandwidth of the smoothing kernel. For B-spline it defines the support (the higher, the "wobblier" the deformation field can become. |
gamma |
dampening factor (displacement vectors will be divided by |
type |
kernel function for smoothing are "Gauss","Laplace", "Exponential", "Bspline" and "TPS" (or any abbreviation thereof). |
subsample |
integer: amount to subsample the field in case of type="TPS" |
lambda |
smoothing factor for TPS |
threads |
integer: number of threads to use for computing the interpolation. |
... |
additional parameters - currentyl unused. |
returns an interpolated displacement field of class displacement_field
at the positions of points
.
The k-closest coordinates of the displacement field are used to calculate a weighted (smoothed) displacement field for each point. The displacement field can then optionally be further smoothed using the function smoothDisplacementField
. The smoothing kernels are "Gauss","Laplace" and "Exponential". The displacement at point x
will be the weighted displacment vectors of the k-closest displacement vectors. Be d
the distance to a neightbouring point, the weight will be calculated as:
Gaussian: w(d) = exp(\frac{-d^2}{2\sigma^2})
Laplacian: w(d) = exp(\frac{-d}{\sigma})
Exponential: w(d) = exp(\frac{-d}{2\sigma^2})
plot.DisplacementField, applyDisplacementField, smoothDisplacementField
require(Rvcg);require(Morpho)
data(dummyhead)
humoff <- meshOffset(dummyhead.mesh,offset=5)
dispfield <- createDisplacementField(dummyhead.mesh,humoff)
## Not run:
## this only runs with latest Rvcg build from master
highres <- vcgSubdivide(dummyhead.mesh)
ifield <- interpolateDisplacementField(dispfield,highres,threads=2,sigma = 10,k=50)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.