Belle II Software development
ParameterLine2D.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/trackFindingCDC/geometry/ParameterLine2D.h>
9
10#include <tracking/trackFindingCDC/geometry/Vector2D.h>
11
12#include <ostream>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16
18 const double fromSignedRadius,
19 const Vector2D& toCenter,
20 const double toSignedRadius)
21{
22 Vector2D connecting = toCenter - fromCenter;
23
24 // Normalize to the coordinate system vector, but keep the original norm
25 const double norm = connecting.normalize();
26
27 double kappa = (fromSignedRadius - toSignedRadius) / norm;
28 double cokappa = sqrt(1 - kappa * kappa);
29
30 Vector2D fromPos = Vector2D(connecting, kappa * fromSignedRadius, cokappa * fromSignedRadius);
31 fromPos += fromCenter;
32
33 Vector2D toPos = Vector2D(connecting, kappa * toSignedRadius, cokappa * toSignedRadius);
34 toPos += toCenter;
35
36 return ParameterLine2D::throughPoints(fromPos, toPos);
37}
38
39std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const ParameterLine2D& line)
40{
41 output << "ParameterLine2D(" << line.support() << "," << line.tangential() << ")";
42 return output;
43}
A line with a support point and tangential vector.
static ParameterLine2D touchingCircles(const Vector2D &fromCenter, double fromSignedRadius, const Vector2D &toCenter, double toSignedRadius)
Constructs a line touching two circles in one point each.
static ParameterLine2D throughPoints(const Vector2D &start, const Vector2D &end)
Static constructor for a line between to points.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double normalize()
Normalizes the vector to unit length.
Definition: Vector2D.h:303
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.