00001
00002
00003
00004
00005
00006
00007
00008 #include "Tools/RingBufferWithSum.h"
00009
00010 #ifndef _CircleCalculation_h_
00011 #define _CircleCalculation_h_
00012
00013 #include "Tools/Math/Geometry.h"
00014 #include "Tools/Boundary.h"
00015 #include "Tools/Debugging/DebugDrawings.h"
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "Tools/Math/Vector2.h"
00025
00026 class CircleCalculation
00027 {
00028 public:
00029
00030
00031
00032 struct BallPoint : Vector2<int>
00033 {
00034 bool isBottom;
00035 };
00036
00037 void init();
00038
00039 bool createCircle(int set, Geometry::Circle& circle);
00040 void addBallPoint(int set, int x, int y, bool isBottom);
00041 int getNumberOfBallPoints(int set);
00042 bool getBoundary(Boundary<int>& ballBoundary, int set);
00043 int paintBallPoints(
00044 int set,
00045 int minIndex,
00046 int drawingID,
00047 Drawings::Color color,
00048 int size);
00049 private:
00050 bool select3Points(int& point1, int& point2, int& point3, int set);
00051
00052 Vector2<int> cutMiddlePerpendiculars(
00053 Vector2<int>& v1,
00054 Vector2<int>& v2,
00055 Vector2<int>& v3) const;
00056
00057 enum {maxNumberOfBallPoints = 400};
00058
00059 enum {numberOfBallPointSets = 2};
00060
00061 BallPoint ballPoints[maxNumberOfBallPoints][numberOfBallPointSets];
00062 int numberOfBallPoints[numberOfBallPointSets];
00063 };
00064
00065 #endif // _CircleCalculation_h_
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084