[ODE] Geomgroups vs composite

Adam D. Moss aspirin at ntlworld.com
Mon Feb 10 07:33:01 2003


This is a multi-part message in MIME format.
--------------D7470E143263EC7BCB527B04
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

skjold@cistron.nl wrote:
> But if you spot any problems with it, please let me know.

Hi!

Here's a patch that fixes a few things relative to your
version of test_boxstack.cpp:

* avoids illegal dGeomGetPosition/Rotation on dPlaneClass[*] to avoid
  an ABORT in ODE debug builds
* removes a couple of unused variables
* avoids some deprecated scoping usage

Seems to work fine on Linux with these changes.

[*] This does seem to suggest that there should be a supported
way of asking whether a given geom type is placeable, rather than
'knowing' about the nonplaceable set ahead of time.  Russ?  I'd
be willing to submit an interface for this, it seems pretty trivial.

--Adam
-- 
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
busting makes me feel good
'"Wankbadger" failed to reach MPs.  "Wank-badger" succeeded.'
--------------D7470E143263EC7BCB527B04
Content-Type: text/plain; charset=us-ascii;
 name="SKJOLD.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="SKJOLD.diff"

--- test_boxstack.cpp.skjold.cpp	Mon Feb 10 13:57:31 2003
+++ test_boxstack.cpp	Mon Feb 10 14:24:55 2003
@@ -230,8 +230,6 @@
                     dMassSetBox (&masses[k],DENSITY,sides[0],sides[1],sides[2]);
                 } else {
                     sides[0] *= 0.5;
-                    dReal radius = dRandReal()*0.1+0.05;
-                    dReal length = dRandReal()*1.0+0.1;
                     geoms[k] = dCreateCCylinder (0,sides[0],sides[1]);
                     dMassSetCappedCylinder (&masses[k],DENSITY,3,sides[0],sides[1]);
                 }
@@ -266,14 +264,15 @@
   if(dGeomIsSpace(g)) {
     for (int i = 0; i < dSpaceGetNumGeoms((dSpaceID)g); i++) {
         //drawGeom (obj[i].geom[j],0,0,show_aabb);
-        drawGeom (dSpaceGetGeom((dSpaceID)g, i),0,0,show_aabb);
+      drawGeom (dSpaceGetGeom((dSpaceID)g, i),0,0,show_aabb);
     }
     if (show_aabb) {
       // draw the bounding box for this space
       dReal aabb[6];
       dGeomGetAABB (g,aabb);
       dVector3 bbpos;
-      for (int i=0; i<3; i++) bbpos[i] = 0.5*(aabb[i*2] + aabb[i*2+1]);
+      int i;
+      for (i=0; i<3; i++) bbpos[i] = 0.5*(aabb[i*2] + aabb[i*2+1]);
       dVector3 bbsides;
       for (i=0; i<3; i++) bbsides[i] = aabb[i*2+1] - aabb[i*2];
       dMatrix3 RI;
@@ -286,10 +285,12 @@
     return;
   }
 
-  if (!pos) pos = dGeomGetPosition (g);
-  if (!R) R = dGeomGetRotation (g);
-
   int type = dGeomGetClass (g);
+  if (type != dPlaneClass) {
+    if (!pos) pos = dGeomGetPosition (g);
+    if (!R) R = dGeomGetRotation (g);
+  }
+
   if (type == dBoxClass) {
     dVector3 sides;
     dGeomBoxGetLengths (g,sides);
@@ -322,7 +323,8 @@
     dReal aabb[6];
     dGeomGetAABB (g,aabb);
     dVector3 bbpos;
-    for (int i=0; i<3; i++) bbpos[i] = 0.5*(aabb[i*2] + aabb[i*2+1]);
+    int i;
+    for (i=0; i<3; i++) bbpos[i] = 0.5*(aabb[i*2] + aabb[i*2+1]);
     dVector3 bbsides;
     for (i=0; i<3; i++) bbsides[i] = aabb[i*2+1] - aabb[i*2];
     dMatrix3 RI;

--------------D7470E143263EC7BCB527B04--