KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
circle.h
Go to the documentation of this file.
1 // circle.h - routine for fastest possible circle circumference traversal
3 // Author: Doron Tal
4 // Date created: January, 1993
5 
6 #ifndef _CIRCLE_H
7 #define _CIRCLE_H
8 
9 namespace DTLib {
10 
12  // Instantiates into an ImgVec of byte images containing white (255)
13  // over black (0) circles. Images are of variable size, always square,
14  // alwas of odd width = (int)radius*2+1, so drawn circles are perfectly
15  // centered.
16  class CCircleMasks : public CImgVec<BYTE>
17  {
18  public:
19  CCircleMasks(const int& MinRad, const int& MaxRad);
21 
22  inline int GetMinRad() { return m_MinRad; }
23  inline int GetMaxRad() { return m_MinRad+m_nFrames-1; }
24 
25  BYTE* GetCircleMaskBuffer(const int& Rad);
26 
27  private:
28  int m_MinRad;
29  };
30 
32  // returns the number of pixels on the circumference of radius 'radius'
33  int CircumLength(const int& radius);
34 
36 
37  // routine for drawing/traversing circles - pre-computes traversal
38  // of circle as chain code and returns that chain code as a
39  // sequence of positive or negative pointer increments. 'radius'
40  // is the radius of the wanted circle, 'Width' is the number of
41  // columns in the image in which we would traverse the
42  // circumference. RETURNS a list of integers, first integer tells
43  // how many pixels in the rest of the list; rest of list is a
44  // sequence of offsets by which we need to increment the pointer
45  // to the Img in order to traverse the entire circumference. The
46  // pointer to the Img which we need to increment according to the
47  // returned list is at startring position = leftmost point on the
48  // circle, i.e. if the circle's center is at (x,y) and its radius
49  // is 'r', then the pointer to be incremented is (x-r, y). The
50  // circle is traversed CLOCKWISE.
51  int* ComputeCircum(const int& radius, const int& Width);
52 
53 } // namespace DTLib {
54 
55 #endif /* #ifndef _CIRCUM_H */
int m_nFrames
Definition: img.h:568
BYTE * GetCircleMaskBuffer(const int &Rad)
Definition: circle.cpp:45
CCircleMasks(const int &MinRad, const int &MaxRad)
Definition: circle.cpp:20
int GetMinRad()
Definition: circle.h:22
~CCircleMasks()
Definition: circle.h:20
int CircumLength(const int &radius)
Definition: circle.cpp:74
#define BYTE
Definition: utils.h:96
Definition: img.h:42
Definition: circle.h:16
int GetMaxRad()
Definition: circle.h:23
int * ComputeCircum(const int &radius, const int &Width)
Definition: circle.cpp:124