From: Matthias B. <mb...@us...> - 2006-04-13 13:20:22
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14485/src Modified Files: declarations.pyx ode.pyx Log Message: Added the collide2() function and fixed some more doc strings Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ode.pyx 20 Sep 2005 15:34:17 -0000 1.13 --- ode.pyx 13 Apr 2006 13:20:17 -0000 1.14 *************** *** 182,186 **** def collide(geom1, geom2): ! """Generate contact information for two objects. Given two geometry objects that potentially touch (geom1 and geom2), --- 182,188 ---- def collide(geom1, geom2): ! """collide(geom1, geom2) -> contacts ! ! Generate contact information for two objects. Given two geometry objects that potentially touch (geom1 and geom2), *************** *** 198,201 **** --- 200,209 ---- If the objects touch, this returns a list of Contact objects, otherwise it returns an empty list. + + @param geom1: First Geom + @type geom1: GeomObject + @param geom2: Second Geom + @type geom2: GeomObject + @returns: Returns a list of Contact objects. """ *************** *** 220,226 **** return res def areConnected(Body body1, Body body2): ! """Return True if the two bodies are connected together by a joint, ! otherwise return False. """ --- 228,270 ---- return res + def collide2(geom1, geom2, arg, callback): + """collide2(geom1, geom2, arg, callback) + + Calls the callback for all potentially intersecting pairs that contain + one geom from geom1 and one geom from geom2. + + @param geom1: First Geom + @type geom1: GeomObject + @param geom2: Second Geom + @type geom2: GeomObject + @param arg: A user argument that is passed to the callback function + @param callback: Callback function + @type callback: callable + """ + cdef void* data + cdef object tup + cdef long id1 + cdef long id2 + + id1 = geom1._id() + id2 = geom2._id() + + tup = (callback, arg) + data = <void*>tup + # collide_callback is defined in space.pyx + dSpaceCollide2(<dGeomID>id1, <dGeomID>id2, data, collide_callback) + + def areConnected(Body body1, Body body2): ! """areConnected(body1, body2) -> bool ! ! Return True if the two bodies are connected together by a joint, ! otherwise return False. ! ! @param body1: First body ! @type body1: Body ! @param body2: Second body ! @type body2: Body ! @returns: True if the bodies are connected """ Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** declarations.pyx 17 Jan 2006 09:07:54 -0000 1.14 --- declarations.pyx 13 Apr 2006 13:20:17 -0000 1.15 *************** *** 321,324 **** --- 321,325 ---- int dSpaceQuery (dSpaceID, dGeomID) void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback) + void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data, dNearCallback *callback) void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel) |