1 #include <Eigen/StdVector> 2 #include <unsupported/Eigen/BVH> 27 typedef std::vector<Vector2d, aligned_allocator<Vector2d> > StdVectorOfVector2d;
28 StdVectorOfVector2d redPoints, bluePoints;
29 for(
int i = 0;
i < 100; ++
i) {
30 redPoints.push_back(Vector2d::Random());
31 bluePoints.push_back(Vector2d::Random());
38 for(
int i = 0;
i < (
int)redPoints.size(); ++
i)
39 for(
int j = 0;
j < (
int)bluePoints.size(); ++
j)
41 std::cout <<
"Brute force distance = " <<
sqrt(minDistSq) <<
", calls = " << minimizer.
calls << std::endl;
46 minDistSq =
BVMinimize(redTree, blueTree, minimizer);
47 std::cout <<
"BVH distance = " <<
sqrt(minDistSq) <<
", calls = " << minimizer.
calls << std::endl;
double minimumOnVolumeObject(const Box2d &r, const Vector2d &v)
Box2d bounding_box(const Vector2d &v)
Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Namespace containing all symbols from the Eigen library.
double minimumOnObjectVolume(const Vector2d &v, const Box2d &r)
EIGEN_DEVICE_FUNC Scalar squaredExteriorDistance(const MatrixBase< Derived > &p) const
AlignedBox< double, 2 > Box2d
double minimumOnObjectObject(const Vector2d &v1, const Vector2d &v2)
A simple bounding volume hierarchy based on AlignedBox.
double minimumOnVolumeVolume(const Box2d &r1, const Box2d &r2)