Draw a cylinder. drawCylinder(CYL) Draws the cylinder CYL on the current axis. CYL is a 1-by-7 row vector in the form [x1 y1 z1 x2 y2 z2 r] where: * [x1 y1 z1] are the coordinates of starting point, * [x2 y2 z2] are the coordinates of ending point, * R is the radius of the cylinder drawCylinder(CYL, N) Uses N points for discretizating the circles of the cylinder. Default value is 32. drawCylinder(..., OPT) with OPT = 'open' (default) or 'closed', specify if the bases of the cylinder should be drawn. drawCylinder(..., 'FaceColor', COLOR) Specifies the color of the cylinder. Any couple of parameters name and value can be given as argument, and will be transfered to the 'surf' matlab function drawCylinder(..., 'FaceAlpha', ALPHA) Specifies the transparency of the cylinder and of the optionnal caps. drawCylinder(AX, ...) Specifies the axis to draw on. AX should be a valid axis handle. H = drawCylinder(...) Returns a handle to the patch representing the cylinder. Examples: % basic example figure; drawCylinder([0 0 0 10 20 30 5]); % draw hollow cylinders figure; drawCylinder([0 0 0 10 20 30 5], 'open'); % change cylinder color figure; drawCylinder([0 0 0 10 20 30 5], 'FaceColor', 'r'); % change cylinder color using graphical handle figure; h = drawCylinder([0 0 0 10 20 30 5]); set(h, 'facecolor', 'b'); % Draw three mutually intersecting cylinders p0 = [10 10 10]; p1 = p0 + 80 * [1 0 0]; p2 = p0 + 80 * [0 1 0]; p3 = p0 + 80 * [0 0 1]; figure; axis equal; axis([0 100 0 100 0 100]); hold on drawCylinder([p0 p1 10], 'FaceColor', 'r'); drawCylinder([p0 p2 10], 'FaceColor', 'g'); drawCylinder([p0 p3 10], 'FaceColor', 'b'); axis equal set(gcf, 'renderer', 'opengl') view([60 30]); light; % draw cube skeleton [v, e, f] = createCube; figure; axis equal; axis([-0.2 1.2 -0.2 1.2 -0.2 1.2]); hold on; view(3); cyls = [v(e(:,1), :) v(e(:,2),:) repmat(0.1, size(e, 1), 1)]; drawCylinder(cyls); light See Also: cylinderMesh, drawEllipseCylinder, drawSphere, drawLine3d, surf intersectLineCylinder, cylinderSurfaceArea
Package: matgeom