View source: R/readBezierControlPoints.R
readBezierControlPoints | R Documentation |
Reads Bezier control points from a file or files into a list grouped first by curve name and then by the index of the file from which they were read. A separate function from the standard read functions is necessary since the number of control points may differ for each Bezier curve or spline and, thus, the number of values may differ by row.
readBezierControlPoints(file, ndim = 2, ...)
file |
file(s) to be read. |
ndim |
the number of dimensions of the Bezier curve points |
... |
further arguments to be passed to |
The rows of each file must start with the name of the curve or spline followed by the control points, all separated by tabs. The control points are listed first by dimension and then by point (x1\ty1\tx2\ty2
etc.). For example, three Bezier points starting with [100, 200] would be on one line as follows, with \t
replaced by tabs.
tomium_R\t100\t200\t300\t100\t400\t300
Each Bezier curve or spline is first grouped into a list by curve name (e.g. list$tomium_R
) and then by the index of the file from which it was read (e.g. list$tomium_R[[1]]
from the first file). The control points are made into a matrix where the number of columns corresponds to ndim
. The Bezier list structure is similar to the landmark list structure created by readLandmarksToList
and can be used to generate points along a Bezier curve or spline. See the R package bezier for more details.
a list of Bezier control points grouped by name and file number.
Aaron Olsen
readLandmarksToArray
, readCheckerboardsToArray
, readLandmarksToList
,
readLandmarksToMatrix
## GET FILE DIRECTORY FOR PACKAGE FILES fdir <- paste0(path.package("StereoMorph"), "/extdata/") ## FILE TO READ file <- paste0(fdir, "bezier_control_points_a2_v", 1:2, ".txt") ## FILE TO READ bcp <- readBezierControlPoints(file=file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.