#include <VP1LinAlgUtils.h>
|  | 
| static void | transformToMatrix (SoTransform *xf, SbMatrix &result) | 
|  | 
| static void | transformToMatrix (const HepGeom::Transform3D &, SbMatrix &result) | 
|  | 
| static SoTransform * | toSoTransform (const HepGeom::Transform3D &, SoTransform *t=0) | 
|  | 
| static SoTransform * | toSoTransform (const Amg::Transform3D &, SoTransform *t=0) | 
|  | 
| static SoTransform * | toSoTransform (const SbMatrix &, SoTransform *t=0) | 
|  | 
| 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) | 
|  | 
| static bool | isSane (const HepGeom::Transform3D &, const QString &contextStr="") | 
|  | 
| static bool | isSane (const Amg::Transform3D &, const QString &contextStr="") | 
|  | 
| static bool | isSane (const SoTransform *, const QString &contextStr="") | 
|  | 
| static bool | isSane (const SbMatrix &, const QString &contextStr="") | 
|  | 
| static double | phiFromXY (const double &x, const double &y) | 
|  | 
| static void | distPointLineParam (const Amg::Vector3D &point, const Amg::Vector3D &point0, const Amg::Vector3D &point1, double &s) | 
|  | 
| static double | distPointLine2 (const Amg::Vector3D &point, const Amg::Vector3D &point0, const Amg::Vector3D &point1, double &s) | 
|  | 
| static void | distLineLineParam (const Amg::Vector3D &point0, const Amg::Vector3D &point1, const Amg::Vector3D &point2, const Amg::Vector3D &point3, double &s, double &t) | 
|  | 
Definition at line 36 of file VP1LinAlgUtils.h.
 
◆ VP1LinAlgUtils()
  
  | 
        
          | VP1LinAlgUtils::VP1LinAlgUtils | ( |  | ) |  |  | inlineprivate | 
 
 
◆ ~VP1LinAlgUtils()
  
  | 
        
          | VP1LinAlgUtils::~VP1LinAlgUtils | ( |  | ) |  |  | inlineprivate | 
 
 
◆ decodeTransformation()
  
  | 
        
          | void VP1LinAlgUtils::decodeTransformation | ( | const SbMatrix & | matr, |  
          |  |  | float & | translation_x, |  
          |  |  | float & | translation_y, |  
          |  |  | float & | translation_z, |  
          |  |  | float & | rotaxis_x, |  
          |  |  | float & | rotaxis_y, |  
          |  |  | float & | rotaxis_z, |  
          |  |  | float & | rotangle_radians |  
          |  | ) |  |  |  | static | 
 
Definition at line 162 of file VP1LinAlgUtils.cxx.
  166   SbVec3f translation, scaleFactor, rotaxis;
 
  167   SbRotation 
