DRAWSPHERE Draw a sphere as a mesh. drawSphere(SPHERE) Where SPHERE = [XC YC ZC R], draw the sphere centered on the point with coordinates [XC YC ZC] and with radius R, using a quad mesh. drawSphere(CENTER, R) Where CENTER = [XC YC ZC], specifies the center and the radius with two arguments. drawSphere(XC, YC, ZC, R) Specifiy sphere center and radius as four arguments. drawSphere(..., NAME, VALUE); Specifies one or several options using parameter name-value pairs. Available options are usual drawing options, as well as: 'nPhi' the number of arcs used for drawing the meridians 'nTheta' the number of circles used for drawing the parallels H = drawSphere(...) Return a handle to the graphical object created by the function. [X Y Z] = drawSphere(...) Return the coordinates of the vertices used by the sphere. In this case, the sphere is not drawn. Example % Draw four spheres with different centers figure(1); clf; hold on; drawSphere([10 10 30 5]); drawSphere([20 30 10 5]); drawSphere([30 30 30 5]); drawSphere([30 20 10 5]); view([-30 20]); axis equal; l = light; % Draw sphere with different settings figure(1); clf; drawSphere([10 20 30 10], 'linestyle', ':', 'facecolor', 'r'); axis([0 50 0 50 0 50]); axis equal; l = light; % The same, but changes style using graphic handle figure(1); clf; h = drawSphere([10 20 30 10]); set(h, 'linestyle', ':'); set(h, 'facecolor', 'r'); axis([0 50 0 50 0 50]); axis equal; l = light; % Draw a sphere with high resolution figure(1); clf; h = drawSphere([10 20 30 10], 'nPhi', 360, 'nTheta', 180); l = light; view(3); See also spheres, circles3d, sphere, drawEllipsoid
Package: matgeom