Macros | Functions
test_ray_intersection.cpp File Reference
#include <geometric_shapes/bodies.h>
#include <geometric_shapes/shape_operations.h>
#include <geometric_shapes/body_operations.h>
#include <boost/filesystem.hpp>
#include <random_numbers/random_numbers.h>
#include <gtest/gtest.h>
#include "resources/config.h"
Include dependency graph for test_ray_intersection.cpp:

Go to the source code of this file.

Macros

#define CHECK_INTERSECTS(body, origin, direction, numIntersections)
 
#define CHECK_INTERSECTS_ONCE(body, origin, direction, intersection, error)
 
#define CHECK_INTERSECTS_TWICE(body, origin, direction, intersc1, intersc2, error)
 
#define CHECK_NO_INTERSECTION(body, origin, direction)
 
#define EXPECT_VECTORS_EQUAL(v1, v2, error)
 

Functions

Eigen::Isometry3d getRandomPose (random_numbers::RandomNumberGenerator &g)
 
int main (int argc, char **argv)
 
 TEST (SphereRayIntersection, OriginInside)
 
 TEST (SphereRayIntersection, OriginOutside)
 
 TEST (SphereRayIntersection, SimpleRay1)
 
 TEST (SphereRayIntersection, SimpleRay2)
 
 TEST (CylinderRayIntersection, OriginInside)
 
 TEST (CylinderRayIntersection, OriginOutside)
 
 TEST (CylinderRayIntersection, SimpleRay1)
 
 TEST (CylinderRayIntersection, SimpleRay2)
 
 TEST (BoxRayIntersection, SimpleRay1)
 
 TEST (BoxRayIntersection, SimpleRay2)
 
 TEST (BoxRayIntersection, SimpleRay3)
 
 TEST (BoxRayIntersection, Regression109)
 
 TEST (BoxRayIntersection, OriginInside)
 
 TEST (BoxRayIntersection, OriginOutsideIntersects)
 
 TEST (ConvexMeshRayIntersection, SimpleRay1)
 
 TEST (ConvexMeshRayIntersection, SimpleRay2)
 
 TEST (ConvexMeshRayIntersection, SimpleRay3)
 
 TEST (ConvexMeshRayIntersection, OriginInside)
 
 TEST (ConvexMeshRayIntersection, OriginOutsideIntersects)
 

Macro Definition Documentation

◆ CHECK_INTERSECTS

#define CHECK_INTERSECTS (   body,
  origin,
  direction,
  numIntersections 
)
Value:
{ \
EigenSTL::vector_Vector3d intersections; \
Eigen::Vector3d o origin; \
Eigen::Vector3d d direction; \
const auto result = (body).intersectsRay(o, d, &intersections, 2); \
EXPECT_TRUE(result); \
EXPECT_EQ(static_cast<size_t>((numIntersections)), intersections.size()); \
}
d

Definition at line 72 of file test_ray_intersection.cpp.

◆ CHECK_INTERSECTS_ONCE

#define CHECK_INTERSECTS_ONCE (   body,
  origin,
  direction,
  intersection,
  error 
)
Value:
{ \
EigenSTL::vector_Vector3d intersections; \
Eigen::Vector3d o origin; \
Eigen::Vector3d d direction; \
Eigen::Vector3d i intersection; \
const auto result = (body).intersectsRay(o, d, &intersections, 2); \
EXPECT_TRUE(result); \
EXPECT_EQ(1u, intersections.size()); \
if (intersections.size() == 1u) \
{ \
EXPECT_VECTORS_EQUAL(intersections.at(0), i, (error)); \
} \
}
d

Definition at line 82 of file test_ray_intersection.cpp.

◆ CHECK_INTERSECTS_TWICE

#define CHECK_INTERSECTS_TWICE (   body,
  origin,
  direction,
  intersc1,
  intersc2,
  error 
)
Value:
{ \
EigenSTL::vector_Vector3d intersections; \
Eigen::Vector3d o origin; \
Eigen::Vector3d d direction; \
Eigen::Vector3d i1 intersc1; \
Eigen::Vector3d i2 intersc2; \
const auto result = (body).intersectsRay(o, d, &intersections, 2); \
EXPECT_TRUE(result); \
EXPECT_EQ(2u, intersections.size()); \
if (intersections.size() == 2u) \
{ \
if (fabs(static_cast<double>((intersections.at(0) - i1).norm())) < (error)) \
{ \
EXPECT_VECTORS_EQUAL(intersections.at(0), i1, (error)); \
EXPECT_VECTORS_EQUAL(intersections.at(1), i2, (error)); \
} \
else \
{ \
EXPECT_VECTORS_EQUAL(intersections.at(0), i2, (error)); \
EXPECT_VECTORS_EQUAL(intersections.at(1), i1, (error)); \
} \
} \
}
d

