M-File Help: plot_sphere

M-File Help: plot_sphere | View code for plot_sphere

# plot_sphere

Draw sphere

plot_sphere(C, R, ls) draws spheres in the current plot. C is the centre of the sphere (3x1), R is the radius and ls is an optional MATLAB color spec, either a letter or a 3-vector.

H = plot_sphere(C, R, color) as above but returns the handle(s) for the spheres.

H = plot_sphere(C, R, color, alpha) as above but alpha specifies the opacity of the sphere were 0 is transparant and 1 is opaque. The default is 1.

If C (3xN) then N sphhere are drawn and H is Nx1. If R (1x1) then all spheres have the same radius or else R (1xN) to specify the radius of each sphere.

## Example

Create four spheres

    plot_sphere( mkgrid(2, 1), .2, 'b')

and now turn on a full lighting model

    lighting gouraud
    light

## NOTES

- The sphere is always added, irrespective of figure hold state.
- The number of vertices to draw the sphere is hardwired.

© 1990-2014 Peter Corke.