[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] BVH Patch
- From: Ilya Baran <baran37@xxxxxxxxx>
- Date: Tue, 14 Apr 2009 22:29:14 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=4hs1/vwTGfOwFQ9Be2ZiGmOUU+262OTD4rxU88CFgFw=; b=rOptMC/NG5+bQd6iNVM9OPQIhzjnoU+GZELdaomdQMK60iJS7FtPFiGf5kV/H2MstP 0ZrX/1eVW832CAa8lOexJDx0v7DhzwjVqXeeXWiIFKY1uJJtj7K+FzLGSJ3VYEfp7F5z yd2VtgiZjDQ0jxGtdGgN4uvmkG9ELK/dHIqIE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=i2OUTxDjYi5eURmAkx6hhigjgPx05KTMwXle9jUO1q6/PlLvRr2cfxenyxx6edthUA EOvUGhhcLPze9gY1XCR9ernnBLNQ9ri85GjBYkykimkjDk5zRUojjhacb6OEH+8M/wn7 F8Wsincs/vRe+FOl8guDI1CSVrBNKYF3dZJYA=
Hi,
This small patch fixes a potential initialization bug in BVAlgorithms
and slightly corrects the BVH doc.
Thanks,
-Ilya
Index: unsupported/Eigen/BVH
===================================================================
--- unsupported/Eigen/BVH (revision 954066)
+++ unsupported/Eigen/BVH (working copy)
@@ -54,8 +54,8 @@
* - 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)
*
Index: unsupported/Eigen/src/BVH/BVAlgorithms.h
===================================================================
--- unsupported/Eigen/src/BVH/BVAlgorithms.h (revision 954066)
+++ unsupported/Eigen/src/BVH/BVAlgorithms.h (working copy)
@@ -42,9 +42,11 @@
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 @@
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 @@
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 @@
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
+ 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 = 0;
- typename BVH1::ObjectIterator oBegin1 = 0, oEnd1 = 0;
- typename BVH2::VolumeIterator vBegin2, vEnd2 = 0, vCur2;
- typename BVH2::ObjectIterator oBegin2 = 0, oEnd2 = 0, 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::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
Scalar minimum = std::numeric_limits<Scalar>::max();