Estimates the radius of a circle centered at the origin from a set of 2D points. More...
#include <FitCircleInOrigin.hpp>
 Inheritance diagram for TRTK::FitCircleInOrigin< T >:
 Inheritance diagram for TRTK::FitCircleInOrigin< T >: Collaboration diagram for TRTK::FitCircleInOrigin< T >:
 Collaboration diagram for TRTK::FitCircleInOrigin< T >:| Public Types | |
| typedef super::Vector2T | Vector2T | 
| 2D column vector with value type T. | |
| typedef super::Vector3T | Vector3T | 
| 3D column vector with value type T. | |
| typedef super::MatrixXT | MatrixXT | 
| Matrix of arbitrary size with value type T. | |
| typedef super::Matrix2T | Matrix2T | 
| 2 x 2 matrix with value type T. | |
| typedef super::VectorXT | VectorXT | 
| Column vector of arbitrary size with value type T. | |
| enum | Error { DATA_POINTS_TOO_SIMILAR, INFINITY_NOT_AVAILABLE, NAN_NOT_AVAILABLE, NOT_ENOUGH_POINTS, UNKNOWN_ERROR, WRONG_POINT_SIZE } | 
| typedef Eigen::Array< T, Eigen::Dynamic, 1 > | ArrayXT | 
| General-purpose array of arbitrary size with value type T. | |
| typedef Eigen::Matrix< T, 4, 1 > | Vector4T | 
| 4D column vector with value type T. | |
| typedef Eigen::Matrix< T, 3, 3 > | Matrix3T | 
| 3 x 3 matrix with value type T. | |
| Public Member Functions | |
| FitCircleInOrigin () | |
| Constructs an empty FitCircleInOrigin object. | |
| FitCircleInOrigin (const std::vector< Coordinate< T > > &points) | |
| Constructs a FitCircleInOrigin object. | |
| FitCircleInOrigin (const std::vector< Vector2T, Eigen::aligned_allocator< Vector2T > > &points) | |
| Constructs a FitCircleInOrigin object. | |
| FitCircleInOrigin (const std::vector< Vector3T > &points) | |
| Constructs an FitCircleInOrigin object. | |
| virtual | ~FitCircleInOrigin () | 
| Destructs the FitCircleInOrigin object. | |
| void | compute () | 
| Runs the fitting algorithm. | |
| unsigned | getNumberPointsRequired () const | 
| Returns the minimum number of data points required to compute a model. | |
| const Coordinate< T > & | getCenterPoint () const | 
| Returns the center point of the plane. | |
| T | getDistanceTo (const Coordinate< T > &point) const | 
| Returns the shortest distance from the circle to the given point. | |
| T | getRadius () const | 
| Returns the radius of the circle. | |
| T | getRMS () const | 
| Returns the root mean square error. | |
| void | setPoints (const std::vector< Coordinate< T > > &) | 
| Sets the point set. | |
| void | setPoints (const std::vector< Vector2T, Eigen::aligned_allocator< Vector2T > > &) | 
| Sets the point set. | |
| void | setPoints (const std::vector< Vector3T > &) | 
| Sets the point set. | |
| Public Attributes | |
| EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef T | value_type | 
| Internally used value type (should be a floating point type). | |
| Protected Attributes | |
| MatrixXT | m_points | 
Estimates the radius of a circle centered at the origin from a set of 2D points.
| T | scalar type of the coordinates | 
This class allows estimating the radius of a circle from known points on the circle. The points may be erroneous since a least square fitting is done.
Here is an more elaborate example to see how to use the class:
#include <iostream> #include <TRTK/FitCircleInOrigin.hpp> #include <TRTK/Tools.hpp> using namespace TRTK; int main() { double pi = 3.1415926535; std::vector<Coordinate<double> > circlePoints; //Construct some points lying on a circle. double radius = 7; for (double phi = 0.0; phi < 2.0 * pi; phi += pi/10) { using std::sin; using std::cos; using Tools::randn; double x = radius * cos(phi) + randn(0.0, 0.1); double y = radius * sin(phi) + randn(0.0, 0.1); Coordinate<double> point(x, y); circlePoints.push_back(point); } // Estimate the circle parameters. FitCircleInOrigin<double> fitCircleInOrigin(circlePoints); fitCircleInOrigin.compute(); std::cout << "Radius: " << fitCircleInOrigin.getRadius() << std::endl; return 0; }
Output:
Radius: 7.03625
Definition at line 105 of file FitCircleInOrigin.hpp.
| enum TRTK::Fit::Error  [inherited] | 
| TRTK::FitCircleInOrigin< T >::FitCircleInOrigin | ( | ) | 
Constructs an empty FitCircleInOrigin object.
| T | scalar type of the coordinates | 
Definition at line 149 of file FitCircleInOrigin.hpp.
| TRTK::FitCircleInOrigin< T >::FitCircleInOrigin | ( | const std::vector< Coordinate< T > > & | points ) | 
Constructs a FitCircleInOrigin object.
| T | scalar type of the coordinates | 
| [in] | points | Points lying on the circle. The points can be 2D or 3D homogeneous coordinates. | 
Definition at line 165 of file FitCircleInOrigin.hpp.
| TRTK::FitCircleInOrigin< T >::FitCircleInOrigin | ( | const std::vector< Vector2T, Eigen::aligned_allocator< Vector2T > > & | points ) | 
Constructs a FitCircleInOrigin object.
| T | scalar type of the coordinates | 
| [in] | points | Points lying on the circle. | 
Definition at line 181 of file FitCircleInOrigin.hpp.
| TRTK::FitCircleInOrigin< T >::FitCircleInOrigin | ( | const std::vector< Vector3T > & | points ) | 
Constructs an FitCircleInOrigin object.
| T | scalar type of the coordinates | 
| [in] | points | Points lying on the circle. The points are assumed to be homogeneous coordinates, whose third coordinate entry is equal to one. | 
Definition at line 199 of file FitCircleInOrigin.hpp.
| TRTK::FitCircleInOrigin< T >::~FitCircleInOrigin | ( | ) |  [virtual] | 
Destructs the FitCircleInOrigin object.
| T | scalar type of the coordinates | 
Definition at line 213 of file FitCircleInOrigin.hpp.
| void TRTK::FitCircleInOrigin< T >::compute | ( | ) |  [virtual] | 
Runs the fitting algorithm.
| T | scalar type of the coordinates | 
| ErrorObj | If there are no points to fit the circle, an error object is thrown and its error code is set to NOT_ENOUGH_POINTS. | 
Implements TRTK::Fit2D< T >.
Definition at line 230 of file FitCircleInOrigin.hpp.
| const Coordinate< T > & TRTK::FitCircleInOrigin< T >::getCenterPoint | ( | ) | const | 
Returns the center point of the plane.
| T | scalar type of the coordinates | 
Definition at line 269 of file FitCircleInOrigin.hpp.
| T TRTK::FitCircleInOrigin< T >::getDistanceTo | ( | const Coordinate< T > & | point ) | const  [virtual] | 
Returns the shortest distance from the circle to the given point.
| T | scalar type of the coordinates | 
| [in] | point | A 2D coordinate. | 
Implements TRTK::Fit2D< T >.
Definition at line 283 of file FitCircleInOrigin.hpp.
| T TRTK::FitCircleInOrigin< T >::getRadius | ( | ) | const | 
Returns the radius of the circle.
| T | scalar type of the coordinates | 
Definition at line 305 of file FitCircleInOrigin.hpp.
| T TRTK::FitCircleInOrigin< T >::getRMS | ( | ) | const  [virtual] | 
Returns the root mean square error.
| T | scalar type of the coordinates | 
Implements TRTK::Fit2D< T >.
Definition at line 317 of file FitCircleInOrigin.hpp.
| void TRTK::Fit2D< T >::setPoints | ( | const std::vector< Vector2T, Eigen::aligned_allocator< Vector2T > > & | points ) |  [inherited] | 
| void TRTK::Fit2D< T >::setPoints | ( | const std::vector< Coordinate< T > > & | points ) |  [virtual, inherited] | 
Sets the point set.
| T | scalar type of the coordinates | 
| [in] | points | The points can either be plain 2D or 3D homogeneous coordinates. | 
| ErrorObj | If there are any coordinates other than 2D or 3D coordinates, an error object is thrown and its error code is set to WRONG_POINT_SIZE. | 
Implements TRTK::Fit< T >.
| void TRTK::Fit2D< T >::setPoints | ( | const std::vector< Vector3T > & | points ) |  [inherited] | 
Sets the point set.
| T | scalar type of the coordinates | 
| [in] | points | 3D homogeneous coordinates. | 
Documentation generated by Doxygen