aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-04-15 05:54:07 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-04-15 05:54:07 +0000
commitc74496098446ace1c1fcef183d43d6947815f1db (patch)
tree43a1173bae9cb464141f8e30543bc93fe20dbf5a /unsupported/Eigen
parent6ee4eb94fba780f45942dd97952174e8eda4e7eb (diff)
patch from Ilya Baran: This small patch fixes a potential initialization
bug in BVAlgorithms and slightly corrects the BVH doc.
Diffstat (limited to 'unsupported/Eigen')
-rw-r--r--unsupported/Eigen/BVH4
-rw-r--r--unsupported/Eigen/src/BVH/BVAlgorithms.h38
2 files changed, 27 insertions, 15 deletions
diff --git a/unsupported/Eigen/BVH b/unsupported/Eigen/BVH
index 4fda52b97..39ec9e1b0 100644
--- a/unsupported/Eigen/BVH
+++ b/unsupported/Eigen/BVH
@@ -54,8 +54,8 @@ namespace Eigen {
* - Determine all points where a ray intersects a triangle mesh
* - Given a set of points, determine which are contained in a query sphere
* - Given a set of spheres, determine which contain the query point
- * - Given a set of spheres, determine if any is completely contained in a query box (not an intersection query,
- but can still be accelerated by pruning all spheres that do not intersect the query box)
+ * - Given a set of disks, determine if any is completely contained in a query rectangle (represent each 2D disk as a point \f$(x,y,r)\f$
+ * in 3D and represent the rectangle as a pyramid based on the original rectangle and shrinking in the \f$r\f$ direction)
* - Given a set of points, count how many pairs are \f$d\pm\epsilon\f$ apart (done by looking at the cartesian product of the set
* of points with itself)
*
diff --git a/unsupported/Eigen/src/BVH/BVAlgorithms.h b/unsupported/Eigen/src/BVH/BVAlgorithms.h
index 15d53d44a..a3f78eccc 100644
--- a/unsupported/Eigen/src/BVH/BVAlgorithms.h
+++ b/unsupported/Eigen/src/BVH/BVAlgorithms.h
@@ -42,9 +42,11 @@ template<typename BVH, typename Intersector>
bool ei_intersect_helper(const BVH &tree, Intersector &intersector, typename BVH::Index root)
{
typedef typename BVH::Index Index;
+ typedef typename BVH::VolumeIterator VolIter;
+ typedef typename BVH::ObjectIterator ObjIter;
- typename BVH::VolumeIterator vBegin, vEnd;
- typename BVH::ObjectIterator oBegin, oEnd;
+ VolIter vBegin = VolIter(), vEnd = VolIter();
+ ObjIter oBegin = ObjIter(), oEnd = ObjIter();
std::vector<Index> todo(1, root);
@@ -99,11 +101,15 @@ void BVIntersect(const BVH1 &tree1, const BVH2 &tree2, Intersector &intersector)
typedef typename BVH2::Index Index2;
typedef ei_intersector_helper1<typename BVH1::Volume, typename BVH1::Object, typename BVH2::Object, Intersector> Helper1;
typedef ei_intersector_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Intersector> Helper2;
+ typedef typename BVH1::VolumeIterator VolIter1;
+ typedef typename BVH1::ObjectIterator ObjIter1;
+ typedef typename BVH2::VolumeIterator VolIter2;
+ typedef typename BVH2::ObjectIterator ObjIter2;
- typename BVH1::VolumeIterator vBegin1, vEnd1;
- typename BVH1::ObjectIterator oBegin1, oEnd1;
- typename BVH2::VolumeIterator vBegin2, vEnd2, vCur2;
- typename BVH2::ObjectIterator oBegin2, oEnd2, oCur2;
+ VolIter1 vBegin1 = VolIter1(), vEnd1 = VolIter1();
+ ObjIter1 oBegin1 = ObjIter1(), oEnd1 = ObjIter1();
+ VolIter2 vBegin2 = VolIter2(), vEnd2 = VolIter2(), vCur2 = VolIter2();
+ ObjIter2 oBegin2 = ObjIter2(), oEnd2 = ObjIter2(), oCur2 = ObjIter2();
std::vector<std::pair<Index1, Index2> > todo(1, std::make_pair(tree1.getRootIndex(), tree2.getRootIndex()));
@@ -162,9 +168,11 @@ typename Minimizer::Scalar ei_minimize_helper(const BVH &tree, Minimizer &minimi
typedef typename Minimizer::Scalar Scalar;
typedef typename BVH::Index Index;
typedef std::pair<Scalar, Index> QueueElement; //first element is priority
+ typedef typename BVH::VolumeIterator VolIter;
+ typedef typename BVH::ObjectIterator ObjIter;
- typename BVH::VolumeIterator vBegin = 0, vEnd = 0;
- typename BVH::ObjectIterator oBegin = 0, oEnd = 0;
+ VolIter vBegin = VolIter(), vEnd = VolIter();
+ ObjIter oBegin = ObjIter(), oEnd = ObjIter();
std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
todo.push(std::make_pair(Scalar(), root));
@@ -229,11 +237,15 @@ typename Minimizer::Scalar BVMinimize(const BVH1 &tree1, const BVH2 &tree2, Mini
typedef ei_minimizer_helper1<typename BVH1::Volume, typename BVH1::Object, typename BVH2::Object, Minimizer> Helper1;
typedef ei_minimizer_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Minimizer> Helper2;
typedef std::pair<Scalar, std::pair<Index1, Index2> > QueueElement; //first element is priority
-
- typename BVH1::VolumeIterator vBegin1, vEnd1 = 0;
- typename BVH1::ObjectIterator oBegin1 = 0, oEnd1 = 0;
- typename BVH2::VolumeIterator vBegin2, vEnd2 = 0, vCur2;
- typename BVH2::ObjectIterator oBegin2 = 0, oEnd2 = 0, oCur2;
+ typedef typename BVH1::VolumeIterator VolIter1;
+ typedef typename BVH1::ObjectIterator ObjIter1;
+ typedef typename BVH2::VolumeIterator VolIter2;
+ typedef typename BVH2::ObjectIterator ObjIter2;
+
+ VolIter1 vBegin1 = VolIter1(), vEnd1 = VolIter1();
+ ObjIter1 oBegin1 = ObjIter1(), oEnd1 = ObjIter1();
+ VolIter2 vBegin2 = VolIter2(), vEnd2 = VolIter2(), vCur2 = VolIter2();
+ ObjIter2 oBegin2 = ObjIter2(), oEnd2 = ObjIter2(), oCur2 = ObjIter2();
std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
Scalar minimum = std::numeric_limits<Scalar>::max();