DetectorChamber vtk handler
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "Math/Dense.h"
|
||||
#include "Math/ContainerBox.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
@@ -52,41 +53,82 @@ int main()
|
||||
|
||||
BEGIN_TESTING(Math ContainerBox);
|
||||
|
||||
ContainerBox Cnt;
|
||||
|
||||
// // Local transform:
|
||||
Cnt.SetOrigin(Vector3f(-1,-1,-1));
|
||||
Cnt.SetSize(Vector3f(2,2,2)); // scaling //
|
||||
std::cout << "Container scale is: " << Cnt.GetSize().transpose() << "\n";
|
||||
std::cout << "Container scale is: " << Cnt.GetSize().transpose() << "\n";
|
||||
TEST0( Vector4f0(Cnt.GetSize().homogeneous() - HVector3f(2,2,2)) );
|
||||
{
|
||||
ContainerBox Cnt;
|
||||
Cnt.SetOrigin(Vector3f(0,0,0));
|
||||
Cnt.SetSize(Vector3f(2,2,2));
|
||||
TEST0( Vector4f0(Cnt.GetOrigin().homogeneous() - HVector3f(0,0,0)) );
|
||||
TEST0( Vector4f0(Cnt.GetSize().homogeneous() - HVector3f(2,2,2)) );
|
||||
|
||||
|
||||
ContainerBox Box;
|
||||
HPoint3f pt = Cnt.GetLocalPoint(HPoint3f(0,0,0));
|
||||
HPoint3f wp = Cnt.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(0,0,0)) );
|
||||
|
||||
Box.SetPosition(Vector3f(1,1,1));
|
||||
Box.SetSize(Vector3f(2,2,2));
|
||||
Box.EulerYZYRotate(Vector3f(0,0,0));
|
||||
HPoint3f pt = Box.GetLocalPoint(HPoint3f(2,3,2));
|
||||
HPoint3f wp = Box.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(2,3,2)) );
|
||||
HPoint3f pt2 = Cnt.GetLocalPoint(HPoint3f(2,2,2));
|
||||
HPoint3f wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(2,2,2)) );
|
||||
|
||||
HPoint3f pt3 = Cnt.GetLocalPoint(HPoint3f(1,1,1));
|
||||
HPoint3f wp3 = Cnt.GetWorldPoint(pt3);
|
||||
TEST0( Vector4f0(wp3 - HPoint3f(1,1,1)) );
|
||||
|
||||
//// // Global
|
||||
// Cnt.SetPosition(Vector3f(1,1,1));
|
||||
// Cnt.EulerYZYRotate(Vector3f(M_PI_2,M_PI_2,0));
|
||||
// HPoint3f p = Cnt.GetWorldPoint(1,1,1);
|
||||
// //std::cout << p.transpose() << "\n";
|
||||
// TEST0( Vector4f0(p - HVector3f(2,1,2)) );
|
||||
// p = Cnt.GetWorldPoint(1,2,3);
|
||||
// //std::cout << p.transpose() << "\n";
|
||||
// TEST0( Vector4f0(p - HVector3f(4,1,3)) );
|
||||
HPoint3f pt4 = Cnt.GetLocalPoint(HPoint3f(1,2,3));
|
||||
HPoint3f wp4 = Cnt.GetWorldPoint(pt4);
|
||||
TEST0( Vector4f0(wp4 - HPoint3f(1,2,3)) );
|
||||
}
|
||||
|
||||
{
|
||||
ContainerBox Cnt;
|
||||
Cnt.SetOrigin(Vector3f(0,0,0));
|
||||
Cnt.SetSize(Vector3f(2,2,2));
|
||||
Cnt.EulerYZYRotate(Vector3f(M_PI,0,0));
|
||||
|
||||
HPoint3f pt = Cnt.GetLocalPoint(HPoint3f(0,0,0));
|
||||
HPoint3f wp = Cnt.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(0,0,0)) );
|
||||
|
||||
// // scaling //
|
||||
HPoint3f pt2 = Cnt.GetLocalPoint(HPoint3f(2,2,2));
|
||||
HPoint3f wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(2,2,2)) );
|
||||
|
||||
pt2 = HPoint3f(1,1,1);
|
||||
wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(-2,2,-2)) );
|
||||
|
||||
pt2 = HPoint3f(1,2,3);
|
||||
wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(-2,4,-6)) );
|
||||
}
|
||||
|
||||
{
|
||||
ContainerBox Cnt;
|
||||
Cnt.SetOrigin(Vector3f(-1,-1,-1));
|
||||
Cnt.SetSize(Vector3f(2,2,2)); // scaling //
|
||||
|
||||
HPoint3f pt2 = HPoint3f(.5,.5,.5);
|
||||
HPoint3f wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(0,0,0)) );
|
||||
|
||||
pt2 = HPoint3f(0,0,0);
|
||||
wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(-1,-1,-1)) );
|
||||
|
||||
Cnt.EulerYZYRotate(Vector3f(M_PI,0,0));
|
||||
pt2 = HPoint3f(0,0,0);
|
||||
wp2 = Cnt.GetWorldPoint(pt2);
|
||||
TEST0( Vector4f0(wp2 - HPoint3f(1,-1,1)) );
|
||||
}
|
||||
|
||||
{
|
||||
ContainerBox Box;
|
||||
Box.SetPosition(Vector3f(1,1,1));
|
||||
Box.SetSize(Vector3f(2,2,2));
|
||||
Box.EulerYZYRotate(Vector3f(0,0,0));
|
||||
HPoint3f pt = Box.GetLocalPoint(HPoint3f(2,3,2));
|
||||
HPoint3f wp = Box.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(2,3,2)) );
|
||||
}
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user