View source: R/equidistantCurve.r

equidistantCurve | R Documentation |

make a curve equidistant (optionally up/downsampling)

equidistantCurve( x, n = NULL, open = TRUE, subsample = 0, increment = 2, smoothit = 0, mesh = NULL, iterations = 1 )

`x` |
k x m matrix containing the 2D or 3D coordinates |

`n` |
integer: number of coordinates to sample. If NULL, the existing curve will be made equidistant. |

`open` |
logical: specifies whether the curve is open or closed. |

`subsample` |
integer: number of subsamples to draw from curve for interpolation. For curves with < 1000 points, no subsampling is required. |

`increment` |
integer: if > 1, the curve is estimated iteratively by incrementing the original points by this factor. The closer this value to 1, the smoother the line but possibly farther away from the control points. |

`smoothit` |
integer: smoothing iterations after each step |

`mesh` |
specify mesh to project point to |

`iterations` |
integer: how many iterations to run equidistancing. |

Equidistancy is reached by iteratively deforming (using TPS) a straight line with equidistantly placed points to the target using control points with the same spacing as the actual curve. To avoid singularity, the straight line containes a small amount of noise, which can (optionally) be accounted for by smoothing the line by its neighbours.

matrix containing equidistantly placed points

if n >> number of original points, the resulting curves can show unwanted distortions.

data(nose) x <- shortnose.lm[c(304:323),] xsample <- equidistantCurve(x,n=50,iterations=10,increment=2) ## Not run: require(rgl) points3d(xsample,size=5) spheres3d(x,col=2,radius=0.3,alpha=0.5) ## End(Not run)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.