Syntax

hPatch = swplot.cylinder(rStart, rEnd, R)

hPatch = swplot.cylinder(rStart, rEnd, R, nPatch, close)

hPatch = swplot.cylinder(handle, ...)

Description

hPatch = swplot.cylinder(rStart, rEnd, R) generates multiple cylinders with a single triangular patch command. The cylinders are defined by start and end positions and their radii.

hPatch = swplot.cylinder(rStart, rEnd, R, nPatch, close) creates cylinders with number of patch faces per arrow.

Handle can be the handle of an axes object or a patch object. It either selects an axis to plot or a patch object (triangulated) to add vertices and faces.

Examples

Draw 100 random cylinders within the cube:

swplot.figure
N = 100;
swplot.cylinder(2*rand(3,N)-1,2*rand(3,N)-1,0.1,100,true)
swplot.zoom(30)
swplot.zoom(30)

Input Arguments

handle
Handle of an axis or patch object. In case of patch object, the constructed faces will be added to the existing object instead of creating a new one.
rStart
Coordinate of the starting point or multiple starting points in a matrix with dimensions .
rEnd
Coordinate of the end point or multiple end points in a matrix with dimensions .
R
Radius of the arrow body, scalar.
nPatch
Number of points on the circle of the body, default value is stored in swpref.getpref('npatch'). The final patch object will have number of faces and number of vertices.
close
If true the cylinder is closed at both ends. Default is true.

See Also

swplot.arrow