The translation in the homogenous matrix should be in the fourth column. The code copies the translation to the fourth row instead. The rotation matrix is unchanged, so the homogenous matrix doesn’t appear to be transposed. Is this desired behavior? If yes, why?
Please find the following macro for an example:
void testTGeoHMatrices(){
cout << "Checking where rotation and translation in a TGeoHMatrix are.\n";
TGeoHMatrix rotation;
TGeoHMatrix translation;
double trans[3] = {1,2,3};
rotation.RotateX(25.0);
translation.SetTranslation(trans);
TGeoHMatrix combiTrans = translation * rotation;
cout << "matrix print function:\n";
combiTrans.Print();
cout << "last row was skipped.\n\n";
cout << "homogenous matrix:\n";
double *combi = new double[16];
combiTrans.GetHomogenousMatrix(combi);
for(int i=0; i<16; i++){
if(i%4==0) cout << "\n";
cout << combi[i] << "\t";
}
cout << "\n\nwe can see the rotaion is unchanged, but the translation\n";
cout << "is now on the fourth row.\n";
}
Best wishes,
Roman
ROOT Version: Not Provided Platform: Not Provided Compiler: Not Provided
Hi Roman,
The function was originally intended for homogenous 4x4 matrix operations supporting translation, rotation and scaling, but it was never used within the geometry package itself, but just as a way to communicate with the GL viewer, that expects the translation as the last row. I agree that this does not match the description. A possibility is to add a function that does actually the layout that is described (or alternatively to change the description), but note that no function in the geometry package will rely on the layout to do any matrix operations.
so there is no intent to change that? It seems right now I am the only one using this function. I can work around that, so no fix is really neccessary.