Learn R Programming

linkR (version 1.1.1)

drawLinkage: Draws a lever or linkage

Description

This function creates a visualization of a linkage, with options to create a static plot or an interactive, 3D visualization.

Usage

drawLinkage(linkage, method="svgViewR", file=NULL, animate = TRUE, animate.duration = 1, animate.reverse = FALSE, animate.repeat = -1, path.connect=NULL, connect.joints=TRUE, window.title='Linkage Viewer', joint.col.fill="white", joint.col.stroke="black", joint.cex=1.5, joint.lwd=2, point.col.fill="black", point.col.stroke="black", point.cex=1, point.lwd=2, path.col.fill=NA, path.opacity.fill=1, path.opacity.stroke=1, path.col.stroke="black", path.lwd = 1, add = FALSE, ...)

Arguments

linkage
A linkage object. This can be the output of defineLinkage (to visualize the initial static conformation of the linkage) or animateLinkage (to visualize the animated linkage).
method
The method to use in creating the visualization. The default method uses the package svgViewR to create an interactive, 3D visualization as an '.html' file that can be opened in any major web browser. The alternative method is "plot", which draws the linkage in an R graphics window (as a static visualization). Note that the "plot" method is still in development and may have limited functionality. The use of the "svgViewR" method (default) is recommended.
file
A filename for the '.html' file if method is "svgViewR". For method "plot", a filename with the extension of the desired save-as filetype. Supported filetypes for method "plot" are: .bmp, .png, .jpg (or .jpeg), .tiff, .eps.
animate
A logical indicating whether the linkage should be drawn as an animation or as a static visualization with all frames superimposed. This only applies if the input parameter linkage is an object created by animateLinkage. An input parameter linkage created by defineLinkage will only have a single frame (the initial linkage conformation).
animate.duration
The number of seconds during which the entire linkage animation will playback in the viewer. Note that for linkages with a large number of associated points processing speed may reduce the speed with which the animation can play such that the duration will actually be greater than that specified here.
animate.reverse
Whether the animation should play both forward and reverse.
animate.repeat
The number of times the animation should repeat. A value of -1 (default) causes the animation to play non-stop.
path.connect
A list of vectors, each of which specifies linkage-associated points to connect in sequence with a path. If this is specified in defineLinkage then it does not have to be specified here as it will be already contained within the linkage object.
connect.joints
A logical indicating whether the joints should be connected in the visualization. The connections will correspond to those specified by the input parameter joint.conn to defineLinkage.
window.title
For method "svgViewR", the title that will appear at the top of the '.html' visualization file.
joint.col.fill
The fill color of the points representing linkage joints.
joint.col.stroke
The stroke (outline) color of the points representing linkage joints.
joint.cex
The size of the points representing linkage joints.
joint.lwd
The thickness of the stroke (outline) of the points representing linkage joints.
point.col.fill
The fill color of the linkage-associated points.
point.col.stroke
The stroke (outline) color of the linkage-associated points.
point.cex
The size of the linkage-associated points.
point.lwd
The thickness of the stroke (outline) of the linkage-associated points.
path.col.fill
The fill color of the paths specified by path.connect. By default, the paths are not filled.
path.opacity.fill
The fill opacity of the paths specified by path.connect.
path.opacity.stroke
The stroke (outline) opacity of the paths specified by path.connect.
path.col.stroke
The color of the stroke (outline) opacity of the paths specified by path.connect.
path.lwd
The thickness of the stroke (outline) opacity of the paths specified by path.connect.
add
Logical indicating whether linkage should be added to an existing visualization. This option is still in developement.
...
Additional parameters to be passed to plot device opening functions (e.g. 'jpeg', 'png', 'eps') in the case of method "plot".

Value

NULL

Details

Please see linkR Resources for a tutorial on how to use the linkR package and the linkR example gallery for several examples (code and animations) of different linkages that can be created using linkR.

See Also

animateLinkage, defineLinkage