11 #include <Eigen/StdVector> 12 #include <Eigen/Geometry> 13 #include <unsupported/Eigen/BVH> 38 inline double SQR(
double x) {
return x *
x; }
96 typedef std::vector<VectorType, aligned_allocator<VectorType> >
VectorTypeList;
98 typedef std::vector<BallType, aligned_allocator<BallType> >
BallTypeList;
104 for(
int i = 0;
i < 500; ++
i) {
105 b.push_back(BallType(VectorType::Random(), 0.5 * internal::random(0., 1.)));
109 VectorType
pt = VectorType::Random();
112 for(
int i = 0;
i < (
int)b.size(); ++
i)
113 i1.intersectObject(b[
i]);
123 for(
int i = 0;
i < 500; ++
i) {
124 b.push_back(BallType(VectorType::Random(), 0.01 * internal::random(0., 1.)));
128 VectorType
pt = VectorType::Random();
133 for(
int i = 0;
i < (
int)b.size(); ++
i)
146 for(
int i = 0;
i < 50; ++
i) {
147 b.push_back(BallType(VectorType::Random(), 0.5 * internal::random(0., 1.)));
148 for(
int j = 0;
j < 3; ++
j)
149 v.push_back(VectorType::Random());
157 for(
int i = 0;
i < (
int)b.size(); ++
i)
158 for(
int j = 0;
j < (
int)v.size(); ++
j)
159 i1.intersectObjectObject(b[
i], v[
j]);
163 VERIFY(i1.count == i2.count);
171 for(
int i = 0;
i < 50; ++
i) {
172 b.push_back(BallType(VectorType::Random(), 1
e-7 + 1
e-6 * internal::random(0., 1.)));
173 for(
int j = 0;
j < 3; ++
j)
174 v.push_back(VectorType::Random());
184 for(
int i = 0;
i < (
int)b.size(); ++
i)
185 for(
int j = 0;
j < (
int)v.size(); ++
j)
186 m1 = (
std::min)(
m1, i1.minimumOnObjectObject(b[
i], v[
j]));
198 #ifdef EIGEN_TEST_PART_1 206 #ifdef EIGEN_TEST_PART_2 214 #ifdef EIGEN_TEST_PART_3 double minimumOnObjectObject(const BallType &b, const VectorType &v)
BallPointStuff(const VectorType &inP)
double minimumOnVolumeVolume(const BoxType &r1, const BoxType &r2)
void test3(double add, OptionalJacobian< 2, 1 > H={})
Box2d bounding_box(const Vector2d &v)
std::vector< BallType, aligned_allocator< BallType > > BallTypeList
AlignedBox< double, Dim > BoxType
void test4(OptionalJacobian< 2, 3 > H={})
double minimumOnObjectObject(const BallType &b1, const BallType &b2)
Minimizer::Scalar BVMinimize(const BVH &tree, Minimizer &minimizer)
Ball(const VectorType &c, double r)
bool intersectObjectVolume(const BallType &b, const BoxType &r)
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC NonInteger exteriorDistance(const MatrixBase< Derived > &p) const
bool intersectObjectObject(const BallType &b, const VectorType &v)
static const Point3 pt(1.0, 2.0, 3.0)
void test2(OptionalJacobian<-1,-1 > H={})
double minimumOnObjectVolume(const BallType &b, const BoxType &r)
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
double minimumOnVolume(const BoxType &r)
#define VERIFY_IS_APPROX(a, b)
std::vector< VectorType, aligned_allocator< VectorType > > VectorTypeList
bool intersectVolume(const BoxType &r)
Array< int, Dynamic, 1 > v
bool intersectObjectObject(const BallType &b1, const BallType &b2)
bool intersectVolumeObject(const BoxType &r, const BallType &b)
Matrix< double, Dim, 1 > VectorType
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double minimumOnObject(const BallType &b)
double minimumOnVolumeObject(const BoxType &r, const VectorType &v)
void BVIntersect(const BVH &tree, Intersector &intersector)
EIGEN_DEVICE_FUNC Scalar squaredExteriorDistance(const MatrixBase< Derived > &p) const
bool intersectObject(const BallType &b)
#define CALL_SUBTEST(FUNC)
bool intersectVolumeVolume(const BoxType &r1, const BoxType &r2)
AlignedBox< double, Dim > BoxType
Matrix< double, Dim, 1 > VectorType
EIGEN_DEVICE_FUNC AlignedBox intersection(const AlignedBox &b) const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
A simple bounding volume hierarchy based on AlignedBox.
EIGEN_DEVICE_FUNC bool contains(const MatrixBase< Derived > &p) const
double minimumOnVolumeObject(const BoxType &r, const BallType &b)
bool intersectVolumeObject(const BoxType &r, const VectorType &v)