Exemplo n.º 1
0
 TEST(HitPointInterval, ShouldTransformInterval) {
   HitPointInterval interval;
   HitPoint hitPoint1(box, 2, Vector3d(1, 0, 0), Vector3d(0, 1, 0));
   HitPoint hitPoint2(box, 3, Vector3d(2, 0, 0), Vector3d(0, 1, 0));
   interval.add(hitPoint1, hitPoint2);
   
   Matrix4d pointMatrix = Matrix3d::rotateZ(1_radians);
   Matrix3d normalMatrix = Matrix3d::rotateX(1_radians);
   
   HitPointInterval transformed = interval.transform(pointMatrix, normalMatrix);
   ASSERT_EQ(Vector3d(pointMatrix * Vector4d(1, 0, 0)), transformed.min().point());
 }
Exemplo n.º 2
0
 TEST(HitPointInterval, ShouldComputeMergedInterval) {
   HitPointInterval interval;
   HitPoint hitPoint1(box, 2, Vector3d(), Vector3d());
   HitPoint hitPoint2(box, 3, Vector3d(), Vector3d());
   HitPoint hitPoint3(box, 4, Vector3d(), Vector3d());
   HitPoint hitPoint4(box, 5, Vector3d(), Vector3d());
   interval.add(hitPoint1, hitPoint2);
   interval.add(hitPoint3, hitPoint4);
   
   interval = interval.merged();
   ASSERT_EQ(2ul, interval.points().size());
   ASSERT_TRUE(interval.min() == hitPoint1);
   ASSERT_TRUE(interval.max() == hitPoint4);
 }
Exemplo n.º 3
0
 TEST(HitPointInterval, ShouldSetClosestAndFarthestHitPointWhenOnlyOneHitPointIsAdded) {
   HitPointInterval interval;
   HitPoint hitPoint(box, 5, Vector3d(), Vector3d());
   interval.add(hitPoint);
   ASSERT_TRUE(interval.min() == interval.max());
 }
Exemplo n.º 4
0
 TEST(HitPointInterval, ShouldReturnFarthestHitPoint) {
   HitPointInterval interval;
   HitPoint hitPoint(box, 5, Vector3d(), Vector3d());
   interval.add(hitPoint);
   ASSERT_TRUE(hitPoint == interval.max());
 }
Exemplo n.º 5
0
 TEST(HitPointInterval, ShouldAddTwoHitPointsAsPair) {
   HitPointInterval interval;
   interval.add(HitPoint(), HitPoint());
 }
Exemplo n.º 6
0
 TEST(HitPointInterval, ShouldAddSingleHitPoint) {
   HitPointInterval interval;
   interval.add(HitPoint());
 }