37 #include <gtest/gtest.h> 40 #include "fcl/config.h" 66 v1.array() *= v3.array();
67 EXPECT_TRUE(v1.array().isApprox(v2.array() * v3.array()));
68 v1.array() /= v3.array();
70 v1.array() /= v3.array();
71 EXPECT_TRUE(v1.array().isApprox(v2.array() / v3.array()));
72 v1.array() *= v3.array();
98 EXPECT_TRUE(std::abs(v1.squaredNorm() - 50.0) < 1e-5);
99 EXPECT_TRUE(std::abs(v1.norm() - sqrt(50.0)) < 1e-5);
100 EXPECT_TRUE(v1.normalized().isApprox(v1 / v1.norm()));
104 EXPECT_TRUE((v1.cross(v2)).isApprox(
Vector3<S>(-2.0, 4.0, -2.0)));
105 EXPECT_TRUE(v1.dot(v2) == 26);
111 test_vec_test_basic_vector<double>();
114 template <
typename S>
118 detail::morton_functor<S, std::bitset<30>> F1(bbox);
119 detail::morton_functor<S, std::bitset<60>> F2(bbox);
120 detail::morton_functor<S, uint64> F3(bbox);
121 detail::morton_functor<S, uint32> F4(bbox);
132 test_morton<double>();
136 template <
typename S>
148 EXPECT_EQ(rss.
height(), 0.0);
149 EXPECT_EQ(rss.
depth(), 0.0);
154 EXPECT_EQ(rss.
width(), 1.0);
155 EXPECT_EQ(rss.
height(), 0.0);
156 EXPECT_EQ(rss.
depth(), 0.0);
162 EXPECT_EQ(rss.
width(), 1.0);
163 EXPECT_EQ(rss.
height(), 0.0);
164 EXPECT_EQ(rss.
depth(), 0.0);
170 EXPECT_EQ(rss.
width(), 1.0);
171 EXPECT_EQ(rss.
height(), 0.0);
172 EXPECT_EQ(rss.
depth(), 0.0);
180 EXPECT_EQ(rss.
width(), 1.0);
181 EXPECT_EQ(rss.
height(), 0.0);
182 EXPECT_EQ(rss.
depth(), 0.0);
191 EXPECT_EQ(rss.
height(), 0.0);
192 EXPECT_EQ(rss.
depth(), 0.0);
194 rss.
axis.col(0).isApprox(
Vector3<S>(-sqrt(2.0)/2.0, sqrt(2.0)/2.0, 0)) ||
195 rss.
axis.col(0).isApprox(
Vector3<S>(sqrt(2.0)/2.0, -sqrt(2.0)/2.0, 0)));
205 EXPECT_EQ(rss.
depth(), 0.0);
213 EXPECT_GE(rss.
depth(), 0.5);
217 template <
typename S>
255 template <
typename S>
278 rss2.
To << -1, -1, 2.5;
284 rss2.
axis << -1, 0, 0,
288 rss2.
To << 0, 0, 2.5;
293 template <
typename S>
311 test_rss_fit<double>();
316 test_rss_conversion<double>();
321 test_rss_distance<double>();
326 test_rss_position<double>();
335 int main(
int argc,
char* argv[])
337 ::testing::InitGoogleTest(&argc, argv);
338 return RUN_ALL_TESTS();
S width() const
Width of the AABB.
FCL_EXPORT void convertBV(const BV1 &bv1, const Transform3< typename BV1::S > &tf1, BV2 &bv2)
Convert a bounding volume of type BV1 in configuration tf1 to bounding volume of type BV2 in identity...
S depth() const
Depth of the OBB.
static Real eps_78()
Returns ε^(7/8) for the precision of the underlying scalar type.
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
const Vector3< S > center() const
Center of the OBB.
S width() const
Width of the OBB.
Eigen::Matrix< S, 3, 3 > Matrix3
#define EXPECT_NEAR(a, b, prec)
Vector3< S > center() const
Center of the AABB.
Eigen::Matrix< S, 3, 1 > Vector3
SaPCollisionManager< S >::SaPAABB * aabb
back pointer to SAP interval
GTEST_TEST(FCL_MATH, vec_test_basic_vector3)
S height() const
Height of the OBB.
S depth() const
Depth of the AABB.
int main(int argc, char *argv[])
void test_vec_test_basic_vector()
S height() const
Height of the AABB.
FCL_EXPORT void fit(const Vector3< typename BV::S > *const ps, int n, BV &bv)
Compute a bounding volume that fits a set of n points.
#define EXPECT_TRUE(args)
void test_rss_conversion()