ATLAS Offline Software
Loading...
Searching...
No Matches
ForwardTracker/src/Point.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace ForwardTracker {
8
9 Point::Point(): m_x(0), m_y(0), m_z(0) {}
10 Point::Point(double x, double y, double z): m_x(x), m_y(y), m_z(z) {}
11
12 void Point::rotat(double angle, bool bendplane) {
13
14 double ds = (*this)[bendplane];
15 double dz = (*this)[2];
16
17 (*this)[bendplane] = cos(angle)*ds - sin(angle)*dz;
18 (*this)[2] = sin(angle)*ds + cos(angle)*dz;
19 }
20
21 std::string Point::str() const {
22
23 std::ostringstream ost;
24
25 ost << std::fixed
26 << std::setprecision(9) << "("
27 << std::setw(12) << m_x << ", "
28 << std::setw(12) << m_y << ", "
29 << std::setw(14) << m_z << ")";
30
31 return ost.str();
32 }
33
34 Point operator*(double scalar, const Point& p) { Point point(p); return point *= scalar; }
35 Point operator+(const Point& lhs, const Point& rhs) { Point point(lhs); return point += rhs; }
36 Point operator-(const Point& lhs, const Point& rhs) { Point point(lhs); return point -= rhs; }
37 Point operator+(const Point& lhs, const TransversePoint& rhs) { Point point(lhs); return point += rhs; }
38 Point operator-(const Point& lhs, const TransversePoint& rhs) { Point point(lhs); return point -= rhs; }
39
40 std::ostream& operator<<(std::ostream& os, const Point& p) { os << p.str(); return os; }
41}
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Point operator*(double scalar, const Point &p)
std::ostream & operator<<(std::ostream &, const Beamline &)
Point operator+(const Point &lhs, const Point &rhs)
Point operator-(const Point &lhs, const Point &rhs)
Point(double x_, double y_, double slope_)
Single point and slope to next point.