[ODE] Some patches
Kevin Reid
kpreid at attglobal.net
Tue Feb 25 08:52:01 2003
Various changes I've found useful and would like to see integrated into
standard ODE:
########## Tweaks to the build process for OSX:
--- config/makefile.osx 25 Dec 2001 06:22:48 -0000 1.1
+++ config/makefile.osx 25 Feb 2003 15:17:16 -0000
@@ -2,17 +2,17 @@
DEL_CMD=rm -f
CC=cc
OBJ=.o
-C_FLAGS=-c -Wall -fno-rtti -fno-exceptions -Wall
+C_FLAGS=-c -Wall -fno-rtti -fno-exceptions -Wall -I/usr/X11R6/include
C_INC=-I
C_OUT=-o
C_EXEOUT=-o
C_DEF=-D
C_OPT=-O
AR=ar rc
-RANLIB=
+RANLIB=ranlib
LIB_PREFIX=lib
LIB_SUFFIX=.a
-LINK_OPENGL=-L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib/X11R6 -L/usr/lib/X11 -lX11 -lGL -lGLU
+LINK_OPENGL=-L/usr/X11R6/lib -lX11 -lGL -lstdc++
LINK_MATH=-lm
ifeq ($(BUILD),release)
########## New function dGeomIsPlaceable and makes dGeomSetBody(non-placeable geom, NULL) allowed:
--- include/ode/collision.h 1 Dec 2002 07:01:14 -0000 1.3
+++ include/ode/collision.h 25 Feb 2003 15:17:16 -0000
@@ -45,6 +45,7 @@
const dReal * dGeomGetRotation (dGeomID);
void dGeomGetAABB (dGeomID, dReal aabb[6]);
int dGeomIsSpace (dGeomID);
+int dGeomIsPlaceable (dGeomID);
int dGeomGetClass (dGeomID);
void dGeomSetCategoryBits (dGeomID, unsigned long bits);
void dGeomSetCollideBits (dGeomID, unsigned long bits);
--- ode/src/collision_kernel.cpp 9 Dec 2002 01:27:29 -0000 1.7
+++ ode/src/collision_kernel.cpp 25 Feb 2003 15:49:47 -0000
@@ -285,10 +285,11 @@
void dGeomSetBody (dxGeom *g, dxBody *b)
{
dAASSERT (g);
- dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
CHECK_NOT_LOCKED (g->parent_space);
if (b) {
+ dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
+
if (!g->body) dFree (g->pos,sizeof(dxPosR));
g->pos = b->pos;
g->R = b->R;
@@ -384,6 +385,13 @@
{
dAASSERT (g);
return IS_SPACE(g);
+}
+
+
+int dGeomIsPlaceable (dxGeom *g)
+{
+ dAASSERT (g);
+ return g->gflags & GEOM_PLACEABLE;
}
########## Allow infinitely thin boxes:
--- ode/src/collision_std.cpp 1 Dec 2002 07:00:02 -0000 1.6
+++ ode/src/collision_std.cpp 25 Feb 2003 15:17:18 -0000
@@ -135,7 +135,7 @@
dxBox::dxBox (dSpaceID space, dReal lx, dReal ly, dReal lz) : dxGeom (space,1)
{
- dAASSERT (lx > 0 && ly > 0 && lz > 0);
+ dAASSERT (lx >= 0 && ly >= 0 && lz >= 0);
type = dBoxClass;
side[0] = lx;
side[1] = ly;
@@ -169,7 +169,7 @@
void dGeomBoxSetLengths (dGeomID g, dReal lx, dReal ly, dReal lz)
{
dUASSERT (g && g->type == dBoxClass,"argument not a box");
- dAASSERT (lx > 0 && ly > 0 && lz > 0);
+ dAASSERT (lx >= 0 && ly >= 0 && lz >= 0);
dxBox *b = (dxBox*) g;
b->side[0] = lx;
b->side[1] = ly;
########## Prevent data structures becoming inconsistent if dSpaceAdd() is called on a geom already in a space:
--- ode/src/space.cpp 10 Nov 2002 23:19:33 -0000 1.20
+++ ode/src/space.cpp 25 Feb 2003 15:49:48 -0000
@@ -603,6 +603,7 @@
void dSpaceAdd (dxSpace * space, dxGeom *g)
{
+ dUASSERT(!g->space, "geom is already in a space");
space->add (g);
}
--
Kevin Reid