mask_circle

PURPOSE ^

Creates an image of a 'pie slice' of a circle.

SYNOPSIS ^

function mask = mask_circle( angle_start, angle_size, r, nsamples )

DESCRIPTION ^

 Creates an image of a 'pie slice' of a circle.

 Creates a 2D array of size (2rx2r) with values between 0 and 1.  Specifically, mask has
 values 1 inside the pie slice of the circle defined by angle_start and angle_size.  For
 example, using angle_start=-pi/4 and angle_size=pi/2 would give a quarter circle facing
 right.  nsample conrols the accuracty of the circle at its boundaries.  That is if
 nsamples>1, pixels at the boundary which will have fractions values (when a pixel should
 be say half inside the circle and half outside of the circle).  Note that running time
 is O(nsamples^2*radius^2), so don't use a value that is too high for either.  A series
 of masks whose angles together go from 0-2pi will sum exactly to form a radius r circle.
 r may be either an integer, or an integer + .5.  A pixel is considered to belong to the
 circle iff it is within the given angle and has a value strictly smaller then r.
 
 INPUTS
   angle_start       - start position of circle
   angle_size        - number of radians to continue circle for
   r                 - mask radius (integer or integer+.5)
   nsamples          - [optional] controls sampling accuracy [1 by default]

 OUTPUTS
   mask      - the created image, size 2r by 2r

 EXAMPLE
   mask1 = mask_circle( -pi/8, pi/4, 20, 20 ); figure(1); im(mask1); 
   mask2 = mask_circle( pi/8, pi/8, 20, 20 );  figure(2); im(mask2); 
   figure(3); im(mask1+mask2);

 DATESTAMP
   29-Sep-2005  2:00pm

 See also MASK_ELLIPSE

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-May-2006 23:48:50 by m2html © 2003