Singleton class which provides the mid-point circle algorithm implementation. More...
#include <circle_provider.h>
Public Member Functions | |
| void | getCircle (int radius, std::vector< bool > &points, bool connect4=true) |
| Returns the circle in the form of a boolean array. The array represents a box with the locations of the circle set to true. | |
| void | printCircle (const std::vector< bool > &points, int radius) |
| Prints a given circle to the screen, useful for debugging. | |
Static Public Member Functions | |
| static CircleProvider & | getInstance () |
| Returns the singleton instance. | |
Private Member Functions | |
| CircleProvider () | |
| Private constructor for singleton instance. | |
| CircleProvider (CircleProvider const &) | |
| Unimplemented copy constructor. | |
| void | operator= (CircleProvider const &) |
| Unimplemented assignment operator. | |
| void | plot4Points (int x, int y, std::vector< bool > &points, int radius) |
| given an (x,y) in the first octant, plots this value in all quadrants. See getCircle for description of the parameters | |
| void | plot8Points (int x, int y, std::vector< bool > &points, int radius) |
| given an (x,y) in the first octant, plots mirrored values along all 8 octants. See getCircle for description of the parameters | |
Singleton class which provides the mid-point circle algorithm implementation.
Definition at line 54 of file circle_provider.h.
| bwi_mapper::CircleProvider::CircleProvider | ( | ) | [inline, private] |
Private constructor for singleton instance.
Definition at line 91 of file circle_provider.h.
| bwi_mapper::CircleProvider::CircleProvider | ( | CircleProvider const & | ) | [private] |
Unimplemented copy constructor.
| void bwi_mapper::CircleProvider::getCircle | ( | int | radius, |
| std::vector< bool > & | points, | ||
| bool | connect4 = true |
||
| ) |
Returns the circle in the form of a boolean array. The array represents a box with the locations of the circle set to true.
| radius | radius of the desired circle (pixels) |
| points | reference returning which points in a box of size (2*radius + 1)^2 are part of the circle. The vector represents the box in row major form, with the 0th element starting at (-radius, -radius) |
| connect4 | boolean value when true returns a 4 connected circle. If false, a 8-connected circle is returned. |
Definition at line 56 of file circle_provider.cpp.
| CircleProvider & bwi_mapper::CircleProvider::getInstance | ( | ) | [static] |
Returns the singleton instance.
Definition at line 47 of file circle_provider.cpp.
| void bwi_mapper::CircleProvider::operator= | ( | CircleProvider const & | ) | [private] |
Unimplemented assignment operator.
| void bwi_mapper::CircleProvider::plot4Points | ( | int | x, |
| int | y, | ||
| std::vector< bool > & | points, | ||
| int | radius | ||
| ) | [private] |
given an (x,y) in the first octant, plots this value in all quadrants. See getCircle for description of the parameters
Definition at line 115 of file circle_provider.cpp.
| void bwi_mapper::CircleProvider::plot8Points | ( | int | x, |
| int | y, | ||
| std::vector< bool > & | points, | ||
| int | radius | ||
| ) | [private] |
given an (x,y) in the first octant, plots mirrored values along all 8 octants. See getCircle for description of the parameters
Definition at line 103 of file circle_provider.cpp.
| void bwi_mapper::CircleProvider::printCircle | ( | const std::vector< bool > & | points, |
| int | radius | ||
| ) |
Prints a given circle to the screen, useful for debugging.
| points | circle returned by getCircle |
| radius | radius of the circle. should be same as that supplied to getCircle to construct points |
Definition at line 82 of file circle_provider.cpp.