ATLAS Offline Software
VP1LinAlgUtils.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1LinAlgUtils //
9 // //
10 // Description: Class holding CLHEP/Inventor algebra //
11 // methods. //
12 // //
13 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
14 // Initial version: March 2008 //
15 // //
17 
18 #ifndef VP1LINALGUTILS_H
19 #define VP1LINALGUTILS_H
20 
21 class SoTransform;
22 class SbMatrix;
23 
24 #include "CLHEP/Geometry/Transform3D.h"
25 
26 // Eigen Migration
27 // see atlasoff/DetectorDescription/GeoPrimitives/trunk/GeoPrimitives/CLHEPtoEigenConverter.h
31 
32 
33 #include <QString>
34 
35 
37 public:
38 
39  static void transformToMatrix(SoTransform * xf, SbMatrix& result);
40  static void transformToMatrix(const HepGeom::Transform3D &, SbMatrix& result);
41 
42  //Will modify (and return) passed SoTransform pointer, unless it is zero. In that case it creates and returns a new SoTransform.
43  static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform * t = 0);
44  static SoTransform * toSoTransform(const Amg::Transform3D &, SoTransform * t = 0);
45  static SoTransform * toSoTransform(const SbMatrix&, SoTransform * t = 0);
46 
47  static void decodeTransformation( const SbMatrix&, //NB: Ignores the parts of the matrix related to scaling!
48  float& translation_x, float& translation_y, float& translation_z,
49  float& rotaxis_x, float& rotaxis_y, float& rotaxis_z, float& rotangle_radians );
50 
51  //The following tests for sane transformations and will, if
52  //contextStr!="", print ERRORs to messageDebug.
53  //If called for a large number of transformations, it might be a
54  //good idea to only call when in verbose mode. contextStr's are used
55  //in the output to ease debugging (i.e. use values such as "input
56  //volume transformation").:
57 
58  static bool isSane( const HepGeom::Transform3D &, const QString& contextStr = "" );
59  static bool isSane( const Amg::Transform3D &, const QString& contextStr = "" );
60  static bool isSane( const SoTransform *, const QString& contextStr = "" );
61  static bool isSane( const SbMatrix&, const QString& contextStr = "" );
62 
63  //Misc:
64  static double phiFromXY(const double& x, const double&y );
65 
66  //Misc. point/line distances:
67 
68  static void distPointLineParam(const Amg::Vector3D& point, const Amg::Vector3D& point0,
69  const Amg::Vector3D& point1, double& s);
70  //Modifies 's' to contain the
71  //parameter describing the point 'P' on the line giving the shortest
72  //distance as P=point0 + s*(point1-point0)
73  static double distPointLine2(const Amg::Vector3D& point, const Amg::Vector3D& point0,
74  const Amg::Vector3D& point1, double& s);
75  //Returns the shortest distance squared between the point 'point'
76  //and the line passing 'point0' and 'point1'.
77 
78  static void distLineLineParam(const Amg::Vector3D& point0, const Amg::Vector3D& point1,
79  const Amg::Vector3D& point2, const Amg::Vector3D& point3,
80  double& s, double& t);
81  //returns void, but modifies 's' and 't' to describe the points 'P'
82  //and 'Q' giving the shortest distance between the line passing
83  //point0 and point1 and the line passing point2 and point3. I.e: P =
84  //point0 + s*(point1 - point0). Q = point2 + t*(point3-point2)
85 
86  //FIXME: this should have a corresponding non-void function
87  //returning the actual distance (squared), e.g. the distance |PQ|,
88  //but this is omitted as it adds unneeded calculations ( for the
89  //current usage ). Also rename method.
90 
91 private:
94  class Imp;
95 };
96 
97 #endif
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
VP1LinAlgUtils::~VP1LinAlgUtils
~VP1LinAlgUtils()
Definition: VP1LinAlgUtils.h:93
VP1LinAlgUtils::decodeTransformation
static void decodeTransformation(const SbMatrix &, float &translation_x, float &translation_y, float &translation_z, float &rotaxis_x, float &rotaxis_y, float &rotaxis_z, float &rotangle_radians)
Definition: VP1LinAlgUtils.cxx:162
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
x
#define x
VP1LinAlgUtils::phiFromXY
static double phiFromXY(const double &x, const double &y)
Definition: VP1LinAlgUtils.cxx:374
GeoPrimitives.h
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
VP1LinAlgUtils::distLineLineParam
static void distLineLineParam(const Amg::Vector3D &point0, const Amg::Vector3D &point1, const Amg::Vector3D &point2, const Amg::Vector3D &point3, double &s, double &t)
Definition: VP1LinAlgUtils.cxx:422
VP1LinAlgUtils::VP1LinAlgUtils
VP1LinAlgUtils()
Definition: VP1LinAlgUtils.h:92
CLHEPtoEigenConverter.h
VP1LinAlgUtils::distPointLineParam
static void distPointLineParam(const Amg::Vector3D &point, const Amg::Vector3D &point0, const Amg::Vector3D &point1, double &s)
Definition: VP1LinAlgUtils.cxx:390
VP1LinAlgUtils::transformToMatrix
static void transformToMatrix(SoTransform *xf, SbMatrix &result)
Definition: VP1LinAlgUtils.cxx:101
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
VP1LinAlgUtils::distPointLine2
static double distPointLine2(const Amg::Vector3D &point, const Amg::Vector3D &point0, const Amg::Vector3D &point1, double &s)
Definition: VP1LinAlgUtils.cxx:406
y
#define y
VP1LinAlgUtils
Definition: VP1LinAlgUtils.h:36
GeoPrimitivesHelpers.h
VP1LinAlgUtils::isSane
static bool isSane(const HepGeom::Transform3D &, const QString &contextStr="")
Definition: VP1LinAlgUtils.cxx:184
VP1LinAlgUtils::toSoTransform
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
Definition: VP1LinAlgUtils.cxx:40