vtkGeantEvent
This commit is contained in:
@@ -101,7 +101,11 @@ public:
|
||||
* @brief Gets the current size (scale) of the box.
|
||||
* @return The size vector.
|
||||
*/
|
||||
inline Vector3f GetSize() const { return m_LocalT.GetScale(); }
|
||||
inline Vector3f GetSize() const {
|
||||
Vector3f s = this->GetScale();
|
||||
Vector3f ls = m_LocalT.GetScale();
|
||||
return Vector3f(s(0) * ls(0), s(1) * ls(1), s(2) * ls(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Swaps two local axes of the box.
|
||||
|
||||
@@ -105,7 +105,11 @@ public:
|
||||
|
||||
inline void Scale(const Vector3f v) { this->m_T.scale(v); }
|
||||
|
||||
inline Vector3f GetScale() const { return this->m_T.linear() * Vector3f(1,1,1); } // FIXXXXXXX
|
||||
inline Vector3f GetScale() const {
|
||||
return Vector3f(m_T.linear().col(0).norm(),
|
||||
m_T.linear().col(1).norm(),
|
||||
m_T.linear().col(2).norm());
|
||||
}
|
||||
|
||||
|
||||
inline void Rotate(const Matrix3f m) { this->m_T.rotate(m); }
|
||||
|
||||
@@ -122,7 +122,7 @@ int main()
|
||||
|
||||
{
|
||||
ContainerBox Box;
|
||||
Box.SetPosition(Vector3f(1,1,1));
|
||||
Box.SetOrigin(Vector3f(1,1,1));
|
||||
Box.SetSize(Vector3f(2,2,2));
|
||||
Box.EulerYZYRotate(Vector3f(0,0,0));
|
||||
HPoint3f pt = Box.GetLocalPoint(HPoint3f(2,3,2));
|
||||
@@ -130,6 +130,39 @@ int main()
|
||||
TEST0( Vector4f0(wp - HPoint3f(2,3,2)) );
|
||||
}
|
||||
|
||||
{
|
||||
ContainerBox Box;
|
||||
Box.SetPosition(Vector3f(-0.5,-0.5,-0.5));
|
||||
Box.SetSize(Vector3f(1,1,1));
|
||||
HPoint3f pt = Box.GetLocalPoint(HPoint3f(0,0,0));
|
||||
HPoint3f wp = Box.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(0,0,0)) );
|
||||
}
|
||||
|
||||
{
|
||||
ContainerBox Box;
|
||||
Box.SetOrigin(Vector3f(-1.5,-1.5,-1.5));
|
||||
Box.SetSize(Vector3f(3,3,3));
|
||||
HPoint3f pt = Box.GetLocalPoint(HPoint3f(0,0,0));
|
||||
HPoint3f wp = Box.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(0,0,0)) );
|
||||
|
||||
pt = HPoint3f(1,1,1);
|
||||
wp = Box.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(1.5, 1.5, 1.5)) );
|
||||
|
||||
Box.EulerYZYRotate(Vector3f(M_PI,0,0));
|
||||
pt = HPoint3f(1,1,1);
|
||||
wp = Box.GetWorldPoint(pt);
|
||||
TEST0( Vector4f0(wp - HPoint3f(-1.5, 1.5, -1.5)) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
static int _fail = 0; \
|
||||
printf("..:: Testing " #name " ::..\n");
|
||||
|
||||
#define TEST1(val) _fail += (val)==0
|
||||
#define TEST0(val) _fail += (val)!=0
|
||||
#define TEST1(val) if ((val)==0) { printf("Assertion failed: %s != 0\n", #val); _fail++; }
|
||||
#define TEST0(val) if ((val)!=0) { printf("Assertion failed: %s != 0\n", #val); _fail++; }
|
||||
#define END_TESTING return _fail;
|
||||
|
||||
#define ASSERT_EQ(a, b) if ((a) != (b)) { printf("Assertion failed: %s != %s\n", #a, #b); _fail++; }
|
||||
Reference in New Issue
Block a user