ATLAS Offline Software
Loading...
Searching...
No Matches
Circle.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
8
9namespace MuonR4 {
10 std::ostream& Circle::print(std::ostream& ostr) const {
11 ostr<<"Circle - center: "<<Amg::toString(center())
12 <<", radius: "<<radius()
13 <<", normal: "<<Amg::toString(normal());
14 return ostr;
15 }
17 const Amg::Vector3D& pointB,
18 const Amg::Vector3D& pointC) {
19
21 const Amg::Vector3D AC = (pointC - pointA).unit();
23 const Amg::Vector3D AB = (pointB - pointA).unit();
25 m_normal = AC.cross(AB).unit();
27 const Amg::Vector3D midAB = 0.5*(pointA + pointB);
29 const Amg::Vector3D midAC = 0.5*(pointA + pointC);
30
31 const Amg::Vector3D normAB = AB.cross(m_normal);
32 const Amg::Vector3D normAC = AC.cross(m_normal);
33
34 const std::optional<double> midIsect = Amg::intersect<3>(midAB, normAB, midAC, normAC);
35 if (!midIsect) {
36 m_normal.setZero();
37 return;
38 }
39 m_center = midAC + (*midIsect) * normAC;
40 m_radius = std::copysign((pointA - m_center).mag(), (*midIsect));
41 }
42}
Scalar mag() const
mag method
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
const Amg::Vector3D & center() const
The center point of the circle.
Definition Circle.h:28
const Amg::Vector3D & normal() const
The vector that is normal to the circle.
Definition Circle.h:30
double m_radius
The radius of the circle.
Definition Circle.h:44
Amg::Vector3D m_center
The center point of the circle.
Definition Circle.h:40
double radius() const
The radius of the circle.
Definition Circle.h:32
Amg::Vector3D m_normal
The plane normal of the circle.
Definition Circle.h:42
Circle(const Amg::Vector3D &pointA, const Amg::Vector3D &pointB, const Amg::Vector3D &pointC)
Constructor taking three points in a plane If points are on a line, the plane is set to be the null v...
Definition Circle.cxx:16
std::ostream & print(std::ostream &ostr) const
Definition Circle.cxx:10
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.