Definition at line 97 of file test_ray_intersection.cpp.

◆ CHECK_NO_INTERSECTION

#define CHECK_NO_INTERSECTION (   body,
  origin,
  direction 
)
Value:
{ \
EigenSTL::vector_Vector3d intersections; \
Eigen::Vector3d o origin; \
Eigen::Vector3d d direction; \
const auto result = (body).intersectsRay(o, d, &intersections, 2); \
EXPECT_FALSE(result); \
EXPECT_EQ(0u, intersections.size()); \
}
d

Definition at line 62 of file test_ray_intersection.cpp.

◆ EXPECT_VECTORS_EQUAL

#define EXPECT_VECTORS_EQUAL (   v1,
  v2,
  error 
)
Value:
EXPECT_NEAR((v1)[0], (v2)[0], (error)); \
EXPECT_NEAR((v1)[1], (v2)[1], (error)); \
EXPECT_NEAR((v1)[2], (v2)[2], (error));
#define EXPECT_NEAR(a, b, prec)

Definition at line 57 of file test_ray_intersection.cpp.

Function Documentation

◆ getRandomPose()

Eigen::Isometry3d getRandomPose ( random_numbers::RandomNumberGenerator g)

Ioan Sucan Martin Pecka

Definition at line 46 of file test_ray_intersection.cpp.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1373 of file test_ray_intersection.cpp.

◆ TEST() [1/19]

TEST ( SphereRayIntersection  ,
OriginInside   
)

Definition at line 122 of file test_ray_intersection.cpp.

◆ TEST() [2/19]

TEST ( SphereRayIntersection  ,
OriginOutside   
)

Definition at line 263 of file test_ray_intersection.cpp.

◆ TEST() [3/19]

TEST ( SphereRayIntersection  ,
SimpleRay1   
)

Definition at line 387 of file test_ray_intersection.cpp.

◆ TEST() [4/19]

TEST ( SphereRayIntersection  ,
SimpleRay2   
)

Definition at line 396 of file test_ray_intersection.cpp.

◆ TEST() [5/19]

TEST ( CylinderRayIntersection  ,
OriginInside   
)

Definition at line 405 of file test_ray_intersection.cpp.

◆ TEST() [6/19]

TEST ( CylinderRayIntersection  ,
OriginOutside   
)

Definition at line 548 of file test_ray_intersection.cpp.

◆ TEST() [7/19]

TEST ( CylinderRayIntersection  ,
SimpleRay1   
)

Definition at line 685 of file test_ray_intersection.cpp.

◆ TEST() [8/19]

TEST ( CylinderRayIntersection  ,
SimpleRay2   
)

Definition at line 694 of file test_ray_intersection.cpp.

◆ TEST() [9/19]

TEST ( BoxRayIntersection  ,
SimpleRay1   
)

Definition at line 703 of file test_ray_intersection.cpp.

◆ TEST() [10/19]

TEST ( BoxRayIntersection  ,
SimpleRay2   
)

Definition at line 712 of file test_ray_intersection.cpp.

◆ TEST() [11/19]

TEST ( BoxRayIntersection  ,
SimpleRay3   
)

Definition at line 726 of file test_ray_intersection.cpp.

◆ TEST() [12/19]

TEST ( BoxRayIntersection  ,
Regression109   
)

Definition at line 740 of file test_ray_intersection.cpp.

◆ TEST() [13/19]

TEST ( BoxRayIntersection  ,
OriginInside   
)

Definition at line 753 of file test_ray_intersection.cpp.

◆ TEST() [14/19]

TEST ( BoxRayIntersection  ,
OriginOutsideIntersects   
)

Definition at line 901 of file test_ray_intersection.cpp.

◆ TEST() [15/19]

TEST ( ConvexMeshRayIntersection  ,
SimpleRay1   
)

Definition at line 1038 of file test_ray_intersection.cpp.

◆ TEST() [16/19]

TEST ( ConvexMeshRayIntersection  ,
SimpleRay2   
)

Definition at line 1049 of file test_ray_intersection.cpp.

◆ TEST() [17/19]

TEST ( ConvexMeshRayIntersection  ,
SimpleRay3   
)

Definition at line 1065 of file test_ray_intersection.cpp.

◆ TEST() [18/19]

TEST ( ConvexMeshRayIntersection  ,
OriginInside   
)

Definition at line 1081 of file test_ray_intersection.cpp.

◆ TEST() [19/19]

TEST ( ConvexMeshRayIntersection  ,
OriginOutsideIntersects   
)

Definition at line 1234 of file test_ray_intersection.cpp.



geometric_shapes
Author(s): Ioan Sucan , Gil Jones
autogenerated on Thu May 20 2021 02:12:07