49 #include <gtest/gtest.h> 51 #include <ACG/Math/VectorT.hh> 52 #include <ACG/Geometry/Algorithms.hh> 59 virtual void SetUp() {
64 virtual void TearDown() {
106 EXPECT_TRUE( result ) <<
"Intersection failed!";
108 EXPECT_EQ( 1.0f, distance ) <<
"Wrong distance!" << std::endl;
109 EXPECT_EQ( 0.1f, u ) <<
"Wrong u!" << std::endl;
110 EXPECT_EQ( 0.1f, v ) <<
"Wrong v!" << std::endl;
149 EXPECT_TRUE( result ) <<
"Intersection failed!";
151 EXPECT_EQ( 1.0f, distance ) <<
"Wrong distance!" << std::endl;
152 EXPECT_EQ( 0.1f, u ) <<
"Wrong u!" << std::endl;
153 EXPECT_EQ( 0.1f, v ) <<
"Wrong v!" << std::endl;
192 EXPECT_TRUE( result ) <<
"Intersection failed!";
194 EXPECT_EQ( -1.0f, distance ) <<
"Wrong distance!" << std::endl;
195 EXPECT_EQ( 0.1f, u ) <<
"Wrong u!" << std::endl;
196 EXPECT_EQ( 0.1f, v ) <<
"Wrong v!" << std::endl;
200 TEST_F(
ALGORITHM_TEST_BASE, triangleIntersection_NegativeShootingDirection_FlippedTriangleOrientation ) {
235 EXPECT_TRUE( result ) <<
"Intersection failed!";
237 EXPECT_EQ( -1.0f, distance ) <<
"Wrong distance!" << std::endl;
238 EXPECT_EQ( 0.1f, u ) <<
"Wrong u!" << std::endl;
239 EXPECT_EQ( 0.1f, v ) <<
"Wrong v!" << std::endl;
bool triangleIntersection(const Vec &_o, const Vec &_dir, const Vec &_v0, const Vec &_v1, const Vec &_v2, typename Vec::value_type &_t, typename Vec::value_type &_u, typename Vec::value_type &_v)
Intersect a ray and a triangle.