|
||||
File indexing completed on 2024-04-06 12:28:37
0001 #ifndef RecoTracker_PixelTrackFitting_CircleFromThreePoints_h 0002 #define RecoTracker_PixelTrackFitting_CircleFromThreePoints_h 0003 0004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h" 0005 #include "DataFormats/GeometryVector/interface/Basic2DVector.h" 0006 0007 /** Computes the curvature (1/radius) and, if possible, the center 0008 * of the circle passing through three points. 0009 * The input points are three dimensional for convenience, but the 0010 * calculation is done in the transverse (x,y) plane. 0011 * No verification of the reasonableness of the z coordinate is done. 0012 * If the three points lie on a line the curvature is zero and the center 0013 * position is undefined. The 3 points are assumed to make sense: 0014 * if the distance between two of them is very small compared to 0015 * the ditance to the third the result will be numerically unstable. 0016 */ 0017 0018 class CircleFromThreePoints { 0019 public: 0020 /// dummy 0021 CircleFromThreePoints() {} 0022 0023 typedef Basic2DVector<float> Vector2D; 0024 0025 /** Construct from three points (see class description). 0026 * The order of points is not essential, but accuracy should be better if 0027 * the second point lies between the other two on the circle. 0028 * The optional argument "precision" specifies how accurately the 0029 * straight line check has to be satisfied for setting the curvature 0030 * to zero and the center position to "undefined". 0031 */ 0032 CircleFromThreePoints(const GlobalPoint& inner, 0033 const GlobalPoint& mid, 0034 const GlobalPoint& outer, 0035 double precision = 1.e-7); 0036 0037 /** Returns the curvature (1/radius), in cm^(-1). 0038 * The curvature is precomputed, this is just access method (takes no time). 0039 * If curvature is zero the center is undefined 0040 * (see description of presicion above). 0041 */ 0042 float curvature() const { return theCurvature; } 0043 0044 /** returns the position of the center of the circle. 0045 * If curvature is zero, center() throws an exception to avoid use of 0046 * undefined position. 0047 * If the curvature is very small the position of the center will 0048 * be very inaccurate. 0049 */ 0050 Vector2D center() const { return theCenter; } 0051 0052 private: 0053 float theCurvature; 0054 Vector2D theCenter; 0055 0056 void init(const Vector2D& b, const Vector2D& c, const Vector2D& offset, double precision); 0057 }; 0058 0059 #endif // RecoTracker_PixelTrackFitting_CircleFromThreePoints_h
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |