Belle II Software development
|
A generalized circle. More...
#include <GeneralizedCircle.h>
Public Member Functions | |
GeneralizedCircle () | |
Default constructor for ROOT compatibility. | |
GeneralizedCircle (double n0, double n1, double n2, double n3=0) | |
Constructor with the four parameters of the generalized circle. | |
GeneralizedCircle (double n0, const Vector2D &n12, double n3=0) | |
Constructor with the four parameters of the generalized circle. | |
GeneralizedCircle (const Line2D &n012) | |
Constructor from a two dimensional line. | |
GeneralizedCircle (const Circle2D &circle) | |
Constructor from a two dimensional circle. | |
void | setCenterAndRadius (const Vector2D ¢er, double absRadius, ERotation orientation=ERotation::c_CounterClockwise) |
Setter for the circle center and radius. | |
void | setPerigeeParameters (double curvature, const Vector2D &tangential, double impact) |
Setter for the perigee parameters. | |
void | setPerigeeParameters (const double curvature, const double tangentialPhi, const double impact) |
Setter for the perigee parameters. | |
void | setN (const double n0, const double n1, const double n2, const double n3=0.0) |
Setter for all four circle parameters. | |
void | setN (const double n0, const Vector2D &n12, const double n3=0.0) |
Setter for all four circle parameters. | |
void | setN (const Line2D &n012) |
Setter for all four circle parameters from another circle. | |
void | setN (const GeneralizedCircle &n0123) |
Setter for all four circle parameters from another circle. | |
void | invalidate () |
Sets all circle parameters to zero. | |
void | reverse () |
Flips the orientation of the circle in place. | |
void | conformalTransform () |
Transforms the generalized circle to conformal space inplace Applies the conformal map in the self-inverse form X = x / (x^2 + y^2) and Y = y / (x^2 +y^2) inplace It works most easily by the exchange of the circle parameters n0 <-> n3. | |
void | passiveMoveBy (const Vector2D &by) |
Moves the coordinate system by the given vector. | |
double | n0 () const |
Getter for the first circle parameter. | |
double | n1 () const |
Getter for the second circle parameter. | |
double | n2 () const |
Getter for the third circle parameter. | |
const Vector2D & | n12 () const |
Getter for the second and third circle parameter which natuarally from a vector. | |
double | n3 () const |
Getter for the fourth circle parameter. | |
bool | isInvalid () const |
Indicates if all circle parameters are zero. | |
bool | isValid () const |
Indicates if the combination of the circle parameters makes up a valid circle. | |
double | normalizationSquared () const |
Calculates the generalized circle specific squared norm. | |
GeneralizedCircle | reversed () const |
Returns a copy of the circle with opposite orientation. | |
GeneralizedCircle | conformalTransformed () const |
Returns a copy of the circle in conformal space. | |
Vector2D | gradient (const Vector2D &point) const |
Gradient of the distance field Gives the gradient of the approximated distance field for the given point. | |
Vector2D | normal (const Vector2D &point) const |
Normal vector to the circle near the given position. | |
Vector2D | tangential (const Vector2D &point) const |
Tangential vector to the circle near the given position. | |
Vector2D | closest (const Vector2D &point) const |
Closest approach on the circle to the point. | |
Vector2D | perigee () const |
Calculates the closest approach to the two dimensional origin. | |
Vector2D | apogee () const |
Calculates the point on the circle that is furthest away from the origin. | |
EForwardBackward | isForwardOrBackwardOf (const Vector2D &from, const Vector2D &to) const |
Calculates if the to vector is closer to the from vector following the along orientation of the circle or against. | |
Vector2D | chooseNextForwardOf (const Vector2D &start, const Vector2D &end1, const Vector2D &end2) const |
Returns the end point which is first reached if one follows the forward direction of the circle starting from the start point. | |
std::pair< Belle2::TrackFindingCDC::Vector2D, Belle2::TrackFindingCDC::Vector2D > | atCylindricalR (double cylindricalR) const |
Calculates the two points with the given cylindrical radius on the generalised circle. | |
Vector2D | atCylindricalRForwardOf (const Vector2D &startPoint, double cylindricalR) const |
Approach on the circle with the given cylindrical radius that lies in the forward direction of a start point. | |
double | fastDistance (const Vector2D &point) const |
Approximate distance. | |
double | fastImpact () const |
Approximate distance to the origin. | |
double | distance (const Vector2D &point) const |
Gives the proper distance of the point to the circle line retaining the sign of the fast distance. | |
double | distance (double fastDistance) const |
Helper function to translate the fast linearized distance measure of the generalized circle to the proper distance from the circle retaining the sign of the distance. | |
double | fastDistance (const double distance) const |
Helper function to translate the proper distance to the linearized distance measure of the generalized circle retaining the sign of the distance. | |
double | impact () const |
Gives the signed distance of the origin to the circle. | |
double | d0 () const |
Getter for the absolute distance to the z axes at the support point. | |
Vector2D | tangential () const |
Gives the tangential vector at the closest approach to the origin / at the perigee. | |
double | tangentialPhi () const |
Gives to azimuth angle phi of the direction of flight at the perigee. | |
double | minimalCylindricalR () const |
Gives the minimal cylindrical radius the circle reaches (unsigned) | |
double | maximalCylindricalR () const |
Gives the maximal cylindrical radius the circle reaches. | |
double | absDistance (const Vector2D &point) const |
Gives the proper absolute distance of the point to the circle line. | |
ERightLeft | isRightOrLeft (const Vector2D &point) const |
Indicates if the point is on the right or left side of the circle. | |
bool | isLeft (const Vector2D &rhs) const |
Return if the point given is left of the line. | |
bool | isRight (const Vector2D &rhs) const |
Return if the point given is right of the line. | |
bool | isLine () const |
Indicates if the generalized circle is actually a line. | |
bool | isCircle () const |
Indicates if the generalized circle is actually a circle. | |
double | radius () const |
Gives the signed radius of the circle. If it was a line this will be infinity. | |
double | absRadius () const |
Gives the signed radius of the circle. If it was a line this will be infinity. | |
double | curvature () const |
Gives the signed curvature of the generalized circle. | |
double | omega () const |
Gives the omega parameter as used by the framework helix. | |
Vector2D | center () const |
Gives the center of the circle. If it was a line both components will be infinity. | |
double | perimeter () const |
Gives the perimeter of the circle. | |
ERotation | orientation () const |
Gives the orientation of the circle. | |
double | arcLengthPeriod () const |
Getter for the arc length for a full round of the circle. | |
double | arcLengthBetween (const Vector2D &from, const Vector2D &to) const |
Calculates the arc length between two points of closest approach on the circle. | |
double | arcLengthTo (const Vector2D &to) const |
Calculates the arc length between the perigee and the given point. | |
double | arcLengthToCylindricalR (double cylindricalR) const |
Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can not be reached return NAN. | |
double | arcLengthFactor (const double directDistance) const |
Helper function the calculate the factor between the length of a secant line and the length on the arc. | |
std::pair< Vector2D, Vector2D > | intersections (const GeneralizedCircle &generalizedCircle) const |
Calculates the two points common to both circles. | |
Vector2D | atArcLength (double arcLength) const |
Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee) | |
Static Public Member Functions | |
static GeneralizedCircle | fromCenterAndRadius (const Vector2D ¢er, double absRadius, ERotation orientation=ERotation::c_CounterClockwise) |
Constructor from center, radius and a optional orientation. | |
static GeneralizedCircle | fromPerigeeParameters (double curvature, const Vector2D &tangential, double impact) |
Constructor of a generalized circle from perigee parameters. | |
static GeneralizedCircle | fromPerigeeParameters (double curvature, double tangentialPhi, double impact) |
Constructor of a generalized circle from perigee parameters. | |
static double | arcLengthFactor (double directDistance, double curvature) |
Helper function the calculate the factor between the length of a secant line and the length on the arc. | |
Protected Member Functions | |
void | setN0 (const double n0) |
Setter for first circle parameter. | |
void | setN1 (const double n1) |
Setter for second circle parameter. | |
void | setN2 (const double n2) |
Setter for third circle parameter. | |
void | setN12 (const double n1, const double n2) |
Setter for second and third circle parameter. | |
void | setN12 (const Vector2D &n12) |
Setter for second and third circle parameter. | |
void | setN3 (const double n3) |
Setter for fourth circle parameter. | |
void | normalize () |
Normalizes the circle parameters. | |
Private Member Functions | |
void | scaleN (const double factor) |
Scales the circle parameters by a common factor. | |
Private Attributes | |
double | m_n3 |
Memory for the fourth parameter. | |
Vector2D | m_n12 |
Memory for the second and third parameter. | |
double | m_n0 |
Memory for the first parameter. | |
A generalized circle.
Makes a smooth generalization from a two dimensional normal line ( like Line2D ) to a circle.
The parameterisation is best suited for low curvature circle. The representation takes four parameters. They correspond to the normal circle parameters like
n0 = (m_x*m_x + m_y*m_y - r*r)/2r
n1 = -m_x/r
n2 = -m_y/r
n3 = 1/2r
where the normalization condition is n1*n1 + n2*n2 - 4 * n0 * n3 = 1. The overall sign is fixed in the following way: If the last parameter is positive the circle is assumed to be orientated counterclockwise else the circle is assumed to be orientated clockwise. The parameters n1 and n2 are indeed a vector in two dimensions and we keep them stored as Vector2D. Additionally we can represent a line with same parameters by setting n3 = 0. Compare Line2D.
Definition at line 51 of file GeneralizedCircle.h.
Default constructor for ROOT compatibility.
Definition at line 26 of file GeneralizedCircle.cc.
GeneralizedCircle | ( | double | n0, |
double | n1, | ||
double | n2, | ||
double | n3 = 0 |
||
) |
Constructor with the four parameters of the generalized circle.
Definition at line 33 of file GeneralizedCircle.cc.
GeneralizedCircle | ( | double | n0, |
const Vector2D & | n12, | ||
double | n3 = 0 |
||
) |
Constructor with the four parameters of the generalized circle.
Definition at line 44 of file GeneralizedCircle.cc.
|
explicit |
Constructor from a two dimensional line.
Definition at line 52 of file GeneralizedCircle.cc.
|
explicit |
Constructor from a two dimensional circle.
Definition at line 60 of file GeneralizedCircle.cc.
|
inline |
Gives the proper absolute distance of the point to the circle line.
Definition at line 529 of file GeneralizedCircle.h.
|
inline |
Gives the signed radius of the circle. If it was a line this will be infinity.
Definition at line 574 of file GeneralizedCircle.h.
Vector2D apogee | ( | ) | const |
Calculates the point on the circle that is furthest away from the origin.
This results in Vector2D(NAN, NAN) in the straight line case.
Definition at line 168 of file GeneralizedCircle.cc.
Calculates the arc length between two points of closest approach on the circle.
The arc length is signed positive for travel in orientation direction. In the circle case the arc length is between -pi*radius and pi*radius, hence the discontinuity is on the far side of the circle relative to the given from point. The points are essentially first taken to their closest approach before we take the length on the curve. For the line case the length is the distance component parallel to the line.
Definition at line 244 of file GeneralizedCircle.cc.
|
inline |
Helper function the calculate the factor between the length of a secant line and the length on the arc.
Smooth function expressing the relation between arc length and direct length only using the curvature of the circle as additional information. It enables better handling of the line limit compared to the former implementation which used the opening angle of the arc.
Definition at line 653 of file GeneralizedCircle.h.
|
static |
Helper function the calculate the factor between the length of a secant line and the length on the arc.
Smooth function expressing the relation between arc length and direct length only using the curvature of the circle as additional information. It enables better handling of the line limit compared to the former implementation which used the opening angle of the arc.
Definition at line 290 of file GeneralizedCircle.cc.
|
inline |
Getter for the arc length for a full round of the circle.
Definition at line 618 of file GeneralizedCircle.h.
double arcLengthTo | ( | const Vector2D & | to | ) | const |
Calculates the arc length between the perigee and the given point.
Definition at line 259 of file GeneralizedCircle.cc.
double arcLengthToCylindricalR | ( | double | cylindricalR | ) | const |
Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can not be reached return NAN.
Note that there are two solutions which have equivalent arc lengths with different sign Always return the positive solution.
Definition at line 276 of file GeneralizedCircle.cc.
Vector2D atArcLength | ( | double | arcLength | ) | const |
Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
Definition at line 352 of file GeneralizedCircle.cc.
Calculates the two points with the given cylindrical radius on the generalised circle.
Two versions in this case
Definition at line 209 of file GeneralizedCircle.cc.
Approach on the circle with the given cylindrical radius that lies in the forward direction of a start point.
Calculates the point on the circle with cylindrical radius cylindricalR, which is closest following the circle in the direction of positive forward orientation This is particularly useful to extraplotate into a certain layer. In case no intersection with this cylindrical radius exists the function returns Vector2D(NAN,NAN)
startPoint | Start point from which to follow in the circle in the forward direction |
cylindricalR | Cylindrical radius of interest |
Definition at line 237 of file GeneralizedCircle.cc.
|
inline |
Gives the center of the circle. If it was a line both components will be infinity.
Definition at line 595 of file GeneralizedCircle.h.
Vector2D chooseNextForwardOf | ( | const Vector2D & | start, |
const Vector2D & | end1, | ||
const Vector2D & | end2 | ||
) | const |
Returns the end point which is first reached if one follows the forward direction of the circle starting from the start point.
Evaluates which of the given end points end1 and end2 is closer to start This especially treats the discontinuity on the far side of the circle correctly. If the generalized circle is truly a line none of the points might lie in the forward direction and Vector2D(NAN,NAN) is returned.
start | Point to start the traversal |
end1 | One possible end point |
end2 | Other possible end point |
Definition at line 175 of file GeneralizedCircle.cc.
Closest approach on the circle to the point.
Calculates the closest point on the circle relative to the given point.
point | Point in the plane to calculate the closest approach to |
Definition at line 116 of file GeneralizedCircle.cc.
|
inline |
Transforms the generalized circle to conformal space inplace Applies the conformal map in the self-inverse form X = x / (x^2 + y^2) and Y = y / (x^2 +y^2) inplace It works most easily by the exchange of the circle parameters n0 <-> n3.
Definition at line 229 of file GeneralizedCircle.h.
|
inline |
Returns a copy of the circle in conformal space.
Applies the conformal map in the self-inverse from X = x / (x^2 + y^2) and Y = y / (x^2 +y^2) and returns the result as a new GeneralizedCircle. It works most easily by the exchange of the circle parameters n0 <-> n3
Definition at line 335 of file GeneralizedCircle.h.
|
inline |
Gives the signed curvature of the generalized circle.
Definition at line 580 of file GeneralizedCircle.h.
|
inline |
Getter for the absolute distance to the z axes at the support point.
Definition at line 499 of file GeneralizedCircle.h.
double distance | ( | const Vector2D & | point | ) | const |
Gives the proper distance of the point to the circle line retaining the sign of the fast distance.
Definition at line 296 of file GeneralizedCircle.cc.
double distance | ( | double | fastDistance | ) | const |
Helper function to translate the fast linearized distance measure of the generalized circle to the proper distance from the circle retaining the sign of the distance.
Definition at line 302 of file GeneralizedCircle.cc.
|
inline |
Helper function to translate the proper distance to the linearized distance measure of the generalized circle retaining the sign of the distance.
Definition at line 487 of file GeneralizedCircle.h.
|
inline |
Approximate distance.
Gives a fast signed approximation of the distance to the circle. The absolute value of the fast distance is accurate up to first order of distance/circle radius, hence best used with big circles and small distances. The sign of the fast distance indicates if the point is to the right or to the left of the circle.
Definition at line 459 of file GeneralizedCircle.h.
|
inline |
Approximate distance to the origin.
Definition at line 465 of file GeneralizedCircle.h.
|
static |
Constructor from center, radius and a optional orientation.
The center and radius alone do not carry any orientation. However the generalized circle does. This constructor makes an orientated representation from them. If not given the orientation defaults to mathematical positive counterclockwise.
Definition at line 67 of file GeneralizedCircle.cc.
|
static |
Constructor of a generalized circle from perigee parameters.
Tangential at perigee given as two dimensional vector.
Definition at line 76 of file GeneralizedCircle.cc.
|
static |
Constructor of a generalized circle from perigee parameters.
Tangential at perigee given as azimuth angle.
Definition at line 85 of file GeneralizedCircle.cc.
Gradient of the distance field Gives the gradient of the approximated distance field for the given point.
point | Point in the plane to calculate the gradient |
Definition at line 347 of file GeneralizedCircle.h.
|
inline |
Gives the signed distance of the origin to the circle.
Definition at line 493 of file GeneralizedCircle.h.
std::pair< Vector2D, Vector2D > intersections | ( | const GeneralizedCircle & | generalizedCircle | ) | const |
Calculates the two points common to both circles.
If the two points coincide both returned points are the same. If there is no common point both returned points will be made of NAN.
Definition at line 322 of file GeneralizedCircle.cc.
|
inline |
Sets all circle parameters to zero.
Definition at line 212 of file GeneralizedCircle.h.
|
inline |
Indicates if the generalized circle is actually a circle.
Definition at line 562 of file GeneralizedCircle.h.
|
inline |
Calculates if the to vector is closer to the from vector following the along orientation of the circle or against.
Definition at line 408 of file GeneralizedCircle.h.
|
inline |
Indicates if all circle parameters are zero.
Definition at line 300 of file GeneralizedCircle.h.
|
inline |
Return if the point given is left of the line.
Definition at line 544 of file GeneralizedCircle.h.
|
inline |
Indicates if the generalized circle is actually a line.
Definition at line 556 of file GeneralizedCircle.h.
|
inline |
Return if the point given is right of the line.
Definition at line 550 of file GeneralizedCircle.h.
|
inline |
Indicates if the point is on the right or left side of the circle.
This is also referred to as alpha.
Definition at line 538 of file GeneralizedCircle.h.
|
inline |
Indicates if the combination of the circle parameters makes up a valid circle.
Definition at line 306 of file GeneralizedCircle.h.
|
inline |
Gives the maximal cylindrical radius the circle reaches.
Definition at line 523 of file GeneralizedCircle.h.
|
inline |
Gives the minimal cylindrical radius the circle reaches (unsigned)
Definition at line 517 of file GeneralizedCircle.h.
|
inline |
Getter for the first circle parameter.
Definition at line 269 of file GeneralizedCircle.h.
|
inline |
Getter for the second circle parameter.
Definition at line 275 of file GeneralizedCircle.h.
|
inline |
Getter for the second and third circle parameter which natuarally from a vector.
Definition at line 287 of file GeneralizedCircle.h.
|
inline |
Getter for the third circle parameter.
Definition at line 281 of file GeneralizedCircle.h.
|
inline |
Getter for the fourth circle parameter.
Definition at line 293 of file GeneralizedCircle.h.
Normal vector to the circle near the given position.
Gives the unit normal vector to the circle line. It points to the outside of the circle for counterclockwise orientation, and inwards for the clockwise orientation. It is essentially the gradient normalized to unit length
point | Point in the plane to calculate the tangential |
Definition at line 361 of file GeneralizedCircle.h.
|
inline |
Calculates the generalized circle specific squared norm.
Correctly normalized this should give one.
Definition at line 315 of file GeneralizedCircle.h.
|
inlineprotected |
Normalizes the circle parameters.
The normalization is only made if the circle parameters have a valid positive norm. If the normalization of the circle is negative or zero all circle parameters are not changed.
Definition at line 252 of file GeneralizedCircle.h.
|
inline |
Gives the omega parameter as used by the framework helix.
It is the signed curvature of the generalized circle with the opposite sign.
Definition at line 589 of file GeneralizedCircle.h.
|
inline |
Gives the orientation of the circle.
The circle can be either orientated counterclockwise or clockwise.
Definition at line 612 of file GeneralizedCircle.h.
|
inline |
Moves the coordinate system by the given vector.
Updates the circle parameters inplace.
Definition at line 239 of file GeneralizedCircle.h.
Vector2D perigee | ( | ) | const |
Calculates the closest approach to the two dimensional origin.
Definition at line 161 of file GeneralizedCircle.cc.
|
inline |
Gives the perimeter of the circle.
Definition at line 601 of file GeneralizedCircle.h.
|
inline |
Gives the signed radius of the circle. If it was a line this will be infinity.
Definition at line 568 of file GeneralizedCircle.h.
|
inline |
Flips the orientation of the circle in place.
Definition at line 218 of file GeneralizedCircle.h.
|
inline |
Returns a copy of the circle with opposite orientation.
Definition at line 322 of file GeneralizedCircle.h.
|
inlineprivate |
Scales the circle parameters by a common factor.
Definition at line 260 of file GeneralizedCircle.h.
void setCenterAndRadius | ( | const Vector2D & | center, |
double | absRadius, | ||
ERotation | orientation = ERotation::c_CounterClockwise |
||
) |
Setter for the circle center and radius.
Definition at line 94 of file GeneralizedCircle.cc.
|
inline |
Setter for all four circle parameters.
Makes a normalization after setting. The normal representation of a line leave out the last parameter.
Definition at line 178 of file GeneralizedCircle.h.
|
inline |
|
inline |
Setter for all four circle parameters from another circle.
Definition at line 206 of file GeneralizedCircle.h.
|
inline |
Setter for all four circle parameters from another circle.
Definition at line 200 of file GeneralizedCircle.h.
|
inlineprotected |
Setter for first circle parameter.
Makes no normalization after setting. Use is discouraged.
Definition at line 102 of file GeneralizedCircle.h.
|
inlineprotected |
Setter for second circle parameter.
Makes no normalization after setting. Use is discouraged.
Definition at line 112 of file GeneralizedCircle.h.
|
inlineprotected |
Setter for second and third circle parameter.
Makes no normalization after setting. Use is discouraged.
Definition at line 132 of file GeneralizedCircle.h.
|
inlineprotected |
Setter for second and third circle parameter.
Makes no normalization after setting. Use is discouraged.
Definition at line 142 of file GeneralizedCircle.h.
|
inlineprotected |
Setter for third circle parameter.
Makes no normalization after setting. Use is discouraged.
Definition at line 122 of file GeneralizedCircle.h.
|
inlineprotected |
Setter for fourth circle parameter.
Makes no normalization after setting. Use is discouraged.
Definition at line 152 of file GeneralizedCircle.h.
|
inline |
Setter for the perigee parameters.
Definition at line 168 of file GeneralizedCircle.h.
void setPerigeeParameters | ( | double | curvature, |
const Vector2D & | tangential, | ||
double | impact | ||
) |
Setter for the perigee parameters.
Definition at line 106 of file GeneralizedCircle.cc.
|
inline |
Gives the tangential vector at the closest approach to the origin / at the perigee.
Definition at line 505 of file GeneralizedCircle.h.
Tangential vector to the circle near the given position.
Gives the unit tangential vector to the circle line. It always points in the direction of positive advance at the point of closest approach from the given point.
point | Point in the plane to calculate the tangential |
Definition at line 374 of file GeneralizedCircle.h.
|
inline |
Gives to azimuth angle phi of the direction of flight at the perigee.
Definition at line 511 of file GeneralizedCircle.h.
|
private |
Memory for the first parameter.
Definition at line 691 of file GeneralizedCircle.h.
|
private |
Memory for the second and third parameter.
Definition at line 688 of file GeneralizedCircle.h.
|
private |
Memory for the fourth parameter.
Definition at line 685 of file GeneralizedCircle.h.