Fawkes API  Fawkes Development Version
fc_accum.h
1 /***************************************************************************
2  * fc_accum.h - Header for 'fitted circle' accumulator
3  * used by Randomized Stable Circle Fitting Algorithm
4  *
5  * Created: Fri Sep 09 22:47:55 2005
6  * Copyright 2005 Hu Yuxiao <Yuxiao.Hu@rwth-aachen.de>
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _FIREVISION_MODELS_SHAPE_ACCUMULATORS_FC_ACCUM_H_
25 #define _FIREVISION_MODELS_SHAPE_ACCUMULATORS_FC_ACCUM_H_
26 
27 #include <fvmodels/shape/circle.h>
28 #include <fvutils/base/types.h>
29 #include <utils/math/types.h>
30 
31 namespace firevision {
32 
34 {
35 private:
36  static const float TOO_SMALL_DELTA;
37 
38 private:
39  int count;
40  /// @cond INTERNALS
41  struct circle_matrix
42  {
43  float A00, A01, A02;
44  float A10, A11, A12;
45  float A20, A21, A22;
46 
47  float b0, b1, b2;
48  } circle_matrices[2];
49  /// @endcond
50  int current_circle;
51  bool point_added;
52 
53 public:
54  FittedCircle(void);
55  ~FittedCircle(void);
56 
57  void reset(void);
58  float addPoint(const fawkes::upoint_t &); // add a new point
59  // and return the distance from it to the fitted circle
60  void removePoint(const fawkes::upoint_t &); // remove a point
61 
62  float distanceTo(const fawkes::upoint_t &, bool current = true);
63 
64  void commit(void);
65  int getCount(void) const;
66  Circle *getCircle(void) const;
67 
68 private:
69  Circle *fitCircle(circle_matrix *p) const;
70 };
71 
72 } // end namespace firevision
73 
74 #endif
FittedCircle accumulator.
Definition: fc_accum.h:33
void reset(void)
Reset.
Definition: fc_accum.cpp:52
Circle shape.
Definition: circle.h:42
int getCount(void) const
Get count.
Definition: fc_accum.cpp:169
void commit(void)
Commit.
Definition: fc_accum.cpp:156
FittedCircle(void)
Constructor.
Definition: fc_accum.cpp:40
float addPoint(const fawkes::upoint_t &)
Add point.
Definition: fc_accum.cpp:70
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
Circle * getCircle(void) const
Get circle.
Definition: fc_accum.cpp:178
~FittedCircle(void)
Destructor.
Definition: fc_accum.cpp:46
void removePoint(const fawkes::upoint_t &)
Remove point.
Definition: fc_accum.cpp:111
float distanceTo(const fawkes::upoint_t &, bool current=true)
Distance.
Definition: fc_accum.cpp:140