10#include <tracking/trackingUtilities/geometry/GeneralizedCircle.h>
11#include <tracking/trackingUtilities/geometry/Line2D.h>
12#include <tracking/trackingUtilities/geometry/VectorUtil.h>
14#include <tracking/trackingUtilities/numerics/Quadratic.h>
15#include <tracking/trackingUtilities/numerics/EForwardBackward.h>
16#include <tracking/trackingUtilities/numerics/ERightLeft.h>
17#include <tracking/trackingUtilities/numerics/ERotation.h>
18#include <tracking/trackingUtilities/numerics/ESign.h>
20#include <Math/Vector2D.h>
31 namespace TrackingUtilities {
73 const EForwardBackward orientation)
76 ROOT::Math::XYVector(orientation,
static_cast<double>(orientation) *
slope));
111 double fromSignedRadius,
112 const ROOT::Math::XYVector& toCenter,
113 double toSignedRadius);
134 return VectorUtil::Orthogonal(
tangential(), ERotation::c_Clockwise);
144 ROOT::Math::XYVector
at(
const double parameter)
const
153 return static_cast<EForwardBackward
>(sign(
tangential().X()));
160 return static_cast<EForwardBackward
>(sign(
tangential().Y()));
205 double distance(
const ROOT::Math::XYVector& point)
const
213 double distance(
const double first,
const double second)
const
215 return distance(ROOT::Math::XYVector(first, second));
233 return static_cast<ERightLeft
>(sign(
distance(point)));
237 bool isLeft(
const ROOT::Math::XYVector& rhs)
const
243 bool isRight(
const ROOT::Math::XYVector& rhs)
const
249 ROOT::Math::XYVector
closest(
const ROOT::Math::XYVector& point)
const
258 double closestAt(
const ROOT::Math::XYVector& point)
const
277 double lengthOnCurve(
const ROOT::Math::XYVector& from,
const ROOT::Math::XYVector& to)
const
285 return -(line.n0() +
support().Dot(line.normal())) /
tangential().Dot(line.normal());
291 return (VectorUtil::Cross(line.tangential(),
support()) - VectorUtil::Cross(line.tangential(), line.support())) /
292 VectorUtil::Cross(
tangential(), line.tangential());
306 return solveQuadraticABC(a, b, c);
333 void moveBy(
const ROOT::Math::XYVector& by)
404 double map(
const double first)
const
445 std::ostream& operator<<(std::ostream& output,
const ParameterLine2D& line);
ROOT::Math::XYVector gradient(const ROOT::Math::XYVector &point) const
Gradient of the distance field Gives the gradient of the approximated distance field for the given po...
double fastDistance(const ROOT::Math::XYVector &point) const
Approximate distance.
double n3() const
Getter for the fourth circle parameter.
A two dimensional normal line.
A line with a support point and tangential vector.
ParameterLine2D()
Default constructor for ROOT compatibility.
EForwardBackward alignedWithFirst() const
Indicates if the tangential vector point in a common direction with the first coordinate axes.
static ParameterLine2D fromSlopeIntercept(const double slope, const double intercept)
Constructs a line with slope and intercept.
bool isRight(const ROOT::Math::XYVector &rhs) const
Return if the point given is right of the line.
ROOT::Math::XYVector normal() const
Gives the normal vector of the line.
double zero() const
First coordinate for second being zero.
static ParameterLine2D fromSlopeIntercept(const double slope, const double intercept, const EForwardBackward orientation)
Constructs a line with slope and intercept.
bool isInvalid() const
Check it the line is in an invalid state.
void reverse()
Reverses the tangential vector inplace.
ROOT::Math::XYVector intersection(const Line2D &line) const
Gives the point where the two lines meet. Infinities for parallels.
double slope() const
The line slope.
const ROOT::Math::XYVector & support() const
Gives the support vector of the line.
static ParameterLine2D throughPoints(const ROOT::Math::XYVector &start, const ROOT::Math::XYVector &end)
Static constructor for a line between to points.
double map(const double first) const
Method mapping the first coordinate to the second according to the line.
void moveBy(const ROOT::Math::XYVector &by)
Moves the line in the given direction in place. Corresponds to an active transformation.
ParameterLine2D(const Line2D &line)
Upcast the normal representation to a parameter line.
bool isLeft(const ROOT::Math::XYVector &rhs) const
Return if the point given is left of the line.
ROOT::Math::XYVector closest(const ROOT::Math::XYVector &point) const
Gives the position at the closest approach on the line to point.
ROOT::Math::XYVector closestToOrigin() const
Gives the position of closest approach to the origin.
double closestAt(const ROOT::Math::XYVector &point) const
Gives the line parameter at the closest approach to point.
std::pair< double, double > intersectionsAt(const GeneralizedCircle &genCircle) const
Gives the line parameters of this line, where it intersects with the generalized circle.
double distanceToOrigin() const
Gives the signed distance of the origin.
double intercept() const
Second coordinate for first being zero.
void moveAlongFirst(const double first)
Moves the line along the first coordinate axes in place.
double intersectionAt(const Line2D &line) const
Gives the line parameter where the two lines meet. Infinity for parallels.
void passiveMoveAtBy(const double delta)
Moves the support point by the given amount of the parameter in the forward direction.
ROOT::Math::XYVector m_support
Support vector of the line.
double inverseSlope() const
The inverse line slope.
double inverseMap(const double second) const
Method for the inverse mapping the second coordinate to the first according to the line.
double operator()(const double first) const
Operator mapping the first coordinate to the second according to the line.
ParameterLine2D(const ROOT::Math::XYVector &support, const ROOT::Math::XYVector &tangential)
Standard constructor taking the support point and the tangential vector.
double distance(const ROOT::Math::XYVector &point) const
Gives the signed distance of a point to the line.
void invert()
Turns the line into its inverse function in place. Orientation will be flipped as well.
void passiveMoveAlongFirst(const double first)
Moves the coordinate system along the first coordinate axes in place.
void invalidate()
Clear all information from the line.
ERightLeft isRightOrLeft(const ROOT::Math::XYVector &point) const
Return if the point given is right or left of the line.
ParameterLine2D reversed() const
Makes a copy line which has the opposite tangential vector but same support point.
void passiveMoveBy(const ROOT::Math::XYVector &by)
Moves the coordinate system in the given direction in place.
ROOT::Math::XYVector intersection(const ParameterLine2D &line) const
Gives the point where the two lines meet. Infinities for parallels.
EForwardBackward alignedWithSecond() const
Indicates if the tangential vector point in a common direction with the second coordinate axes.
double intersectionAt(const ParameterLine2D &line) const
Gives the line parameter of this line where the two lines meet. Infinity for parallels.
ParameterLine2D inverted() const
Gives the line associated with the inverse function as a copy.
double distance(const double first, const double second) const
Calculates the signed distance of the point given by its to coordinates to the line.
double absoluteDistance(const ROOT::Math::XYVector &point) const
Gives the unsigned distance of a point to the line.
void normalize()
Normalizes the tangential vector inplace.
void passiveMoveAlongSecond(const double second)
Moves the coordinate system along the second coordinate axes in place.
const ROOT::Math::XYVector & tangential() const
Gives the tangential vector of the line.
ROOT::Math::XYVector at(const double parameter) const
Evaluates the line formula at the parameter given.
double lengthOnCurve(const ROOT::Math::XYVector &from, const ROOT::Math::XYVector &to) const
Denotes the length on the line between the two points.
double closestToOriginAt() const
Gives the line parameter at the closest approach to the origin.
ROOT::Math::XYVector m_tangential
Tangential vector of the line.
void moveAlongSecond(const double second)
Moves the line along the second coordinate axes in place.
static ParameterLine2D touchingCircles(const ROOT::Math::XYVector &fromCenter, double fromSignedRadius, const ROOT::Math::XYVector &toCenter, double toSignedRadius)
Constructs a line touching two circles in one point each.
Abstract base class for different kinds of events.