aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-04-23 11:33:36 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-04-23 11:33:36 +0000
commitacb32c69d4e8a78763400ac045b7e06930348fe9 (patch)
tree0f48303571d5f3a1d39827eb82dffafd34a66324 /unsupported/test
parentc7bb7436f9107f96d32c229313bb3f72a85fbf21 (diff)
* update BVH to explicitely use aligned_allocator
* fix warning in StdVector
Diffstat (limited to 'unsupported/test')
-rw-r--r--unsupported/test/BVH.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/unsupported/test/BVH.cpp b/unsupported/test/BVH.cpp
index 445489eef..879daacc2 100644
--- a/unsupported/test/BVH.cpp
+++ b/unsupported/test/BVH.cpp
@@ -42,10 +42,12 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(double, Dim)
double radius;
};
+
template<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Matrix<double, Dim, 1> &v) { return AlignedBox<double, Dim>(v); }
template<int Dim> AlignedBox<double, Dim> ei_bounding_box(const Ball<Dim> &b)
{ return AlignedBox<double, Dim>(b.center.cwise() - b.radius, b.center.cwise() + b.radius); }
+
template<int Dim>
struct BallPointStuff //this class provides functions to be both an intersector and a minimizer, both for a ball and a point and for two trees
{
@@ -97,16 +99,19 @@ struct BallPointStuff //this class provides functions to be both an intersector
int count;
};
+
template<int Dim>
struct TreeTest
{
typedef Matrix<double, Dim, 1> VectorType;
+ typedef std::vector<VectorType, aligned_allocator<VectorType> > VectorTypeList;
typedef Ball<Dim> BallType;
+ typedef std::vector<BallType, aligned_allocator<BallType> > BallTypeList;
typedef AlignedBox<double, Dim> BoxType;
void testIntersect1()
{
- std::vector<BallType> b;
+ BallTypeList b;
for(int i = 0; i < 500; ++i) {
b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));
}
@@ -125,7 +130,7 @@ struct TreeTest
void testMinimize1()
{
- std::vector<BallType> b;
+ BallTypeList b;
for(int i = 0; i < 500; ++i) {
b.push_back(BallType(VectorType::Random(), 0.01 * ei_random(0., 1.)));
}
@@ -146,8 +151,8 @@ struct TreeTest
void testIntersect2()
{
- std::vector<BallType> b;
- std::vector<VectorType> v;
+ BallTypeList b;
+ VectorTypeList v;
for(int i = 0; i < 50; ++i) {
b.push_back(BallType(VectorType::Random(), 0.5 * ei_random(0., 1.)));
@@ -171,8 +176,8 @@ struct TreeTest
void testMinimize2()
{
- std::vector<BallType> b;
- std::vector<VectorType> v;
+ BallTypeList b;
+ VectorTypeList v;
for(int i = 0; i < 50; ++i) {
b.push_back(BallType(VectorType::Random(), 1e-7 + 1e-6 * ei_random(0., 1.)));
@@ -197,6 +202,7 @@ struct TreeTest
}
};
+
void test_BVH()
{
for(int i = 0; i < g_repeat; i++) {