[ODE] dxHashSpace::collide2
Adam D. Moss
aspirin at ntlworld.com
Tue May 6 01:08:02 2003
This is a multi-part message in MIME format.
--------------070005060701050407080302
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Clint Brewer wrote:
> just in case somebody has done this already :)
Naive implementation attached. It works, but this implementation
is no faster than collide2 on a SimpleSpace. I've posted this
to the list before.
Regards,
--Adam
--
Adam D. Moss . ,,^^ adam@gimp.org http://www.foxbox.org/ co:3
Bereaved relatives are not amused
As on their dear departed I feverishly consume
--------------070005060701050407080302
Content-Type: text/plain;
name="ODE-COLLIDE2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ODE-COLLIDE2.diff"
Index: ode/src/collision_space.cpp
===================================================================
RCS file: /cvsroot/opende/ode/ode/src/collision_space.cpp,v
retrieving revision 1.4
diff -u -u -r1.4 collision_space.cpp
--- ode/src/collision_space.cpp 9 Dec 2002 01:12:02 -0000 1.4
+++ ode/src/collision_space.cpp 28 Jan 2003 18:35:47 -0000
@@ -620,8 +620,21 @@
void dxHashSpace::collide2 (void *data, dxGeom *geom,
dNearCallback *callback)
{
- //@@@
- dDebug (0,"dxHashSpace::collide2() not yet implemented");
+ dAASSERT (geom && callback);
+
+ // this could take advantage of the hash structure to avoid
+ // O(n^2) complexity, but it does not yet.
+
+ lock_count++;
+ cleanGeoms();
+ geom->recomputeAABB();
+
+ // intersect bounding boxes
+ for (dxGeom *g=first; g; g=g->next) {
+ collideAABBs (g,geom,data,callback);
+ }
+
+ lock_count--;
}
//****************************************************************************
--------------070005060701050407080302--