41 #include <initializer_list>
53 using std::make_shared;
58 ccd_vec3_t to_ccd(
const Vector3d& v) {
60 ccdVec3Set(&ccd_v, v[0], v[1], v[2]);
64 Vector3d from_ccd(
const ccd_vec3_t& v) {
65 return Vector3d{v.v[0], v.v[1], v.v[2]};
73 GTEST_TEST(GjkLibccdSupportFunction, ConvexSupport) {
96 auto vertices = make_shared<vector<Vector3d>>(std::initializer_list<Vector3d>{
101 auto faces = make_shared<vector<int>>(
102 std::initializer_list<int>{4, 0, 3, 2, 1,
110 const int kNumFaces = 6;
111 const bool kThrowIfInvalid =
true;
112 const Convex<double> convex_C(move(vertices), kNumFaces, move(faces),
117 aligned_vector<Transform3d> X_WCs;
118 X_WCs.push_back(Transform3d::Identity());
126 for (
const auto& dir_C : directions_C) {
127 const Vector3d& p_CV_expected = convex_C.findExtremeVertex(dir_C);
128 for (
const auto& X_WC : X_WCs) {
130 GJKInitializer<double, Convex<double>>::createGJKObject(convex_C,
132 ccd_vec3_t dir_W = to_ccd(X_WC * dir_C);
134 supportConvex<double>(gjk_convex, &dir_W, &p_WV);
142 GJKInitializer<double, Convex<double>>::deleteGJKObject(gjk_convex);
158 int main(
int argc,
char* argv[]) {
159 ::testing::InitGoogleTest(&argc, argv);
160 return RUN_ALL_TESTS();