gml_Bresenham.h

00001 /** 
00002  *   @file gml_Bresenham.h
00003  * 
00004  *     Implement various flavors of Bresenham's line and circle scan-converting algorithms.
00005  * 
00006  *   Copyright (c) 2002-2004 CLIPS-IMAG
00007  * 
00008  *   See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00009  *   of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  * 
00011  *   Created in April 2003 (JL).
00012  *   Updated to GML in February 2004 (JL).
00013  */
00014 
00015 #ifndef __GML_BRESENHAM__
00016 #define __GML_BRESENHAM__
00017 
00018 #include "gml/image/gml_Geometry.h"
00019 #include "gml/base/gml_Errors.h"
00020 #include "gml/base/gml_Types.h"
00021 
00022 /**
00023  *  gml_Bresenham_DiscPoints --
00024  * 
00025  *  Scan-convert a disc of radius <radius>.
00026  *  For a disc of radius <radius>, centered on (0,0) (odd diameter),
00027  *  compute, using Bresenham's algorithm:
00028  *  @arg in <area> the total number of pixels in the circle;
00029  *  @arg in <abscissa> the extremal x value for each y, 
00030  *       such as dest[y-radius] == x.
00031  *  
00032  *  <abscissa> should be freed by the caller.
00033  */
00034 gml_TError gml_Bresenham_DiscPoints (SInt32 radius, UInt32 &area, UInt32* &abscissa);
00035 
00036 
00037 /**
00038  *  gml_Bresenham_CirclePoints --
00039  * 
00040  *  Scan-convert a circle of radius <radius>.
00041  *  For a circle of radius <radius>, centered on `0,0', (odd diameter)
00042  *  compute, using Bresenham's algorithm:
00043  *  @arg in <points> a counter-clockwise ordered list of circle points
00044  *       coordinates;
00045  *  @arg in <npoints> the number of points.
00046  *  
00047  *  <points> should be freed by caller.
00048  */
00049 gml_TError gml_Bresenham_CirclePoints (SInt32 radius, gml_TPoint* &points, UInt32 &npoints);
00050 
00051 
00052 /**
00053  *  gml_Bresenham_DiscMask --
00054  * 
00055  *  Build a row-major bytemap of side 2 * <radius> + 1 in <mask>, representing
00056  *  a disc of radius <radius>.
00057  *  Each byte will be set to `0xFF' if the corresponding point is inside the disc
00058  *  and to `0x00' if it isn't.
00059  */
00060 gml_TError gml_Bresenham_DiscMask (SInt32 radius, UInt8* &mask, UInt32 &npoints);
00061 
00062 
00063 /**
00064  *  gml_Bresenham_CircleMask --
00065  * 
00066  *  Build a row-major bytemap of side 2 * <radius> + 1 in <mask>, representing
00067  *  a circle of radius <radius>.
00068  *  Each byte will be set to 0, if the point isn't on the circle; else it will
00069  *  be set to the point's index on the circle (in counter-clockwise order, as
00070  *  given by the gml_Bresenham_CirclePoints() procedure.
00071  */
00072 gml_TError gml_Bresenham_CircleMask (SInt32 radius, UInt8* &mask, UInt32 &npoints);
00073 
00074 #endif /* __GML_BRESENHAM__ */
00075 
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.