12 struct PointPointMinimizer
14 PointPointMinimizer() : calls(0) {}
15 typedef double Scalar;
20 double minimumOnObjectObject(
const Vector2d &v1,
const Vector2d &v2) { ++calls;
return (v1 - v2).squaredNorm(); }
27 typedef std::vector<Vector2d, aligned_allocator<Vector2d> > StdVectorOfVector2d;
28 StdVectorOfVector2d redPoints, bluePoints;
29 for(
int i = 0;
i < 100; ++
i) {
34 PointPointMinimizer minimizer;
38 for(
int i = 0;
i < (int)redPoints.size(); ++
i)
39 for(
int j = 0;
j < (int)bluePoints.size(); ++
j)
40 minDistSq =
std::min(minDistSq, minimizer.minimumOnObjectObject(redPoints[
i], bluePoints[
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;
Array< int, Dynamic, 1 > v
AlignedBox< double, 2 > Box2d
Scalar squaredExteriorDistance(const AlignedBox &b) const
static const RandomReturnType Random()
A simple bounding volume hierarchy based on AlignedBox.
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
Box2d bounding_box(const Vector2d &v)
CleanedUpDerType< DerType >::type() min(const AutoDiffScalar< DerType > &x, const T &y)
CleanedUpDerType< DerType >::type() max(const AutoDiffScalar< DerType > &x, const T &y)
Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sqrt_op< typename Derived::Scalar >, const Derived > sqrt(const Eigen::ArrayBase< Derived > &x)