geolib2
test_composite_shape.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 
4 
5 #include "box_test.h"
6 
7 class CompShapeTest : public BoxTest
8 {
9 protected:
11  {
13  }
14 
15  virtual ~CompShapeTest()
16  {
17  }
18 
20 };
21 
23 {
24  ASSERT_TRUE(comp.contains(origin));
25 
26  ASSERT_TRUE(comp.contains(min));
27  ASSERT_TRUE(comp.contains(max));
28 
29  ASSERT_TRUE(comp.contains(side_center));
30  ASSERT_TRUE(comp.contains(side_center_triangle));
31 
32  ASSERT_FALSE(comp.contains(side_center_distance));
33 
34  ASSERT_FALSE(comp.contains(side_center_close));
35 }
36 
37 TEST_F(CompShapeTest, Intersect)
38 {
39  ASSERT_TRUE(comp.intersect(origin, 0));
40  ASSERT_TRUE(comp.intersect(origin, 0.1));
41 
42  ASSERT_TRUE(comp.intersect(min, 0));
43  ASSERT_TRUE(comp.intersect(min, 0.1));
44  ASSERT_TRUE(comp.intersect(max, 0));
45  ASSERT_TRUE(comp.intersect(max, 0.1));
46 
47  ASSERT_TRUE(comp.intersect(side_center, 0));
48  ASSERT_TRUE(comp.intersect(side_center, 0.1));
49  ASSERT_TRUE(comp.intersect(side_center_triangle, 0));
50  ASSERT_TRUE(comp.intersect(side_center_triangle, 0.1));
51 
52  ASSERT_FALSE(comp.intersect(side_center_distance, 0));
53  ASSERT_FALSE(comp.intersect(side_center_distance, 0.1));
54  ASSERT_TRUE(comp.intersect(side_center_distance, 0.5));
55  ASSERT_TRUE(comp.intersect(side_center_distance, 0.6));
56 
57  ASSERT_FALSE(comp.intersect(side_center_close, 0));
58  ASSERT_FALSE(comp.intersect(side_center_close, 0.1));
59  ASSERT_TRUE(comp.intersect(side_center_close, 0.2));
60  ASSERT_TRUE(comp.intersect(side_center_close, 0.25));
61 }
62 
63 int main(int argc, char **argv) {
64  testing::InitGoogleTest(&argc, argv);
65  return RUN_ALL_TESTS();
66 }
CompShapeTest::~CompShapeTest
virtual ~CompShapeTest()
Definition: test_composite_shape.cpp:15
CompShapeTest
Definition: test_composite_shape.cpp:7
geo::Transform3T::identity
static Transform3T identity()
Definition: math_types.h:778
geo::CompositeShape::addShape
void addShape(const Shape &shape, const Pose3D &pose)
add a shape to the composite
Definition: CompositeShape.cpp:86
CompShapeTest::CompShapeTest
CompShapeTest()
Definition: test_composite_shape.cpp:10
BoxTest
Definition: box_test.h:6
CompShapeTest::comp
geo::CompositeShape comp
Definition: test_composite_shape.cpp:19
BoxTest::box
geo::Box box
Definition: box_test.h:22
TEST_F
TEST_F(CompShapeTest, Contains)
Definition: test_composite_shape.cpp:22
geo::CompositeShape
A geometric description of a shape as a union of other shapes.
Definition: CompositeShape.h:16
CompositeShape.h
box_test.h
main
int main(int argc, char **argv)
Definition: test_composite_shape.cpp:63