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 <utils/math/types.h>
28 #include <fvutils/base/types.h>
29 #include <fvmodels/shape/circle.h>
30 
31 namespace firevision {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
37 {
38  private:
39  static const float TOO_SMALL_DELTA;
40 
41 private:
42  int count;
43  /// @cond INTERNALS
44  struct circle_matrix
45  {
46  float A00, A01, A02;
47  float A10, A11, A12;
48  float A20, A21, A22;
49 
50  float b0, b1, b2;
51  } circle_matrices[2];
52  /// @endcond
53  int current_circle;
54  bool point_added;
55 
56  public:
57  FittedCircle(void);
58  ~FittedCircle(void);
59 
60  void reset(void);
61  float addPoint(const fawkes::upoint_t&); // add a new point
62  // and return the distance from it to the fitted circle
63  void removePoint(const fawkes::upoint_t&); // remove a point
64 
65  float distanceTo(const fawkes::upoint_t&, bool current = true);
66 
67  void commit(void);
68  int getCount(void) const;
69  Circle* getCircle(void) const;
70 
71  private:
72  Circle* fitCircle(circle_matrix* p) const;
73 };
74 
75 } // end namespace firevision
76 
77 #endif
FittedCircle accumulator.
Definition: fc_accum.h:36
void reset(void)
Reset.
Definition: fc_accum.cpp:55
Circle shape.
Definition: circle.h:45
int getCount(void) const
Get count.
Definition: fc_accum.cpp:184
void commit(void)
Commit.
Definition: fc_accum.cpp:170
FittedCircle(void)
Constructor.
Definition: fc_accum.cpp:43
float addPoint(const fawkes::upoint_t &)
Add point.
Definition: fc_accum.cpp:75
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
Circle * getCircle(void) const
Get circle.
Definition: fc_accum.cpp:194
~FittedCircle(void)
Destructor.
Definition: fc_accum.cpp:49
void removePoint(const fawkes::upoint_t &)
Remove point.
Definition: fc_accum.cpp:120
float distanceTo(const fawkes::upoint_t &, bool current=true)
Distance.
Definition: fc_accum.cpp:150