rotation, scaleOrientation;
 
  168   matr.getTransform (translation, 
rotation,scaleFactor,scaleOrientation,SbVec3f(0,0,0));
 
  169   translation.getValue(translation_x,translation_y,translation_z);
 
  170   rotation.getValue(rotaxis,rotangle_radians);
 
  171   rotaxis.getValue(rotaxis_x,rotaxis_y,rotaxis_z);
 
  173     if (!
isSane( matr, 
"input SbMatrix" ))
 
  174       VP1Msg::messageVerbose(
"VP1LinAlgUtils::decodeTransformation ERROR: Problems observed in output SbMatrix");
 
 
 
 
◆ distLineLineParam()
Definition at line 422 of file VP1LinAlgUtils.cxx.
  427   double d3232 = p32.dot(p32);
 
  429   double d1010 = p10.dot(p10);
 
  430   if (d3232==0.0||d1010==0.0||d3232!=d3232||d1010!=d1010) {
 
  434     VP1Msg::messageDebug(
"VP1LinAlgUtils distLineLineParam ERROR: One or both input lines ill defined");
 
  438   double d3210 = p32.dot(p10);
 
  439   double denom = d1010 * d3232 - d3210 * d3210;
 
  441   double d0232 = p02.dot(p32);
 
  445     VP1Msg::messageDebug(
"VP1LinAlgUtils distLineLineParam Warning: Input lines are parallel. Choosing arbitrary point of closest approach");
 
  448     double d0210 = p02.dot(p10);
 
  449     double numer = d0232 * d3210 - d0210 * d3232;
 
  452   t =  (d0232 + d3210 * 
s) / d3232;
 
 
 
 
◆ distPointLine2()
◆ distPointLineParam()
Definition at line 390 of file VP1LinAlgUtils.cxx.
  394      s = ( ((point)[0]-(point0)[0])*((point1)[0]-(point0)[0]) +
 
  395            ((point)[1]-(point0)[1])*((point1)[1]-(point0)[1]) +
 
  396            ((point)[2]-(point0)[2])*((point1)[2]-(point0)[2]) ) /
 
  397          ( ((point1)[0]-(point0)[0])*((point1)[0]-(point0)[0]) +
 
  398            ((point1)[1]-(point0)[1])*((point1)[1]-(point0)[1]) +
 
  399            ((point1)[2]-(point0)[2])*((point1)[2]-(point0)[2]) );
 
 
 
 
◆ isSane() [1/4]
Definition at line 227 of file VP1LinAlgUtils.cxx.
  233   double      rotationAngle;
 
  271     BAD(
"Problem in raw 4x4 transformation matrix!");
 
  273     BAD(
"Problem in translation!");
 
  277     BAD(
"Problem in rotation");
 
  279     BAD(
"Problem in rotationAxis");
 
  281     BAD(
"Problem in rotationAngle");
 
  290   const double det = 
t.matrix().determinant();
 
  291   const double eps = 1.0e-5;
 
  292   if ( det < 1.0-eps || det > 1.0+eps )
 
 
 
 
◆ isSane() [2/4]
  
  | 
        
          | bool VP1LinAlgUtils::isSane | ( | const HepGeom::Transform3D & | t, |  
          |  |  | const QString & | contextStr = "" |  
          |  | ) |  |  |  | static | 
 
Definition at line 184 of file VP1LinAlgUtils.cxx.
  187   HepGeom::Vector3D<double> translation = 
t.getTranslation();
 
  188   CLHEP::HepRotation 
rotation   = 
t.getRotation();
 
  189   CLHEP::Hep3Vector  rotationAxis;
 
  190   double      rotationAngle;
 
  191   rotation.getAngleAxis(rotationAngle,rotationAxis);
 
  199     BAD(
"Problem in raw 4x4 transformation matrix!");
 
  201     BAD(
"Problem in translation!");
 
  205     BAD(
"Problem in rotation");
 
  207     BAD(
"Problem in rotationAxis");
 
  209     BAD(
"Problem in rotationAngle");
 
  212   const double det = 
t.xx()*
t.yy()*
t.zz()
 
  213     +
t.zx()*
t.xy()*
t.yz()
 
  214     +
t.xz()*
t.yx()*
t.zy()
 
  215     -
t.xx()*
t.zy()*
t.yz()
 
  216     -
t.yx()*
t.xy()*
t.zz()
 
  217     -
t.zx()*
t.yy()*
t.xz();
 
  218   const double eps = 1.0e-5;
 
  219   if (det<1.0-eps||det>1.0+eps)
 
 
 
 
◆ isSane() [3/4]
  
  | 
        
          | bool VP1LinAlgUtils::isSane | ( | const SbMatrix & | matr, |  
          |  |  | const QString & | contextStr = "" |  
          |  | ) |  |  |  | static | 
 
Definition at line 331 of file VP1LinAlgUtils.cxx.
  336   for (
int i = 0; 
i < 4; ++
i)
 
  337     for (
int j = 0; j < 4; ++j)
 
  343     BAD(
"Problem in raw 4x4 matrix!");
 
  345   SbVec3f translation, scaleFactor, rotaxis;
 
  346   SbRotation 
rotation, scaleOrientation;
 
  347   matr.getTransform(translation, 
rotation,scaleFactor,scaleOrientation,SbVec3f(0,0,0));
 
  351     BAD(
"Problem in quarternion representation of rotation!");
 
  352   scaleOrientation.getValue(q0,q1, q2,q3);
 
  354     BAD(
"Problem in quarternion representation of scaleOrientation!");
 
  356   translation.getValue(
x,
y,
z);
 
  358     BAD(
"Problem in translation!");
 
  359   scaleFactor.getValue(
x,
y,
z);
 
  361     BAD(
"Problem in scaleFactor!");
 
  363   const float eps = 1.0e-5;
 
  364   const float det3 = matr.det3();
 
  365   if (det3<1.0-eps||det3>1.0+eps)
 
  366     BAD(
"Determinant of rotation part is not consistent with 1 (det3="+
QString::number(det3)+
")!");
 
  367   const float det4 = matr.det4();
 
  368   if (det4<1.0-eps||det4>1.0+eps)
 
  369     BAD(
"Determinant of rotation part is not consistent with 1 (det4="+
QString::number(det4)+
")!");
 
 
 
 
◆ isSane() [4/4]
  
  | 
        
          | bool VP1LinAlgUtils::isSane | ( | const SoTransform * | t, |  
          |  |  | const QString & | contextStr = "" |  
          |  | ) |  |  |  | static | 
 
Definition at line 300 of file VP1LinAlgUtils.cxx.
  303     if (!ctxStr.isEmpty())
 
  310   t->rotation.getValue().getValue(q0,q1, q2,q3);
 
  312     BAD(
"Problem in quarternion representation of rotation!");
 
  313   t->scaleOrientation.getValue().getValue(q0,q1, q2,q3);
 
  315     BAD(
"Problem in quarternion representation of scaleOrientation!");
 
  317   t->translation.getValue().getValue(
x,
y,
z);
 
  319     BAD(
"Problem in translation!");
 
  320   t->scaleFactor.getValue().getValue(
x,
y,
z);
 
  322     BAD(
"Problem in scaleFactor!");
 
  323   t->center.getValue().getValue(
x,
y,
z);
 
  325     BAD(
"Problem in center!");
 
 
 
 
◆ phiFromXY()
  
  | 
        
          | double VP1LinAlgUtils::phiFromXY | ( | const double & | x, |  
          |  |  | const double & | y |  
          |  | ) |  |  |  | static | 
 
Definition at line 374 of file VP1LinAlgUtils.cxx.
  377   double phi = (
x == 0.0f)? (
y==0.0
f?0.0:0.5*
M_PI) : std::abs(
atan(std::abs(
y/
static_cast<double>(
x))));
 
  380   else if (x<0.0f&&y>=0.0
f)
 
  382   else if (
x<0.0
f&&
y<0.0
f)
 
 
 
 
◆ toSoTransform() [1/3]
  
  | 
        
          | SoTransform * VP1LinAlgUtils::toSoTransform | ( | const Amg::Transform3D & | transformation, |  
          |  |  | SoTransform * | t = 0 |  
          |  | ) |  |  |  | static | 
 
Definition at line 67 of file VP1LinAlgUtils.cxx.
   72   SoTransform *myTransform = tin ? tin : 
new SoTransform();
 
   73   myTransform->translation = SbVec3f(translation.x(),
 
   87     bool inputok = 
isSane( transformation, 
"input HepGeom::Transform3D" );
 
   88     bool outputok = 
isSane( myTransform, 
"output SoTransform" );
 
   90       VP1Msg::messageVerbose(
"VP1LinAlgUtils::toSoTransform ERROR: Problems observed in input HepGeom::Transform3D");
 
   93     if (inputok!=outputok)
 
   94       VP1Msg::messageVerbose(
"VP1LinAlgUtils::toSoTransform Error introduced in HepGeom::Transform3D -> SoTransform conversion!");
 
 
 
 
◆ toSoTransform() [2/3]
  
  | 
        
          | SoTransform * VP1LinAlgUtils::toSoTransform | ( | const HepGeom::Transform3D & | transformation, |  
          |  |  | SoTransform * | t = 0 |  
          |  | ) |  |  |  | static | 
 
Definition at line 40 of file VP1LinAlgUtils.cxx.
   42   HepGeom::Vector3D<double> translation = transformation.getTranslation();
 
   43   CLHEP::HepRotation 
rotation   = transformation.getRotation();
 
   44   SoTransform *myTransform = tin ? tin : 
new SoTransform();
 
   45   myTransform->translation = SbVec3f(translation.x(),
 
   53     bool inputok = 
isSane( transformation, 
"input HepGeom::Transform3D" );
 
   54     bool outputok = 
isSane( myTransform, 
"output SoTransform" );
 
   56       VP1Msg::messageVerbose(
"VP1LinAlgUtils::toSoTransform ERROR: Problems observed in input HepGeom::Transform3D");
 
   59     if (inputok!=outputok)
 
   60       VP1Msg::messageVerbose(
"VP1LinAlgUtils::toSoTransform Error introduced in HepGeom::Transform3D -> SoTransform conversion!");
 
 
 
 
◆ toSoTransform() [3/3]
  
  | 
        
          | SoTransform * VP1LinAlgUtils::toSoTransform | ( | const SbMatrix & | matr, |  
          |  |  | SoTransform * | t = 0 |  
          |  | ) |  |  |  | static | 
 
Definition at line 137 of file VP1LinAlgUtils.cxx.
  139   SbVec3f translation, scaleFactor;
 
  140   SbRotation 
rotation, scaleOrientation;
 
  141   matr.getTransform(translation, 
rotation, scaleFactor, scaleOrientation, SbVec3f(0,0,0));
 
  142   SoTransform * 
t = tin ? tin : 
new SoTransform;
 
  143   t->translation.setValue(translation);
 
  145   t->scaleFactor.setValue(scaleFactor);
 
  146   t->scaleOrientation.setValue(scaleOrientation);
 
  147   t->center.setValue(0,0,0);
 
  149     bool inputok = 
isSane( matr, 
"input SbMatrix" );
 
  150     bool outputok = 
isSane( 
t, 
"output SoTransform" );
 
  155     if (inputok!=outputok)
 
  156       VP1Msg::messageVerbose(
"VP1LinAlgUtils::toSoTransform Error introduced in SoTransform -> SbMatrix conversion!");
 
 
 
 
◆ transformToMatrix() [1/2]
  
  | 
        
          | void VP1LinAlgUtils::transformToMatrix | ( | const HepGeom::Transform3D & | heptr, |  
          |  |  | SbMatrix & | result |  
          |  | ) |  |  |  | static | 
 
Definition at line 118 of file VP1LinAlgUtils.cxx.
  120   result = SbMatrix(heptr.xx(),heptr.yx(),heptr.zx(),0,
 
  121             heptr.xy(),heptr.yy(),heptr.zy(),0,
 
  122             heptr.xz(),heptr.yz(),heptr.zz(),0,
 
  123             heptr.dx(),heptr.dy(),heptr.dz(),1);
 
  125     bool inputok = 
isSane( heptr, 
"input HepGeom::Transform3D" );
 
  128       VP1Msg::messageVerbose(
"VP1LinAlgUtils::transformToMatrix(HepGeom::Transform3D,..) ERROR: Problems observed in input HepGeom::Transform3D");
 
  130       VP1Msg::messageVerbose(
"VP1LinAlgUtils::transformToMatrix(HepGeom::Transform3D,..) ERROR: Problems observed in output SbMatrix");
 
  131     if (inputok!=outputok)
 
  132       VP1Msg::messageVerbose(
"VP1LinAlgUtils::transformToMatrix(HepGeom::Transform3D,..) Error introduced in HepGeom::Transform3D -> SbMatrix conversion!");
 
 
 
 
◆ transformToMatrix() [2/2]
  
  | 
        
          | void VP1LinAlgUtils::transformToMatrix | ( | SoTransform * | xf, |  
          |  |  | SbMatrix & | result |  
          |  | ) |  |  |  | static | 
 
Definition at line 101 of file VP1LinAlgUtils.cxx.
  103   result.setTransform(xf->translation.getValue(), xf->rotation.getValue(),
 
  104               xf->scaleFactor.getValue(), xf->scaleOrientation.getValue(), xf->center.getValue());
 
  106     bool inputok = 
isSane( xf, 
"input SoTransform" );
 
  109       VP1Msg::messageVerbose(
"VP1LinAlgUtils::transformToMatrix(SoTransform*,..) ERROR: Problems observed in input SoTransform");
 
  111       VP1Msg::messageVerbose(
"VP1LinAlgUtils::transformToMatrix(SoTransform*,..) ERROR: Problems observed in output SbMatrix");
 
  112     if (inputok!=outputok)
 
  113       VP1Msg::messageVerbose(
"VP1LinAlgUtils::transformToMatrix(SoTransform*,..) Error introduced in SoTransform -> SbMatrix conversion!");
 
 
 
 
The documentation for this class was generated from the following files: