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 \(4 n_{patch}\) 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 \((\pm 1,\pm 1,\pm 1)\) cube:
swplot.figure
N = 100;
swplot.cylinder(2*rand(3,N)-1,2*rand(3,N)-1,0.1,100,true)
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 \([3\times n_{obj}]\).
rEnd
- Coordinate of the end point or multiple end points in a matrix with dimensions \([3\times n_{obj}]\).
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 \(4n_{patch}\) number of faces and \(2n_{patch}\) number of vertices. close
- If
true
the cylinder is closed at both ends. Default istrue
.