You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(2) |
Feb
|
Mar
|
Apr
(49) |
May
(25) |
Jun
|
Jul
(13) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Rodrigo H. <kw...@us...> - 2005-07-11 17:04:59
|
Update of /cvsroot/freesolid/freesolid/sample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26559/sample Modified Files: Makefile.am Added Files: depth.cpp Log Message: Added depth sample --- NEW FILE: depth.cpp --- /* This sample is a test for the depth penetration computation */ #include <stdio.h> #include <fstream> #include <SOLID/solid.h> #include <assert.h> #include <3D/Point.h> #include <3D/Quaternion.h> #include <vector> #include "SDL.h" #include "SDL_opengl.h" void DrawSphere(float radius); void DrawBox(float width, float height, float depth); int main(int argc, char *argv[]); //---------------------- // Globals //---------------------- int sphere_id; int box_id; DtShapeRef sphere; DtShapeRef box; Quaternion camquat,qtemp; float camrot[3]={0.0f,0.0f,0.0f}; float spherepos[3]={0.0f,0.0f,10.0f}; GLUquadricObj *sphereqobj; float matrix[16]; Vector depth_penetration; void CollideCallback(void * client_data, DtObjectRef obj1, DtObjectRef obj2, const DtCollData *coll_data) { if(coll_data!=NULL) { // fprintf(stdout,"Collided Point 1 %f,%f,%f\nPoint 2 %f,%f,%f\nNormal %f,%f,%f\n", // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], // coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); depth_penetration[X]=coll_data->normal[X]; depth_penetration[Y]=coll_data->normal[Y]; depth_penetration[Z]=coll_data->normal[Z]; // spherepos[0]+=depth_penetration[X]; // spherepos[1]+=depth_penetration[Y]; // spherepos[2]+=depth_penetration[Z]; } } int main(int argc, char *argv[]) { sphere_id=1; box_id=2; //box = dtSphere(10.0f); box = dtBox(10.0f,10.0f,10.0f); sphere = dtSphere(10.0f); dtCreateObject(&box_id, box); dtCreateObject(&sphere_id, sphere); //dtDisableCaching(); dtSetDefaultResponse(CollideCallback, DT_SMART_RESPONSE, stdout); bool bRunning = true; SDL_Event event; if(SDL_Init(SDL_INIT_VIDEO)<0) // try to initialize Video System { fprintf( stderr, "Video initialization failed: %s\n",SDL_GetError()); // if it failed, find out why return -1; } SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,1); if(SDL_SetVideoMode(800,600,0,SDL_OPENGL) == 0 ) { fprintf(stderr, "Video mode set failed: %s\n",SDL_GetError()); SDL_Quit(); return -1; } glViewport(0,0,800,600); // set the view port to take the whole screen glMatrixMode(GL_PROJECTION); // switch to the Projection Matrix glLoadIdentity(); // reset Projection Matrix gluPerspective(45.0f,800.0f/600.0f, 0.1f ,1000.0f); // set our view to perspective glMatrixMode(GL_MODELVIEW); // switch to the Model View Matrix glLoadIdentity(); // reset Model View Matrix glClearColor(0.0f,0.0f,0.0f,0.0f); // Set our Clear Color to Black glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearDepth(1.0f); // Set the depth buffer glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // Type of depth test glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Use really nice perspective calculations glPolygonMode(GL_FRONT, GL_LINE); sphereqobj = gluNewQuadric(); dtDisableCaching(); while(bRunning) { if(SDL_PollEvent(&event)) { switch(event.type) { case SDL_MOUSEMOTION: if(event.motion.state & SDL_BUTTON(1)) { camrot[1] += event.motion.xrel; camrot[0] += event.motion.yrel; //camrot[2] += event.motion.v[X]rel; } break; case SDL_QUIT: // test to see if the user closed the app bRunning = false; break; case SDL_KEYDOWN: /* Handle a KEYDOWN event */ switch(event.key.keysym.sym) { case SDLK_ESCAPE: bRunning = false; // quit if ESCAPE is pressed break; case SDLK_w: spherepos[Y]+=0.5; break; case SDLK_a: spherepos[X]+=0.5; break; case SDLK_s: spherepos[Y]-=0.5; break; case SDLK_d: spherepos[X]-=0.5; break; } break; } } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(0.0f,-100.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,1.0f); glRotatef(camrot[0],1.0f,0.0f,0.0f); glRotatef(camrot[1],0.0f,1.0f,0.0f); glRotatef(camrot[2],0.0f,0.0f,1.0f); glPushMatrix(); dtSelectObject(&sphere_id); dtLoadIdentity(); dtTranslate(spherepos[0],spherepos[1],spherepos[2]); glTranslatef(spherepos[0],spherepos[1],spherepos[2]); DrawSphere(10.0f); glPopMatrix(); glPushMatrix(); DrawBox(10.0f,10.0f,10.0f); //DrawSphere(10.0f); glPopMatrix(); glDisable(GL_DEPTH_TEST); glColor3ub(0,0,255); dtTest(); glBegin(GL_LINES); { glVertex3f(spherepos[0],spherepos[1],spherepos[2]); glVertex3f(spherepos[0]+depth_penetration[X], spherepos[1]+depth_penetration[Y], spherepos[2]+depth_penetration[Z]); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(depth_penetration[X], depth_penetration[Y], depth_penetration[Z]); } glEnd(); glEnable(GL_DEPTH_TEST); SDL_GL_SwapBuffers(); } gluDeleteQuadric(sphereqobj); dtDeleteObject(&box_id); dtDeleteObject(&sphere_id); return 0; } void DrawBox(float width, float height, float depth) { glColor3ub(255,0,0); float wdiv2=width/2; float hdiv2=height/2; float ddiv2=depth/2; //glDisable(GL_TEXTURE_2D); glPushMatrix(); glBegin(GL_LINES); { glVertex3f(wdiv2,hdiv2,ddiv2); glVertex3f(-wdiv2,hdiv2,ddiv2); glVertex3f(-wdiv2,-hdiv2,ddiv2); glVertex3f(wdiv2,-hdiv2,ddiv2); glVertex3f(wdiv2,hdiv2,ddiv2); glVertex3f(wdiv2,-hdiv2,ddiv2); glVertex3f(-wdiv2,-hdiv2,ddiv2); glVertex3f(-wdiv2,hdiv2,ddiv2); glVertex3f(wdiv2,hdiv2,-ddiv2); glVertex3f(-wdiv2,hdiv2,-ddiv2); glVertex3f(-wdiv2,-hdiv2,-ddiv2); glVertex3f(wdiv2,-hdiv2,-ddiv2); glVertex3f(wdiv2,hdiv2,-ddiv2); glVertex3f(wdiv2,-hdiv2,-ddiv2); glVertex3f(-wdiv2,-hdiv2,-ddiv2); glVertex3f(-wdiv2,hdiv2,-ddiv2); glVertex3f(-wdiv2,-hdiv2,ddiv2); glVertex3f(-wdiv2,-hdiv2,-ddiv2); glVertex3f(wdiv2,-hdiv2,ddiv2); glVertex3f(wdiv2,-hdiv2,-ddiv2); glVertex3f(wdiv2,hdiv2,-ddiv2); glVertex3f(wdiv2,hdiv2,ddiv2); glVertex3f(-wdiv2,hdiv2,ddiv2); glVertex3f(-wdiv2,hdiv2,-ddiv2); } glEnd(); glPopMatrix(); //glEnable(GL_TEXTURE_2D); } void DrawSphere(float radius) { glPolygonMode(GL_FRONT, GL_LINE); glPolygonMode(GL_BACK, GL_LINE); glColor3ub(255,128,255); gluSphere(sphereqobj, radius, 8, 4); } Index: Makefile.am =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile.am 10 Jul 2005 23:26:40 -0000 1.11 --- Makefile.am 11 Jul 2005 17:04:50 -0000 1.12 *************** *** 1,5 **** # Bypass extra crappy libtool linking ! all: sample x_wing teapot torus ellipsoid walk sample.o: sample.cpp --- 1,5 ---- # Bypass extra crappy libtool linking ! all: sample x_wing teapot torus ellipsoid walk depth sample.o: sample.cpp |
From: Rodrigo H. <kw...@us...> - 2005-07-10 23:26:49
|
Update of /cvsroot/freesolid/freesolid/sample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31211/sample Modified Files: Makefile.am walk.cpp Log Message: Depth penetration computation done, needs more tests. Index: Makefile.am =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile.am 8 Jul 2005 23:27:49 -0000 1.10 --- Makefile.am 10 Jul 2005 23:26:40 -0000 1.11 *************** *** 1,5 **** # Bypass extra crappy libtool linking ! all: sample x_wing teapot torus ellipsoid walk depth sample.o: sample.cpp --- 1,5 ---- # Bypass extra crappy libtool linking ! all: sample x_wing teapot torus ellipsoid walk sample.o: sample.cpp Index: walk.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/walk.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** walk.cpp 8 Jul 2005 23:27:49 -0000 1.6 --- walk.cpp 10 Jul 2005 23:26:40 -0000 1.7 *************** *** 45,63 **** void DrawWorld(); void DrawEllipsoid(float xradius, float yradius, float zradius); void Step(float step); int main(int argc, char *argv[]); - void CollideCallback(void * client_data, DtObjectRef obj1, DtObjectRef obj2, - const DtCollData *coll_data) - { - if(coll_data!=NULL) - { - // fprintf(stdout,"Collided Point 1 %f,%f,%f\nPoint 2 %f,%f,%f\nNormal %f,%f,%f\n", - // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], - // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], - // coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); - } - } --- 45,53 ---- void DrawWorld(); void DrawEllipsoid(float xradius, float yradius, float zradius); + void DrawBox(float width, float height, float depth); void Step(float step); int main(int argc, char *argv[]); *************** *** 77,80 **** --- 67,87 ---- const float gravity = -9.8f; const float stepsize = 0.016; + float boxsize[3]={20.0f,20.0f,5.0f}; + + void CollideCallback(void * client_data, DtObjectRef obj1, DtObjectRef obj2, + const DtCollData *coll_data) + { + if(coll_data!=NULL) + { + // fprintf(stdout,"Collided Point 1 %f,%f,%f\nPoint 2 %f,%f,%f\nNormal %f,%f,%f\n", + // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], + // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], + // coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); + + player.pos[X]-=coll_data->normal[X]; + player.pos[Y]-=coll_data->normal[Y]; + player.pos[Z]-=coll_data->normal[Z]; + } + } int main(int argc, char *argv[]) *************** *** 92,96 **** ellipsoid = dtEllipsoid(player.radii[0],player.radii[1],player.radii[2]); //ellipsoid = dtSphere(player.radii[2]); ! box = dtBox(player.radii[0],player.radii[1],player.radii[2]); dtCreateObject(&player, ellipsoid); dtCreateObject(&object2, world); --- 99,103 ---- ellipsoid = dtEllipsoid(player.radii[0],player.radii[1],player.radii[2]); //ellipsoid = dtSphere(player.radii[2]); ! box = dtBox(boxsize[0],boxsize[1],boxsize[2]); dtCreateObject(&player, ellipsoid); dtCreateObject(&object2, world); *************** *** 142,146 **** dtSelectObject(&object3); dtLoadIdentity(); - //dtTranslate(player.pos[X],player.pos[Y],player.pos[Z]); while(bRunning) { --- 149,152 ---- *************** *** 169,172 **** --- 175,179 ---- DrawEllipsoid(player.radii[X],player.radii[Y],player.radii[Z]); glPopMatrix(); + DrawBox(boxsize[0],boxsize[1],boxsize[2]); SDL_GL_SwapBuffers(); } *************** *** 246,250 **** --- 253,304 ---- gluSphere(sphereqobj, 1.0, 30, 30); } + void DrawBox(float width, float height, float depth) + { + float wdiv2=width/2; + float hdiv2=height/2; + float ddiv2=depth/2; + glPushMatrix(); + glBegin(GL_LINES); + { + glVertex3f(wdiv2,hdiv2,ddiv2); + glVertex3f(-wdiv2,hdiv2,ddiv2); + + glVertex3f(-wdiv2,-hdiv2,ddiv2); + glVertex3f(wdiv2,-hdiv2,ddiv2); + + glVertex3f(wdiv2,hdiv2,ddiv2); + glVertex3f(wdiv2,-hdiv2,ddiv2); + + glVertex3f(-wdiv2,-hdiv2,ddiv2); + glVertex3f(-wdiv2,hdiv2,ddiv2); + + glVertex3f(wdiv2,hdiv2,-ddiv2); + glVertex3f(-wdiv2,hdiv2,-ddiv2); + + glVertex3f(-wdiv2,-hdiv2,-ddiv2); + glVertex3f(wdiv2,-hdiv2,-ddiv2); + + glVertex3f(wdiv2,hdiv2,-ddiv2); + glVertex3f(wdiv2,-hdiv2,-ddiv2); + + glVertex3f(-wdiv2,-hdiv2,-ddiv2); + glVertex3f(-wdiv2,hdiv2,-ddiv2); + + glVertex3f(-wdiv2,-hdiv2,ddiv2); + glVertex3f(-wdiv2,-hdiv2,-ddiv2); + + glVertex3f(wdiv2,-hdiv2,ddiv2); + glVertex3f(wdiv2,-hdiv2,-ddiv2); + glVertex3f(wdiv2,hdiv2,-ddiv2); + glVertex3f(wdiv2,hdiv2,ddiv2); + + glVertex3f(-wdiv2,hdiv2,ddiv2); + glVertex3f(-wdiv2,hdiv2,-ddiv2); + } + glEnd(); + glPopMatrix(); + + } void DrawWorld() { |
From: Rodrigo H. <kw...@us...> - 2005-07-10 23:26:48
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31211/libsolid Modified Files: Convex.cpp Log Message: Depth penetration computation done, needs more tests. Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Convex.cpp 8 Jul 2005 23:27:49 -0000 1.9 --- Convex.cpp 10 Jul 2005 23:26:39 -0000 1.10 *************** *** 399,403 **** int curlong, totlong, exitcode; char options[200]; ! facetT *facet; vertexT *vertex; --- 399,403 ---- int curlong, totlong, exitcode; char options[200]; ! vector<Vector> new_polyhedron; facetT *facet; vertexT *vertex; *************** *** 407,493 **** Vector close_test; Vector w; int triangle_index[3]; Vector triangle[3]; ! int iterations=0; // LOOP Starts Here, testing with 100 iterations: ! for(int j=0;j<100;++j) ! { ! size_t numVerts = inflated_polyhedron.size(); ! ! coordT *array = new coordT[numVerts*3]; ! coordT *p = &array[0]; ! int i; ! for (i = 0; i < numVerts; ++i) { ! *p++ = inflated_polyhedron[i][X]; ! *p++ = inflated_polyhedron[i][Y]; ! *p++ = inflated_polyhedron[i][Z]; ! } ! ! ismalloc = False; // True if qh_freeqhull should 'free(array)' ! qh_init_A(stdin, stdout, stderr, 0, NULL); ! if (exitcode = setjmp(qh errexit)) exit(exitcode); ! sprintf(options, "qhull Qx i s Tcv C-0"); ! qh_initflags(options); ! qh_init_B(&array[0], numVerts, 3, ismalloc); ! qh_qhull(); ! qh_check_output(); ! ! FORALLfacets ! { ! Scalar distance=FLT_MAX; ! setT *vertices = qh_facet3vertex(facet); ! i=0; ! FOREACHvertex_(vertices) { ! triangle_index[i]=qh_pointid(vertex->point); ! ++i; } ! closest_point_in_triangle(origin, ! inflated_polyhedron[triangle_index[0]], ! inflated_polyhedron[triangle_index[1]], ! inflated_polyhedron[triangle_index[2]], ! close_test); ! if(close_test.length2()<distance) { ! triangle[0]=inflated_polyhedron[triangle_index[0]]; ! triangle[1]=inflated_polyhedron[triangle_index[1]]; ! triangle[2]=inflated_polyhedron[triangle_index[2]]; ! distance=close_test.length2(); ! closest=close_test; ! } ! } ! ! // Split triangle, add points to the convex hull ! /* ! Removing points NOT in the convex hull here from inflated_polyhedron ! would probably be a good idea. ! */ ! w = a2w(a.support((-closest) * a2w.getBasis())) - ! b2w(b.support(closest * b2w.getBasis())); ! // distance = dot((w-inflated_polyhedron[inflated_polyhedron.size()-1]), ! // (w-inflated_polyhedron[inflated_polyhedron.size()-1])); ! inflated_polyhedron.push_back(w); ! ! for(i=0;i<3;++i) ! { ! // Use closest point in line to find new w ! closest_point_in_line(origin,triangle[i],triangle[(i+1)%3],closest); w = a2w(a.support((-closest) * a2w.getBasis())) - ! b2w(b.support(closest * b2w.getBasis())); ! if(dot(w,closest)!=dot(closest,closest)) { ! // distance = dot((w-inflated_polyhedron[inflated_polyhedron.size()-1]), ! // (w-inflated_polyhedron[inflated_polyhedron.size()-1])) ! inflated_polyhedron.push_back(w); } ! } ! delete [] array; ! qh NOerrexit = True; ! qh_freeqhull(!qh_ALL); ! qh_memfreeshort(&curlong, &totlong); } - v=w; #else #warning "Determination of minimum penetration depth without QHULL has not been implemented" --- 407,500 ---- Vector close_test; Vector w; + Vector last; int triangle_index[3]; Vector triangle[3]; ! int iterations=0,vertcount; // LOOP Starts Here, testing with 100 iterations: ! //for(int j=0;j<100;++j) ! while(1) { ! size_t numVerts = inflated_polyhedron.size(); ! coordT *array = new coordT[numVerts*3]; ! coordT *p = &array[0]; ! int i; ! for (i = 0; i < numVerts; ++i) { ! *p++ = inflated_polyhedron[i][X]; ! *p++ = inflated_polyhedron[i][Y]; ! *p++ = inflated_polyhedron[i][Z]; } ! ! ismalloc = False; // True if qh_freeqhull should 'free(array)' ! qh_init_A(stdin, stdout, stderr, 0, NULL); ! if (exitcode = setjmp(qh errexit)) exit(exitcode); ! sprintf(options, "qhull Qx i s Tcv C-0"); ! qh_initflags(options); ! qh_init_B(&array[0], numVerts, 3, ismalloc); ! qh_qhull(); ! qh_check_output(); ! vertcount=0; ! ! Scalar distance=FLT_MAX; ! ! FORALLfacets ! { ! setT *vertices = qh_facet3vertex(facet); ! i=0; ! ! FOREACHvertex_(vertices) ! { ! triangle_index[i]=qh_pointid(vertex->point); ! ++i; ! } ! closest_point_in_triangle(origin, ! inflated_polyhedron[triangle_index[0]], ! inflated_polyhedron[triangle_index[1]], ! inflated_polyhedron[triangle_index[2]], ! close_test); ! if(close_test.length2()<distance) ! { ! triangle[0]=inflated_polyhedron[triangle_index[0]]; ! triangle[1]=inflated_polyhedron[triangle_index[1]]; ! triangle[2]=inflated_polyhedron[triangle_index[2]]; ! distance=close_test.length2(); ! closest=close_test; ! } ! } ! // Split triangle, add points to the convex hull ! FORALLvertices { ! vertcount++; ! new_polyhedron.push_back(inflated_polyhedron[qh_pointid(vertex->point)]); ! } ! inflated_polyhedron.swap(new_polyhedron); ! new_polyhedron.clear(); w = a2w(a.support((-closest) * a2w.getBasis())) - ! b2w(b.support(closest * b2w.getBasis())); ! if(w==last) { ! v=w; ! return; } ! last=w; ! inflated_polyhedron.push_back(w); ! ! for(i=0;i<3;++i) ! { ! closest_point_in_line(origin,triangle[i],triangle[(i+1)%3],closest); ! w = a2w(a.support((-closest) * a2w.getBasis())) - ! b2w(b.support(closest * b2w.getBasis())); ! if(dot(w,closest)!=dot(closest,closest)) ! { ! inflated_polyhedron.push_back(w); ! } ! } ! delete [] array; ! qh NOerrexit = True; ! qh_freeqhull(!qh_ALL); ! qh_memfreeshort(&curlong, &totlong); ! iterations++; } #else #warning "Determination of minimum penetration depth without QHULL has not been implemented" |
From: Rodrigo H. <kw...@us...> - 2005-07-08 23:27:57
|
Update of /cvsroot/freesolid/freesolid/sample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5632/sample Modified Files: Makefile.am walk.cpp Log Message: Added depth penetration test app, more stuff on depth penetration computation Index: Makefile.am =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile.am 9 May 2005 23:18:42 -0000 1.9 --- Makefile.am 8 Jul 2005 23:27:49 -0000 1.10 *************** *** 1,5 **** # Bypass extra crappy libtool linking ! all: sample x_wing teapot torus ellipsoid walk sample.o: sample.cpp --- 1,5 ---- # Bypass extra crappy libtool linking ! all: sample x_wing teapot torus ellipsoid walk depth sample.o: sample.cpp *************** *** 15,18 **** --- 15,20 ---- walk.o: walk.cpp $(CXX) $(AM_CXXFLAGS) -I@TOPDIR@/include @SDL_CFLAGS@ -c $< -o $@ + depth.o: depth.cpp + $(CXX) $(AM_CXXFLAGS) -I@TOPDIR@/include @SDL_CFLAGS@ -c $< -o $@ sample: sample.o *************** *** 35,38 **** --- 37,43 ---- $(CXX) $(AM_CXXFLAGS) $< -o $@ \ -L@TOPDIR@/libsolid/.libs/ -lFreeSOLID $(AM_LDFLAGS) @SDL_LIBS@ @GL_LIBS@ + depth: depth.o + $(CXX) $(AM_CXXFLAGS) $< -o $@ \ + -L@TOPDIR@/libsolid/.libs/ -lFreeSOLID $(AM_LDFLAGS) @SDL_LIBS@ @GL_LIBS@ clean: rm -rf *.o *************** *** 49,52 **** --- 54,59 ---- rm -rf walk rm -rf walk.exe + rm -rf depth + rm -rf depth.exe EXTRA_DIST = sample.cpp \ Index: walk.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/walk.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** walk.cpp 7 Jul 2005 23:19:54 -0000 1.5 --- walk.cpp 8 Jul 2005 23:27:49 -0000 1.6 *************** *** 143,147 **** dtLoadIdentity(); //dtTranslate(player.pos[X],player.pos[Y],player.pos[Z]); - while(bRunning) { --- 143,146 ---- |
From: Rodrigo H. <kw...@us...> - 2005-07-08 23:27:57
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5632/libsolid Modified Files: C-api.cpp Convex.cpp Object.cpp Log Message: Added depth penetration test app, more stuff on depth penetration computation Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Object.cpp 6 Jul 2005 23:40:57 -0000 1.9 --- Object.cpp 8 Jul 2005 23:27:49 -0000 1.10 *************** *** 114,119 **** { static IntersectTable *intersectTable = intersectInitialize(); ! Intersect i = intersectTable->lookup(a.shapePtr->getType(),b.shapePtr->getType()); ! return i(*a.shapePtr,*b.shapePtr,a.curr,b.curr,v); } --- 114,123 ---- { static IntersectTable *intersectTable = intersectInitialize(); ! Intersect i = intersectTable->lookup(a.shapePtr->getType(), ! b.shapePtr->getType()); ! return i(*a.shapePtr, ! *b.shapePtr, ! a.curr, ! b.curr,v); } *************** *** 215,218 **** --- 219,223 ---- (const Convex&)*b.shapePtr, a.prev, b.prev, pa, pb); + //fprintf(stdout,"V: %f,%f,%f\n",v[X],v[Y],v[Z]); } return true; Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** C-api.cpp 7 Jul 2005 23:19:54 -0000 1.12 --- C-api.cpp 8 Jul 2005 23:27:49 -0000 1.13 *************** *** 361,377 **** break; case DT_SMART_RESPONSE: - //fprintf(stdout,"object_test DT_SMART_RESPONSE\n"); if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) { ! // fprintf(stdout,"prev_closest_points returned true\n"); ! // fprintf(stdout,"Previous Points:\n%f,%f,%f\n%f,%f,%f\n", ! // e.obj1->prev(p1)[X],e.obj1->prev(p1)[Y],e.obj1->prev(p1)[Z], ! // e.obj2->prev(p2)[X],e.obj2->prev(p2)[Y],e.obj1->prev(p2)[Z]); ! Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); ! resp(e.obj1->ref, e.obj2->ref, p1, p2, v); ! // Added these to see if there is any difference, ! // and there is, but not quite what was expected, or is it?. ! //((Object *)e.obj1)->proceed(); ! //((Object *)e.obj2)->proceed(); return true; } --- 361,369 ---- break; case DT_SMART_RESPONSE: if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) { ! // Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); ! // resp(e.obj1->ref, e.obj2->ref, p1, p2, v); ! resp(e.obj1->ref, e.obj2->ref, p1, p2, e.sep_axis); return true; } Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Convex.cpp 7 Jul 2005 23:19:54 -0000 1.8 --- Convex.cpp 8 Jul 2005 23:27:49 -0000 1.9 *************** *** 407,412 **** Vector close_test; Vector w; - boolT isoutside; - realT bestdist; int triangle_index[3]; Vector triangle[3]; --- 407,410 ---- *************** *** 436,443 **** qh_check_output(); - Scalar distance=FLT_MAX; FORALLfacets { setT *vertices = qh_facet3vertex(facet); i=0; --- 434,441 ---- qh_check_output(); FORALLfacets { + Scalar distance=FLT_MAX; setT *vertices = qh_facet3vertex(facet); i=0; *************** *** 469,472 **** --- 467,472 ---- w = a2w(a.support((-closest) * a2w.getBasis())) - b2w(b.support(closest * b2w.getBasis())); + // distance = dot((w-inflated_polyhedron[inflated_polyhedron.size()-1]), + // (w-inflated_polyhedron[inflated_polyhedron.size()-1])); inflated_polyhedron.push_back(w); *************** *** 479,486 **** if(dot(w,closest)!=dot(closest,closest)) { inflated_polyhedron.push_back(w); } ! } ! delete [] array; qh NOerrexit = True; --- 479,487 ---- if(dot(w,closest)!=dot(closest,closest)) { + // distance = dot((w-inflated_polyhedron[inflated_polyhedron.size()-1]), + // (w-inflated_polyhedron[inflated_polyhedron.size()-1])) inflated_polyhedron.push_back(w); } ! } delete [] array; qh NOerrexit = True; *************** *** 488,494 **** qh_memfreeshort(&curlong, &totlong); } ! v=w; ! fprintf(stdout,"Last V %f,%f,%f\n",v[X],v[Y],v[Z]); ! #else #warning "Determination of minimum penetration depth without QHULL has not been implemented" --- 489,493 ---- qh_memfreeshort(&curlong, &totlong); } ! v=w; #else #warning "Determination of minimum penetration depth without QHULL has not been implemented" *************** *** 551,554 **** --- 550,554 ---- } while (bits < 15 && !approxZero(v)); + switch(last) { |
From: Rodrigo H. <kw...@us...> - 2005-07-08 23:27:57
|
Update of /cvsroot/freesolid/freesolid/include/3D In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5632/include/3D Modified Files: Quaternion.h Log Message: Added depth penetration test app, more stuff on depth penetration computation Index: Quaternion.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/include/3D/Quaternion.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Quaternion.h 21 Apr 2005 23:20:54 -0000 1.3 --- Quaternion.h 8 Jul 2005 23:27:48 -0000 1.4 *************** *** 63,66 **** --- 63,68 ---- } + inline void getMatrix(float *pMatrix) const; + Quaternion& operator+=(const Quaternion& q); Quaternion& operator-=(const Quaternion& q); *************** *** 210,213 **** --- 212,242 ---- } + inline void Quaternion::getMatrix(float *pMatrix) const + { + if(!pMatrix) return; + pMatrix[ 0] = 1.0f - 2.0f * ( comp[Y] * comp[Y] + comp[Z] * comp[Z] ); + pMatrix[ 1] = 2.0f * (comp[X] * comp[Y] + comp[Z] * comp[W]); + pMatrix[ 2] = 2.0f * (comp[X] * comp[Z] - comp[Y] * comp[W]); + pMatrix[ 3] = 0.0f; + + // Second row + pMatrix[ 4] = 2.0f * ( comp[X] * comp[Y] - comp[Z] * comp[W] ); + pMatrix[ 5] = 1.0f - 2.0f * ( comp[X] * comp[X] + comp[Z] * comp[Z] ); + pMatrix[ 6] = 2.0f * (comp[Z] * comp[Y] + comp[X] * comp[W] ); + pMatrix[ 7] = 0.0f; + + // Third row + pMatrix[ 8] = 2.0f * ( comp[X] * comp[Z] + comp[Y] * comp[W] ); + pMatrix[ 9] = 2.0f * ( comp[Y] * comp[Z] - comp[X] * comp[W] ); + pMatrix[10] = 1.0f - 2.0f * ( comp[X] * comp[X] + comp[Y] * comp[Y] ); + pMatrix[11] = 0.0f; + + // Fourth row + pMatrix[12] = 0; + pMatrix[13] = 0; + pMatrix[14] = 0; + pMatrix[15] = 1.0f; + } + #endif |
From: Rodrigo H. <kw...@us...> - 2005-07-07 23:20:10
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5045/libsolid Modified Files: C-api.cpp Convex.cpp Polyhedron.cpp Log Message: more penetration depth code Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** C-api.cpp 6 Jul 2005 23:40:57 -0000 1.11 --- C-api.cpp 7 Jul 2005 23:19:54 -0000 1.12 *************** *** 361,371 **** break; case DT_SMART_RESPONSE: ! fprintf(stdout,"object_test DT_SMART_RESPONSE\n"); if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) { ! fprintf(stdout,"prev_closest_points returned true\n"); ! fprintf(stdout,"Previous Points:\n%f,%f,%f\n%f,%f,%f\n", ! e.obj1->prev(p1)[X],e.obj1->prev(p1)[Y],e.obj1->prev(p1)[Z], ! e.obj2->prev(p2)[X],e.obj2->prev(p2)[Y],e.obj1->prev(p2)[Z]); Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); resp(e.obj1->ref, e.obj2->ref, p1, p2, v); --- 361,371 ---- break; case DT_SMART_RESPONSE: ! //fprintf(stdout,"object_test DT_SMART_RESPONSE\n"); if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) { ! // fprintf(stdout,"prev_closest_points returned true\n"); ! // fprintf(stdout,"Previous Points:\n%f,%f,%f\n%f,%f,%f\n", ! // e.obj1->prev(p1)[X],e.obj1->prev(p1)[Y],e.obj1->prev(p1)[Z], ! // e.obj2->prev(p2)[X],e.obj2->prev(p2)[Y],e.obj1->prev(p2)[Z]); Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); resp(e.obj1->ref, e.obj2->ref, p1, p2, v); Index: Polyhedron.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Polyhedron.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Polyhedron.cpp 21 Apr 2005 23:20:55 -0000 1.5 --- Polyhedron.cpp 7 Jul 2005 23:19:54 -0000 1.6 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 43,47 **** Polyhedron::Polyhedron(const VertexBase& b, int c, const unsigned int v[]) : ! Polytope(b, c, v), cobound(0) { boolT ismalloc; int curlong, totlong, exitcode; --- 43,48 ---- Polyhedron::Polyhedron(const VertexBase& b, int c, const unsigned int v[]) : ! Polytope(b, c, v), cobound(0) ! { boolT ismalloc; int curlong, totlong, exitcode; *************** *** 55,65 **** coordT *p = &array[0]; int i; ! for (i = 0; i < numVerts(); ++i) { ! *p++ = (*this)[i][X]; ! *p++ = (*this)[i][Y]; ! *p++ = (*this)[i][Z]; ! } ! ismalloc = False; // True if qh_freeqhull should 'free(array)' qh_init_A(stdin, stdout, stderr, 0, NULL); if (exitcode = setjmp(qh errexit)) exit(exitcode); --- 56,67 ---- coordT *p = &array[0]; int i; ! for (i = 0; i < numVerts(); ++i) ! { ! *p++ = (*this)[i][X]; ! *p++ = (*this)[i][Y]; ! *p++ = (*this)[i][Z]; ! } ! ismalloc = False; // True if qh_freeqhull should 'free(array)' qh_init_A(stdin, stdout, stderr, 0, NULL); if (exitcode = setjmp(qh errexit)) exit(exitcode); *************** *** 72,86 **** IndexBuf* indexBuf = new IndexBuf[numVerts()]; IndexBuf facetIndices; ! FORALLfacets { ! setT *vertices = qh_facet3vertex(facet); ! FOREACHvertex_(vertices) facetIndices.push_back(qh_pointid(vertex->point)); ! size_t facetIndiceCount = facetIndices.size(); ! for (size_t i = 0, j = facetIndiceCount-1; ! i < facetIndiceCount; j = i++) { ! indexBuf[facetIndices[j]].push_back(facetIndices[i]); } ! facetIndices.erase(facetIndices.begin(), facetIndices.end()); ! } cobound = new IndexArray[numVerts()]; --- 74,90 ---- IndexBuf* indexBuf = new IndexBuf[numVerts()]; IndexBuf facetIndices; ! FORALLfacets ! { ! setT *vertices = qh_facet3vertex(facet); ! FOREACHvertex_(vertices) ! facetIndices.push_back(qh_pointid(vertex->point)); ! size_t facetIndiceCount = facetIndices.size(); ! for (size_t i = 0, j = facetIndiceCount-1; ! i < facetIndiceCount; j = i++) { ! indexBuf[facetIndices[j]].push_back(facetIndices[i]); } ! facetIndices.erase(facetIndices.begin(), facetIndices.end()); ! } cobound = new IndexArray[numVerts()]; *************** *** 91,98 **** curr_vertex = 0; while (indexBuf[curr_vertex].size() == 0) ++curr_vertex; ! delete [] indexBuf; delete [] array; ! qh NOerrexit = True; qh_freeqhull(!qh_ALL); --- 95,102 ---- curr_vertex = 0; while (indexBuf[curr_vertex].size() == 0) ++curr_vertex; ! delete [] indexBuf; delete [] array; ! qh NOerrexit = True; qh_freeqhull(!qh_ALL); *************** *** 100,104 **** } ! Polyhedron::~Polyhedron() { delete [] cobound; } --- 104,109 ---- } ! Polyhedron::~Polyhedron() ! { delete [] cobound; } *************** *** 128,137 **** Polyhedron::~Polyhedron() {} ! Point Polyhedron::support(const Vector& v) const { int c = 0; Scalar h = dot((*this)[0], v), d; ! for (int i = 1; i < numVerts(); ++i) { ! if ((d = dot((*this)[i], v)) > h) { c = i; h = d; } ! } return (*this)[c]; } --- 133,144 ---- Polyhedron::~Polyhedron() {} ! Point Polyhedron::support(const Vector& v) const ! { int c = 0; Scalar h = dot((*this)[0], v), d; ! for (int i = 1; i < numVerts(); ++i) ! { ! if ((d = dot((*this)[i], v)) > h) { c = i; h = d; } ! } return (*this)[c]; } Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Convex.cpp 6 Jul 2005 23:40:57 -0000 1.7 --- Convex.cpp 7 Jul 2005 23:19:54 -0000 1.8 *************** *** 24,27 **** --- 24,39 ---- P.O. Box 513, 5600 MB Eindhoven, The Netherlands */ + + #ifdef HAVE_CONFIG_H + #include <config.h> + #endif + + #ifdef USE_QHULL + extern "C" + { + #include "qhull_a.h" + } + #endif + #include <vector> #include "Convex.h" *************** *** 239,242 **** --- 251,499 ---- } + + void closest_point_in_triangle(const Vector& p, + const Vector& a, + const Vector& b, + const Vector& c, + Vector& out) + { + // Check if P in vertex region outside A + Vector ab = b - a; + Vector ac = b - a; + Vector ap = p - a; + float d1 = dot(ab,ap); + float d2 = dot(ac,ap); + if (d1 <= 0.0f && d2 <= 0.0f) + { + out = a; // barycentric coordinates (1,0,0) + //fprintf(stdout,"1\n"); + return; + } + + // Check if P in vertex region outside B + Vector bp = p - b; + float d3 = dot(ab,bp); + float d4 = dot(ac,bp); + if (d3 >= 0.0f && d4 <= d3) + { + out = b; + return; // barycentric coordinates (0,1,0) + } + + // Check if P in edge region of AB, if so return projection of P onto AB + float vc = (d1*d4) - (d3*d2); + if (vc <= 0.0f && d1 >= 0.0f && d3 <= 0.0f) + { + float v = d1 / (d1 - d3); + out = a + (ab*v); // barycentric coordinates (1-v,v,0) + return; + } + + // Check if P in vertex region outside C + Vector cp = p - b; + float d5 = dot(ab,cp); + float d6 = dot(ac,cp); + if (d6 >= 0.0f && d5 <= d6) + { + out=b; + return; // barycentric coordinates (0,0,1) + } + + // Check if P in edge region of AC, if so return projection of P onto AC + float vb = (d5*d2) - (d1*d6); + if (vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f) + { + float w = d2 / (d2 - d6); + out = a + (ac*w); // barycentric coordinates (1-w,0,w) + return; + } + + // Check if P in edge region of BC, if so return projection of P onto BC + float va = (d3*d6) - (d5*d4); + if (va <= 0.0f && (d4 - d3) >= 0.0f && (d5 - d6) >= 0.0f) + { + float w = (d4 - d3) / ((d4 - d3) + (d5 - d6)); + out= b + ((b - b)*w); + // barycentric coordinates (0,1-w,w) + return; + } + + // P inside face region. Compute Q through its barycentric coordinates (u,v,w) + float denom = 1.0f / (va + vb + vc); + float v = vb * denom; + float w = vc * denom; + out = a + (ab * v) + (ac * w); + } + + void closest_point_in_line(const Vector& p, + const Vector& a, + const Vector& b, + Vector& out) + { + // Create the vector from end point a to our point p. + Vector vVector1 = p - a; + // Create a normalized direction vector from end point a to end point b + Vector vVector2 = b - a; + vVector2.normalize(); + // Use the distance formula to find the distance of + // the line segment (or magnitude) + float d = sqrtf((vVector2[X]*vVector2[X])+ + (vVector2[Y]*vVector2[Y])+ + (vVector2[Z]*vVector2[Z])); + + // Using the dot product, we project the vVector1 onto the vector vVector2. + // This essentially gives us the distance from our projected vector from a. + float t = dot(vVector2,vVector1); + // If our projected distance from a, "t", is less than or equal to 0, + // it must be closest to the end point a. We want to return this end point. + if (t <= 0) + { + out = a; + return; + } + + // If our projected distance from a, "t", + // is greater than or equal to the magnitude + // or distance of the line segment, + // it must be closest to the end point b. So, return b. + if (t >= d) + { + out = b; + return; + } + + // Here we create a vector that is of length t + // and in the direction of vVector2 + Vector vVector3 = vVector2 * t; + + // To find the closest point on the line segment, + // we just add vVector3 to the original + // end point a. + Vector vClosestPoint = a + vVector3; + // Return the closest point on the line segment + out = vClosestPoint; + } + + /*! + \brief Determines minimum penetration depth vector for current simplex + \param [IN] a Convex Shape A + \param [IN] b Convex Shape B + \param [IN] a2w A transformation + \param [IN] b2w B transformation + \param [OUT] v penetration depth vector + */ + inline void determine_minimum_penetration_depth(const Convex& a, + const Convex& b, + const Transform& a2w, + const Transform& b2w, + Vector& v) + { + #ifdef USE_QHULL + /* + This is a very RAW implementation of the Penetration Depth calculation + described on the paper + "Proximity Queries and Penetration Depth Computation on 3D Game Objects" + found at http://www.win.tue.nl/~gino/solid/gdc2001depth.pdf + */ + boolT ismalloc; + int curlong, totlong, exitcode; + char options[200]; + + facetT *facet; + vertexT *vertex; + vertexT **vertexp; + const Vector origin(0,0,0); + Vector closest; + Vector close_test; + Vector w; + boolT isoutside; + realT bestdist; + int triangle_index[3]; + Vector triangle[3]; + int iterations=0; + // LOOP Starts Here, testing with 100 iterations: + for(int j=0;j<100;++j) + { + size_t numVerts = inflated_polyhedron.size(); + + coordT *array = new coordT[numVerts*3]; + coordT *p = &array[0]; + int i; + for (i = 0; i < numVerts; ++i) + { + *p++ = inflated_polyhedron[i][X]; + *p++ = inflated_polyhedron[i][Y]; + *p++ = inflated_polyhedron[i][Z]; + } + + ismalloc = False; // True if qh_freeqhull should 'free(array)' + qh_init_A(stdin, stdout, stderr, 0, NULL); + if (exitcode = setjmp(qh errexit)) exit(exitcode); + sprintf(options, "qhull Qx i s Tcv C-0"); + qh_initflags(options); + qh_init_B(&array[0], numVerts, 3, ismalloc); + qh_qhull(); + qh_check_output(); + + Scalar distance=FLT_MAX; + + FORALLfacets + { + setT *vertices = qh_facet3vertex(facet); + i=0; + FOREACHvertex_(vertices) + { + triangle_index[i]=qh_pointid(vertex->point); + ++i; + } + closest_point_in_triangle(origin, + inflated_polyhedron[triangle_index[0]], + inflated_polyhedron[triangle_index[1]], + inflated_polyhedron[triangle_index[2]], + close_test); + if(close_test.length2()<distance) + { + triangle[0]=inflated_polyhedron[triangle_index[0]]; + triangle[1]=inflated_polyhedron[triangle_index[1]]; + triangle[2]=inflated_polyhedron[triangle_index[2]]; + distance=close_test.length2(); + closest=close_test; + } + } + + // Split triangle, add points to the convex hull + /* + Removing points NOT in the convex hull here from inflated_polyhedron + would probably be a good idea. + */ + w = a2w(a.support((-closest) * a2w.getBasis())) - + b2w(b.support(closest * b2w.getBasis())); + inflated_polyhedron.push_back(w); + + for(i=0;i<3;++i) + { + // Use closest point in line to find new w + closest_point_in_line(origin,triangle[i],triangle[(i+1)%3],closest); + w = a2w(a.support((-closest) * a2w.getBasis())) - + b2w(b.support(closest * b2w.getBasis())); + if(dot(w,closest)!=dot(closest,closest)) + { + inflated_polyhedron.push_back(w); + } + } + + delete [] array; + qh NOerrexit = True; + qh_freeqhull(!qh_ALL); + qh_memfreeshort(&curlong, &totlong); + } + v=w; + fprintf(stdout,"Last V %f,%f,%f\n",v[X],v[Y],v[Z]); + + #else + #warning "Determination of minimum penetration depth without QHULL has not been implemented" + #endif + } + /*! \brief Checks whether or not convex shapes A and B intersect *************** *** 298,306 **** case 0: /* ! Simplex is a point this should not happen, ! maybe if the 2 objects are duplicates and ! concentric, for now, just report. */ ! fprintf(stdout,"Panic: Simplex is a Point!\n"); break; case 1: --- 555,563 ---- case 0: /* ! Simplex is a point this happens if the 2 surfaces barelly touch */ ! v[X]=0.0f; ! v[Y]=0.0f; ! v[Z]=0.0f; break; case 1: *************** *** 334,339 **** inflated_polyhedron.push_back(y[i]); } ! // ??????? ! // Profit! :) break; } --- 591,595 ---- inflated_polyhedron.push_back(y[i]); } ! determine_minimum_penetration_depth(a,b,a2w,b2w,v); break; } *************** *** 524,531 **** } - /*! \brief returns the shortest penetration depth for the last test */ - void shortest_penetration_depth(Vector& pd) - { - } - - --- 780,781 ---- |
From: Rodrigo H. <kw...@us...> - 2005-07-07 23:20:09
|
Update of /cvsroot/freesolid/freesolid/sample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5045/sample Modified Files: torus.cpp walk.cpp Log Message: more penetration depth code Index: torus.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/torus.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** torus.cpp 18 Apr 2005 00:33:18 -0000 1.5 --- torus.cpp 7 Jul 2005 23:19:54 -0000 1.6 *************** *** 8,12 **** #define USE_QUADS ! typedef struct MyObject { int id; } MyObject; --- 8,13 ---- #define USE_QUADS ! typedef struct MyObject ! { int id; } MyObject; *************** *** 96,101 **** break; case SDL_KEYDOWN: /* Handle a KEYDOWN event */ ! if(event.key.keysym.sym==SDLK_ESCAPE) ! bRunning = false; // quit if ESCAPE is pressed break; } --- 97,107 ---- break; case SDL_KEYDOWN: /* Handle a KEYDOWN event */ ! switch(event.key.keysym.sym) ! { ! case SDLK_ESCAPE: ! case SDLK_q: ! bRunning = false; // quit if ESCAPE is pressed ! break; ! } break; } Index: walk.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/walk.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** walk.cpp 11 May 2005 23:31:04 -0000 1.4 --- walk.cpp 7 Jul 2005 23:19:54 -0000 1.5 *************** *** 54,61 **** if(coll_data!=NULL) { ! fprintf(stdout,"Collided Point 1 %f,%f,%f\nPoint 2 %f,%f,%f\nNormal %f,%f,%f\n", ! coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); } } --- 54,61 ---- if(coll_data!=NULL) { ! // fprintf(stdout,"Collided Point 1 %f,%f,%f\nPoint 2 %f,%f,%f\nNormal %f,%f,%f\n", ! // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! // coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! // coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); } } *************** *** 66,71 **** --- 66,73 ---- //---------------------- MyObject object2; + MyObject object3; DtShapeRef world; DtShapeRef ellipsoid; + DtShapeRef box; PointList points; IndexList indexes; *************** *** 90,96 **** ellipsoid = dtEllipsoid(player.radii[0],player.radii[1],player.radii[2]); //ellipsoid = dtSphere(player.radii[2]); ! //ellipsoid = dtBox(player.radii[0],player.radii[1],player.radii[2]); dtCreateObject(&player, ellipsoid); dtCreateObject(&object2, world); //dtDisableCaching(); --- 92,99 ---- ellipsoid = dtEllipsoid(player.radii[0],player.radii[1],player.radii[2]); //ellipsoid = dtSphere(player.radii[2]); ! box = dtBox(player.radii[0],player.radii[1],player.radii[2]); dtCreateObject(&player, ellipsoid); dtCreateObject(&object2, world); + dtCreateObject(&object3, box); //dtDisableCaching(); *************** *** 137,140 **** --- 140,146 ---- dtDisableCaching(); + dtSelectObject(&object3); + dtLoadIdentity(); + //dtTranslate(player.pos[X],player.pos[Y],player.pos[Z]); while(bRunning) |
From: Rodrigo H. <kw...@us...> - 2005-07-06 23:42:00
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28527/libsolid Modified Files: Convex.h Log Message: Started implementing EPA Index: Convex.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Convex.h 6 Jul 2005 23:40:57 -0000 1.4 --- Convex.h 6 Jul 2005 23:41:51 -0000 1.5 *************** *** 71,75 **** Point&, Point&); ! void shortest_penetration_depth(Vector& pd); #endif --- 71,75 ---- Point&, Point&); ! #endif |
From: Rodrigo H. <kw...@us...> - 2005-07-06 23:41:15
|
Update of /cvsroot/freesolid/freesolid/include/3D In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27929/include/3D Modified Files: Vector.h Log Message: Started implementing EPA Index: Vector.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/include/3D/Vector.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Vector.h 21 Apr 2005 23:20:54 -0000 1.3 --- Vector.h 6 Jul 2005 23:40:56 -0000 1.4 *************** *** 50,53 **** --- 50,54 ---- void normalize(); Vector normalized() const; + void normal(const Vector& p1,const Vector& p2,const Vector& p3); int closestAxis() const; *************** *** 131,134 **** --- 132,142 ---- inline void Vector::normalize() { *this /= length(); } inline Vector Vector::normalized() const { return *this / length(); } + inline void Vector::normal(const Vector& p1, + const Vector& p2, + const Vector& p3) + { + *this = cross((p2 - p1),(p3 - p1)); + *this /= length(); + } inline int Vector::closestAxis() const { |
From: Rodrigo H. <kw...@us...> - 2005-07-06 23:41:14
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27929/libsolid Modified Files: C-api.cpp Convex.cpp Convex.h Object.cpp Log Message: Started implementing EPA Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Object.cpp 4 Jul 2005 23:35:05 -0000 1.8 --- Object.cpp 6 Jul 2005 23:40:57 -0000 1.9 *************** *** 105,109 **** { static IntersectTable p; ! p.addEntry(CONVEX, CONVEX, intersectConvexConvex); p.addEntry(COMPLEX, CONVEX, intersectComplexConvex); p.addEntry(COMPLEX, COMPLEX, intersectComplexComplex); --- 105,109 ---- { static IntersectTable p; ! p.addEntry(CONVEX, CONVEX, intersectConvexConvex); p.addEntry(COMPLEX, CONVEX, intersectComplexConvex); p.addEntry(COMPLEX, COMPLEX, intersectComplexComplex); *************** *** 136,140 **** } ! Common_pointTable *common_pointInitialize() { static Common_pointTable p; p.addEntry(CONVEX, CONVEX, common_pointConvexConvex); --- 136,141 ---- } ! Common_pointTable *common_pointInitialize() ! { static Common_pointTable p; p.addEntry(CONVEX, CONVEX, common_pointConvexConvex); *************** *** 151,156 **** /*! \brief I THINK this returns closest points from last test ! \param a Object A to test against B ? ! \param b Object B to test against A ? \param v No idea. \param pa Point in A? --- 152,157 ---- /*! \brief I THINK this returns closest points from last test ! \param a Object A to test against B ! \param b Object B to test against A \param v No idea. \param pa Point in A? *************** *** 208,213 **** else { ! // if both are simplex ! if (!intersect(a, b, v)) return false; closest_points((const Convex&)*a.shapePtr, (const Convex&)*b.shapePtr, --- 209,215 ---- else { ! // if both are simple convex objects ! if (!intersect(a, b, v)) // Apply GJK ! return false; // If there is no intersection, return false closest_points((const Convex&)*a.shapePtr, (const Convex&)*b.shapePtr, Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** C-api.cpp 4 Jul 2005 23:35:05 -0000 1.10 --- C-api.cpp 6 Jul 2005 23:40:57 -0000 1.11 *************** *** 125,129 **** } ! void dtBegin(DtPolyType type) { currentType = type; } --- 125,130 ---- } ! void dtBegin(DtPolyType type) ! { currentType = type; } *************** *** 135,139 **** } ! void dtVertex(DT_Scalar x,DT_Scalar y,DT_Scalar z) { Point p(x,y,z); int i = int(pointBuf.size())-20; --- 136,141 ---- } ! void dtVertex(DT_Scalar x,DT_Scalar y,DT_Scalar z) ! { Point p(x,y,z); int i = int(pointBuf.size())-20; *************** *** 144,179 **** } ! void dtVertexBase(const void *base) { currentComplex->setBase(base); } ! void dtVertexIndex(DT_Index idx) { indexBuf.push_back(idx); } ! void dtVertexIndices(DtPolyType type,DT_Count cnt,const DT_Index *indices) { ! if (currentComplex) { ! const Polytope *poly; ! switch (type) { ! case DT_SIMPLEX: ! poly = new Simplex(currentComplex->getBase(), cnt, indices); ! break; ! case DT_POLYGON: ! poly = new Polygon(currentComplex->getBase(), cnt, indices); ! break; ! case DT_POLYHEDRON: ! if (currentComplex->getBase().getPointer()==0) { ! currentComplex->setBase(&pointBuf[0]); ! poly = new Polyhedron(currentComplex->getBase(),cnt,indices); ! currentComplex->setBase(0); } ! else poly = new Polyhedron(currentComplex->getBase(),cnt,indices); ! break; } - polyList.push_back(poly); - } } ! void dtVertexRange(DtPolyType type, DT_Index first, DT_Count cnt) { DT_Index *indices = new DT_Index[cnt]; for (unsigned int i = 0; i < cnt;++i) indices[i] = first + i; --- 146,186 ---- } ! void dtVertexBase(const void *base) ! { currentComplex->setBase(base); } ! void dtVertexIndex(DT_Index idx) ! { indexBuf.push_back(idx); } ! void dtVertexIndices(DtPolyType type,DT_Count cnt,const DT_Index *indices) ! { ! if (currentComplex) ! { ! const Polytope *poly; ! switch (type) { ! case DT_SIMPLEX: ! poly = new Simplex(currentComplex->getBase(), cnt, indices); ! break; ! case DT_POLYGON: ! poly = new Polygon(currentComplex->getBase(), cnt, indices); ! break; ! case DT_POLYHEDRON: ! if (currentComplex->getBase().getPointer()==0) { ! currentComplex->setBase(&pointBuf[0]); ! poly = new Polyhedron(currentComplex->getBase(),cnt,indices); ! currentComplex->setBase(0); ! } ! else poly = new Polyhedron(currentComplex->getBase(),cnt,indices); ! break; } ! polyList.push_back(poly); } } ! void dtVertexRange(DtPolyType type, DT_Index first, DT_Count cnt) ! { DT_Index *indices = new DT_Index[cnt]; for (unsigned int i = 0; i < cnt;++i) indices[i] = first + i; *************** *** 182,203 **** } ! void dtDeleteShape(DtShapeRef shape) { ! if (((Shape *)shape)->getType() == COMPLEX) { ! ComplexList::iterator i = ! find(complexList.begin(), complexList.end(), (Complex *)shape); ! if (i != complexList.end()) complexList.erase(i); ! } delete (Shape *)shape; } ! void dtChangeVertexBase(DtShapeRef shape, const void *base) { if (((Shape *)shape)->getType() == COMPLEX) ((Complex *)shape)->changeBase(base); for (ObjectList::const_iterator i = objectList.begin(); ! i != objectList.end(); ++i) { ! if ((*i).second->shapePtr == (Shape *)shape) { ! (*i).second->do_broadphase(); } - } } --- 189,215 ---- } ! void dtDeleteShape(DtShapeRef shape) ! { ! if (((Shape *)shape)->getType() == COMPLEX) ! { ! ComplexList::iterator i = ! find(complexList.begin(), complexList.end(), (Complex *)shape); ! if (i != complexList.end()) complexList.erase(i); ! } delete (Shape *)shape; } ! void dtChangeVertexBase(DtShapeRef shape, const void *base) ! { if (((Shape *)shape)->getType() == COMPLEX) ((Complex *)shape)->changeBase(base); for (ObjectList::const_iterator i = objectList.begin(); ! i != objectList.end(); ++i) ! { ! if ((*i).second->shapePtr == (Shape *)shape) ! { ! (*i).second->do_broadphase(); ! } } } *************** *** 205,210 **** // Object instantiation ! void dtCreateObject(DtObjectRef object, DtShapeRef shape) { ! currentObject = objectList[object] = new Object(object,(Shape *)shape, broadphase); } --- 217,223 ---- // Object instantiation ! void dtCreateObject(DtObjectRef object, DtShapeRef shape) ! { ! currentObject = objectList[object] = new Object(object,(Shape *)shape, broadphase); } *************** *** 303,307 **** // Runtime ! void dtProceed() { for (ComplexList::iterator i = complexList.begin(); i != complexList.end(); ++i) --- 316,321 ---- // Runtime ! void dtProceed() ! { for (ComplexList::iterator i = complexList.begin(); i != complexList.end(); ++i) *************** *** 312,316 **** } ! void dtEnableCaching() { for (ObjectList::const_iterator i=objectList.begin();i!=objectList.end();++i) (*i).second->do_broadphase(); --- 326,331 ---- } ! void dtEnableCaching() ! { for (ObjectList::const_iterator i=objectList.begin();i!=objectList.end();++i) (*i).second->do_broadphase(); *************** *** 318,324 **** } ! void dtDisableCaching() { caching = false; } ! void dtSetTolerance(DT_Scalar tol) { rel_error = tol; } /*! --- 333,345 ---- } ! void dtDisableCaching() ! { ! caching = false; ! } ! void dtSetTolerance(DT_Scalar tol) ! { ! rel_error = tol; ! } /*! *************** *** 351,356 **** // Added these to see if there is any difference, // and there is, but not quite what was expected, or is it?. ! ((Object *)e.obj1)->proceed(); ! ((Object *)e.obj2)->proceed(); return true; } --- 372,377 ---- // Added these to see if there is any difference, // and there is, but not quite what was expected, or is it?. ! //((Object *)e.obj1)->proceed(); ! //((Object *)e.obj2)->proceed(); return true; } Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Convex.cpp 4 Jul 2005 23:35:05 -0000 1.6 --- Convex.cpp 6 Jul 2005 23:40:57 -0000 1.7 *************** *** 24,28 **** P.O. Box 513, 5600 MB Eindhoven, The Netherlands */ ! #include "Convex.h" #include "BBox.h" --- 24,28 ---- P.O. Box 513, 5600 MB Eindhoven, The Netherlands */ ! #include <vector> #include "Convex.h" #include "BBox.h" *************** *** 57,60 **** --- 57,62 ---- static Vector y[4]; // support points of A - B in world coordinates + static std::vector<Vector> inflated_polyhedron; // Inflated Polyhedron for depth penetration + static int bits; // identifies current simplex static int last; // identifies last found support point *************** *** 174,215 **** #endif ! inline bool closest(Vector& v) { compute_det(); ! for (int s = bits; s; --s) { ! if ((s & bits) == s) { ! if (valid(s|last_bit)) { ! bits = s|last_bit; ! compute_vector(bits, v); ! return true; ! } } - } - if (valid(last_bit)) { - bits = last_bit; - v = y[last]; - return true; - } // Original GJK calls the backup procedure at this point. ! #ifdef USE_BACKUP_PROCEDURE ! Scalar min_dist2 = SOLID_INFINITY; ! for (int s = all_bits; s; --s) { ! if ((s & all_bits) == s) { ! if (proper(s)) { ! Vector u; ! compute_vector(s, u); ! Scalar dist2 = u.length2(); ! if (dist2 < min_dist2) { ! min_dist2 = dist2; ! bits = s; ! v = u; } - } } ! } ! ! #endif ! return false; } --- 176,224 ---- #endif ! inline bool closest(Vector& v) ! { compute_det(); ! for (int s = bits; s; --s) ! { ! if ((s & bits) == s) ! { ! if (valid(s|last_bit)) ! { ! bits = s|last_bit; ! compute_vector(bits, v); ! return true; ! } ! } ! } ! if (valid(last_bit)) ! { ! bits = last_bit; ! v = y[last]; ! return true; } // Original GJK calls the backup procedure at this point. ! #ifdef USE_BACKUP_PROCEDURE ! Scalar min_dist2 = SOLID_INFINITY; ! for (int s = all_bits; s; --s) ! { ! if ((s & all_bits) == s) ! { ! if (proper(s)) ! { ! Vector u; ! compute_vector(s, u); ! Scalar dist2 = u.length2(); ! if (dist2 < min_dist2) { ! min_dist2 = dist2; ! bits = s; ! v = u; ! } ! } } } ! ! #endif return false; } *************** *** 237,241 **** \param b2w [IN] Transformation Matrix for B \param v [OUT] Separating axis ! \note This is core of the GJK Algorithm */ bool intersect(const Convex& a, --- 246,250 ---- \param b2w [IN] Transformation Matrix for B \param v [OUT] Separating axis ! \note This is the core of the GJK Algorithm */ bool intersect(const Convex& a, *************** *** 245,248 **** --- 254,258 ---- Vector& v) { + inflated_polyhedron.clear(); Vector w; *************** *** 253,287 **** num_iterations = 0; #endif ! ! do { ! last = 0; ! last_bit = 1; ! while (bits & last_bit) ! { ++last; last_bit <<= 1; } ! ! w = a2w(a.support((-v) * a2w.getBasis())) - ! b2w(b.support(v * b2w.getBasis())); ! if (dot(v, w) > 0) return false; ! if (degenerate(w)) ! { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } ! y[last] = w; ! all_bits = bits|last_bit; #ifdef STATISTICS ! ++num_iterations; #endif ! if (!closest(v)) ! { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } ! } ! while (bits < 15 && !approxZero(v)); return true; } --- 263,341 ---- num_iterations = 0; #endif ! do ! { ! last = 0; ! last_bit = 1; ! while (bits & last_bit) ! { ++last; last_bit <<= 1; } ! ! w = a2w(a.support((-v) * a2w.getBasis())) - ! b2w(b.support(v * b2w.getBasis())); ! if (dot(v, w) > 0) return false; ! if (degenerate(w)) ! { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } ! y[last] = w; ! all_bits = bits|last_bit; #ifdef STATISTICS ! ++num_iterations; #endif ! if (!closest(v)) ! { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } ! } ! while (bits < 15 && !approxZero(v)); ! switch(last) ! { ! case 0: ! /* ! Simplex is a point this should not happen, ! maybe if the 2 objects are duplicates and ! concentric, for now, just report. ! */ ! fprintf(stdout,"Panic: Simplex is a Point!\n"); ! break; ! case 1: ! // The Simplex is line, return the point closer to the origin ! if(y[0].length2()<y[1].length2()) ! { ! v=y[0]; ! } ! else ! { ! v=y[1]; ! } ! break; ! case 2: ! // The simplex is a triangle, add support points in the normal ! // of the triangle direction and the inverse of the normal ! v.normal(y[0],y[1],y[2]); ! w = a2w(a.support((-v) * a2w.getBasis())) - ! b2w(b.support(v * b2w.getBasis())); ! inflated_polyhedron.push_back(w); ! v*=-1; ! w = a2w(a.support((-v) * a2w.getBasis())) - ! b2w(b.support(v * b2w.getBasis())); ! inflated_polyhedron.push_back(w); ! // no break here since we go thru the same process as if this was ! // a tetrahedron. ! case 3: ! // The simplex is a tetrahedron, just what we need! ! for(int i=0;i<=last;++i) ! { ! inflated_polyhedron.push_back(y[i]); ! } ! // ??????? ! // Profit! :) ! break; ! } return true; } *************** *** 470,473 **** --- 524,531 ---- } + /*! \brief returns the shortest penetration depth for the last test */ + void shortest_penetration_depth(Vector& pd) + { + } Index: Convex.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Convex.h 11 May 2005 23:31:04 -0000 1.3 --- Convex.h 6 Jul 2005 23:40:57 -0000 1.4 *************** *** 71,73 **** --- 71,75 ---- Point&, Point&); + void shortest_penetration_depth(Vector& pd); + #endif |
From: Rodrigo H. <kw...@us...> - 2005-07-04 23:35:18
|
Update of /cvsroot/freesolid/freesolid/include/SOLID In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/include/SOLID Modified Files: solid.h Log Message: Just formating changes Index: solid.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/include/SOLID/solid.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** solid.h 11 May 2005 23:31:04 -0000 1.6 --- solid.h 4 Jul 2005 23:35:04 -0000 1.7 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen |
From: Rodrigo H. <kw...@us...> - 2005-07-04 23:35:18
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2746/libsolid Modified Files: AlgoTable.h BBox.h C-api.cpp Convex.cpp Ellipsoid.cpp Encounter.h IndexArray.h Object.cpp Object.h RespTable.cpp RespTable.h Response.cpp Response.h Transform.cpp Log Message: Just formating changes Index: Transform.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Transform.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Transform.cpp 21 Apr 2005 23:20:55 -0000 1.2 --- Transform.cpp 4 Jul 2005 23:35:05 -0000 1.3 *************** *** 27,31 **** #include "Transform.h" ! void Transform::setValue(const float m[16]) { basis.setValue(m); origin.setValue(&m[12]); --- 27,32 ---- #include "Transform.h" ! void Transform::setValue(const float m[16]) ! { basis.setValue(m); origin.setValue(&m[12]); *************** *** 41,45 **** */ ! Transform& Transform::operator*=(const Transform& t) { origin += basis * t.origin; basis *= t.basis; --- 42,47 ---- */ ! Transform& Transform::operator*=(const Transform& t) ! { origin += basis * t.origin; basis *= t.basis; *************** *** 48,67 **** } ! void Transform::translate(const Vector& v) { origin += basis * v; type |= TRANSLATION; } ! void Transform::rotate(const Quaternion& q) { basis *= Matrix(q); type |= ROTATION; } ! void Transform::scale(Scalar x, Scalar y, Scalar z) { basis *= Matrix(x, y, z); type |= SCALING; } ! void Transform::setIdentity() { basis.setIdentity(); origin.setValue(0, 0, 0); --- 50,73 ---- } ! void Transform::translate(const Vector& v) ! { origin += basis * v; type |= TRANSLATION; } ! void Transform::rotate(const Quaternion& q) ! { basis *= Matrix(q); type |= ROTATION; } ! void Transform::scale(Scalar x, Scalar y, Scalar z) ! { basis *= Matrix(x, y, z); type |= SCALING; } ! void Transform::setIdentity() ! { basis.setIdentity(); origin.setValue(0, 0, 0); *************** *** 69,73 **** } ! void Transform::invert(const Transform& t) { basis = t.type & SCALING ? inverse(t.basis) : transpose(t.basis); origin.setValue(-dot(basis[X], t.origin), --- 75,80 ---- } ! void Transform::invert(const Transform& t) ! { basis = t.type & SCALING ? inverse(t.basis) : transpose(t.basis); origin.setValue(-dot(basis[X], t.origin), *************** *** 77,81 **** } ! void Transform::mult(const Transform& t1, const Transform& t2) { basis = t1.basis * t2.basis; origin = t1(t2.origin); --- 84,89 ---- } ! void Transform::mult(const Transform& t1, const Transform& t2) ! { basis = t1.basis * t2.basis; origin = t1(t2.origin); *************** *** 83,97 **** } ! void Transform::multInverseLeft(const Transform& t1, const Transform& t2) { Vector v = t2.origin - t1.origin; ! if (t1.type & SCALING) { ! Matrix inv = inverse(t1.basis); ! basis = inv * t2.basis; ! origin = inv * v; ! } ! else { ! basis = multTransposeLeft(t1.basis, t2.basis); ! origin = v * t1.basis; ! } type = t1.type | t2.type; } --- 91,108 ---- } ! void Transform::multInverseLeft(const Transform& t1, const Transform& t2) ! { Vector v = t2.origin - t1.origin; ! if (t1.type & SCALING) ! { ! Matrix inv = inverse(t1.basis); ! basis = inv * t2.basis; ! origin = inv * v; ! } ! else ! { ! basis = multTransposeLeft(t1.basis, t2.basis); ! origin = v * t1.basis; ! } type = t1.type | t2.type; } Index: Encounter.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Encounter.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Encounter.h 21 Oct 2002 21:53:14 -0000 1.1.1.1 --- Encounter.h 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 33,54 **** typedef const Object *ObjectPtr; ! class Encounter { ! public: ObjectPtr obj1; ObjectPtr obj2; ! Vector sep_axis; ! ! Encounter(ObjectPtr o1, ObjectPtr o2) { ! if (o2->shapePtr->getType() < o1->shapePtr->getType() || ! (o2->shapePtr->getType() == o1->shapePtr->getType() && o2 < o1)) { ! obj1 = o2; ! obj2 = o1; ! } ! else { ! obj1 = o1; ! obj2 = o2; } - sep_axis.setValue(0,0,0); - } }; --- 33,58 ---- typedef const Object *ObjectPtr; ! class Encounter ! { ! public: ObjectPtr obj1; ObjectPtr obj2; ! Vector sep_axis; ! Encounter(ObjectPtr o1, ObjectPtr o2) ! { ! if((o2->shapePtr->getType() < o1->shapePtr->getType()) || ! (o2->shapePtr->getType() == o1->shapePtr->getType()) && ! (o2 < o1)) ! { ! obj1 = o2; ! obj2 = o1; ! } ! else ! { ! obj1 = o1; ! obj2 = o2; ! } ! sep_axis.setValue(0,0,0); } }; Index: RespTable.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/RespTable.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** RespTable.h 21 Oct 2002 21:53:15 -0000 1.1.1.1 --- RespTable.h 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 37,67 **** typedef map<ObjPair, Response, less<ObjPair> > PairList; ! inline ObjPair make_ObjPair(DtObjectRef x, DtObjectRef y) { return y < x ? make_pair(y, x) : make_pair(x, y); } ! class RespTable { ! public: const Response& find(DtObjectRef obj1, DtObjectRef obj2) const; void cleanObject(DtObjectRef obj); - - void setDefault(const Response& resp) { defaultResp = resp; } ! void setSingle(DtObjectRef obj, const Response& resp) { singleList[obj] = resp; } ! void resetSingle(DtObjectRef obj) { singleList.erase(obj); } ! void setPair(DtObjectRef obj1, DtObjectRef obj2, const Response& resp) { pairList[make_ObjPair(obj1, obj2)] = resp; } ! void resetPair(DtObjectRef obj1, DtObjectRef obj2) { pairList.erase(make_ObjPair(obj1, obj2)); } - - private: Response defaultResp; --- 37,72 ---- typedef map<ObjPair, Response, less<ObjPair> > PairList; ! inline ObjPair make_ObjPair(DtObjectRef x, DtObjectRef y) ! { return y < x ? make_pair(y, x) : make_pair(x, y); } ! class RespTable ! { ! public: const Response& find(DtObjectRef obj1, DtObjectRef obj2) const; void cleanObject(DtObjectRef obj); ! void setDefault(const Response& resp) ! { defaultResp = resp; } ! ! void setSingle(DtObjectRef obj, const Response& resp) ! { singleList[obj] = resp; } ! void resetSingle(DtObjectRef obj) ! { singleList.erase(obj); } ! void setPair(DtObjectRef obj1, DtObjectRef obj2, const Response& resp) ! { pairList[make_ObjPair(obj1, obj2)] = resp; } ! void resetPair(DtObjectRef obj1, DtObjectRef obj2) ! { pairList.erase(make_ObjPair(obj1, obj2)); } private: Response defaultResp; Index: IndexArray.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/IndexArray.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** IndexArray.h 21 Oct 2002 21:53:10 -0000 1.1.1.1 --- IndexArray.h 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** C-api.cpp 11 May 2005 23:31:04 -0000 1.9 --- C-api.cpp 4 Jul 2005 23:35:05 -0000 1.10 *************** *** 322,327 **** void dtSetTolerance(DT_Scalar tol) { rel_error = tol; } ! /*! \brief tests 2 objects for collision ! \param e data about the 2 colliding objects */ bool object_test(Encounter& e) --- 322,328 ---- void dtSetTolerance(DT_Scalar tol) { rel_error = tol; } ! /*! ! \brief tests 2 objects for collision ! \param e the Enconter data for the 2 colliding objects */ bool object_test(Encounter& e) *************** *** 378,383 **** (*j).second->do_broadphase(); } ! for (ProxList::iterator i = proxList.begin(); i != proxList.end(); ++i) ! if (object_test((Encounter &)*i)) ++cnt; } else --- 379,389 ---- (*j).second->do_broadphase(); } ! for (ProxList::iterator i = proxList.begin(); i != proxList.end(); ++i) ! { ! if (object_test((Encounter &)*i)) ! { ! ++cnt; ! } ! } } else *************** *** 386,401 **** for (ObjectList::const_iterator j = objectList.begin(); j != objectList.end(); ++j) ! for (ObjectList::const_iterator i = objectList.begin(); ! i != j; ++i) ! { ! Encounter e((*i).second, (*j).second); ! c++; ! if (object_test(e)) ++cnt; ! } } return cnt; } ! void dtTestObjects(DtObjectRef object1, DtObjectRef object2) { // Programmed by Alok Menghrajani. // alo...@ep... --- 392,410 ---- for (ObjectList::const_iterator j = objectList.begin(); j != objectList.end(); ++j) ! { ! for (ObjectList::const_iterator i = objectList.begin(); ! i != j; ++i) ! { ! Encounter e((*i).second, (*j).second); ! c++; ! if (object_test(e)) ++cnt; ! } ! } } return cnt; } ! void dtTestObjects(DtObjectRef object1, DtObjectRef object2) ! { // Programmed by Alok Menghrajani. // alo...@ep... Index: AlgoTable.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/AlgoTable.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AlgoTable.h 21 Oct 2002 21:53:12 -0000 1.1.1.1 --- AlgoTable.h 4 Jul 2005 23:35:04 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 30,35 **** --- 30,37 ---- #include "Shape.h" + /*! The number of different convex shapes supported */ const int NUM_TYPES = 8; + /*! Function Look up table class for one type of convex shape against another */ template <class Function> class AlgoTable { Index: Response.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Response.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Response.h 21 Oct 2002 21:53:09 -0000 1.1.1.1 --- Response.h 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 32,36 **** #include <3D/Point.h> ! class Response { public: static DtCollData coll_data; --- 32,37 ---- #include <3D/Point.h> ! class Response ! { public: static DtCollData coll_data; Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Object.cpp 11 May 2005 23:31:04 -0000 1.7 --- Object.cpp 4 Jul 2005 23:35:05 -0000 1.8 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 85,89 **** bool intersectConvexConvex(const Shape& a, const Shape& b, const Transform& a2w, const Transform& b2w, ! Vector& v) { return intersect((const Convex&)a, (const Convex&)b, a2w, b2w, v); } --- 85,90 ---- bool intersectConvexConvex(const Shape& a, const Shape& b, const Transform& a2w, const Transform& b2w, ! Vector& v) ! { return intersect((const Convex&)a, (const Convex&)b, a2w, b2w, v); } *************** *** 101,105 **** } ! IntersectTable *intersectInitialize() { static IntersectTable p; p.addEntry(CONVEX, CONVEX, intersectConvexConvex); --- 102,107 ---- } ! IntersectTable *intersectInitialize() ! { static IntersectTable p; p.addEntry(CONVEX, CONVEX, intersectConvexConvex); *************** *** 109,113 **** } ! bool intersect(const Object& a, const Object& b, Vector& v) { static IntersectTable *intersectTable = intersectInitialize(); Intersect i = intersectTable->lookup(a.shapePtr->getType(),b.shapePtr->getType()); --- 111,116 ---- } ! bool intersect(const Object& a, const Object& b, Vector& v) ! { static IntersectTable *intersectTable = intersectInitialize(); Intersect i = intersectTable->lookup(a.shapePtr->getType(),b.shapePtr->getType()); Index: RespTable.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/RespTable.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** RespTable.cpp 21 Oct 2002 21:53:16 -0000 1.1.1.1 --- RespTable.cpp 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 31,35 **** ! const Response& RespTable::find(DtObjectRef obj1, DtObjectRef obj2) const { PairList::const_iterator i = pairList.find(make_ObjPair(obj1, obj2)); if (i != pairList.end()) return (*i).second; --- 31,36 ---- ! const Response& RespTable::find(DtObjectRef obj1, DtObjectRef obj2) const ! { PairList::const_iterator i = pairList.find(make_ObjPair(obj1, obj2)); if (i != pairList.end()) return (*i).second; *************** *** 44,62 **** PartnerList partnerList; ! void RespTable::cleanObject(DtObjectRef obj) { resetSingle(obj); for (PairList::const_iterator i = pairList.begin(); ! i != pairList.end(); ++i) { ! if ((*i).first.first == obj) { ! partnerList.push_back((*i).first.second); } ! else if ((*i).first.second == obj) { ! partnerList.push_back((*i).first.first); } - } - while (!partnerList.empty()) { - resetPair(obj, partnerList.back()); - partnerList.pop_back(); - } } --- 45,68 ---- PartnerList partnerList; ! void RespTable::cleanObject(DtObjectRef obj) ! { resetSingle(obj); for (PairList::const_iterator i = pairList.begin(); ! i != pairList.end(); ++i) ! { ! if ((*i).first.first == obj) ! { ! partnerList.push_back((*i).first.second); ! } ! else if ((*i).first.second == obj) ! { ! partnerList.push_back((*i).first.first); ! } } ! while (!partnerList.empty()) ! { ! resetPair(obj, partnerList.back()); ! partnerList.pop_back(); } } Index: Ellipsoid.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Ellipsoid.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Ellipsoid.cpp 9 May 2005 04:10:18 -0000 1.1 --- Ellipsoid.cpp 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 40,44 **** { Scalar r = 1/s; ! return Point((vt[X] * r)*radii[X], (vt[Y] * r)*radii[Y], (vt[Z] * r)*radii[Z]); } else return Point(0, 0, 0); --- 40,46 ---- { Scalar r = 1/s; ! return Point((vt[X] * r)*radii[X], ! (vt[Y] * r)*radii[Y], ! (vt[Z] * r)*radii[Z]); } else return Point(0, 0, 0); Index: BBox.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/BBox.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BBox.h 10 May 2005 23:26:52 -0000 1.4 --- BBox.h 4 Jul 2005 23:35:04 -0000 1.5 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 89,95 **** inline bool intersect(const BBox& a,const BBox& b) { ! return fabs(a.center[X] - b.center[X]) <= a.extent[X] + b.extent[X] && ! fabs(a.center[Y] - b.center[Y]) <= a.extent[Y] + b.extent[Y] && ! fabs(a.center[Z] - b.center[Z]) <= a.extent[Z] + b.extent[Z]; } --- 89,95 ---- inline bool intersect(const BBox& a,const BBox& b) { ! return fabs(a.center[X] - b.center[X]) <= a.extent[X] + b.extent[X] && ! fabs(a.center[Y] - b.center[Y]) <= a.extent[Y] + b.extent[Y] && ! fabs(a.center[Z] - b.center[Z]) <= a.extent[Z] + b.extent[Z]; } Index: Object.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Object.h 11 May 2005 23:31:04 -0000 1.3 --- Object.h 4 Jul 2005 23:35:05 -0000 1.4 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 35,101 **** #include "Shape.h" ! class Object { ! public: ! Object(DtObjectRef obj, ShapePtr shape, BP_SceneHandle broadphase); ! ~Object(); ! ! void do_broadphase(); ! void proceed(); ! ! void translate(const Vector& v) { ! curr.translate(v); ! m_dirty = true; ! } ! void rotate(const Quaternion& q) { ! curr.rotate(q); ! m_dirty = true; ! } ! void scale(Scalar x, Scalar y, Scalar z) { ! curr.scale(x, y, z); ! m_dirty = true; ! } ! ! void setIdentity() { ! curr.setIdentity(); ! m_dirty = true; ! } ! void setMatrix(const float v[16]) { ! curr.setValue(v); ! m_dirty = true; ! } ! // Saved for later ! /* void setMatrix(const double v[16]) { ! curr.setValue(v); ! m_dirty = true; ! } ! */ ! void multMatrix(const float v[16]) { ! curr *= Transform(v); ! m_dirty = true; ! } // Saved for later ! /* void multMatrix(const double v[16]) { ! curr *= Transform(v); ! m_dirty = true; ! } */ ! Transform curr; ! // prev seems to NEVER get set or updated, yet it does get used. ! Transform prev; ! DtObjectRef ref; ! ShapePtr shapePtr; ! ! //For broadphase ! mutable BBox bbox; ! mutable bool m_dirty; ! BP_SceneHandle m_broadphase; ! BP_ProxyHandle m_proxy; }; bool intersect(const Object&, const Object&, Vector& v); bool common_point(const Object&, const Object&, Vector&, Point&, Point&); ! bool prev_closest_points(const Object&, const Object&, ! Vector&, Point&, Point&); #endif --- 35,109 ---- #include "Shape.h" ! class Object ! { ! public: ! Object(DtObjectRef obj, ShapePtr shape, BP_SceneHandle broadphase); ! ~Object(); ! ! void do_broadphase(); ! void proceed(); ! ! void translate(const Vector& v) ! { ! curr.translate(v); ! m_dirty = true; ! } ! void rotate(const Quaternion& q) ! { ! curr.rotate(q); ! m_dirty = true; ! } ! void scale(Scalar x, Scalar y, Scalar z) ! { ! curr.scale(x, y, z); ! m_dirty = true; ! } ! ! void setIdentity() ! { ! curr.setIdentity(); ! m_dirty = true; ! } ! void setMatrix(const float v[16]) ! { ! curr.setValue(v); ! m_dirty = true; ! } ! // Saved for later ! /* void setMatrix(const double v[16]) { ! curr.setValue(v); ! m_dirty = true; ! } ! */ ! void multMatrix(const float v[16]) ! { ! curr *= Transform(v); ! m_dirty = true; ! } // Saved for later ! /* ! void multMatrix(const double v[16]) ! { ! curr *= Transform(v); ! m_dirty = true; ! } */ ! Transform curr; ! // prev seems to NEVER get set or updated, yet it does get used. ! Transform prev; ! DtObjectRef ref; ! ShapePtr shapePtr; ! ! //For broadphase ! mutable BBox bbox; ! mutable bool m_dirty; ! BP_SceneHandle m_broadphase; ! BP_ProxyHandle m_proxy; }; bool intersect(const Object&, const Object&, Vector& v); bool common_point(const Object&, const Object&, Vector&, Point&, Point&); ! bool prev_closest_points(const Object&, const Object&,Vector&, Point&, Point&); #endif Index: Response.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Response.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Response.cpp 21 Oct 2002 21:53:10 -0000 1.1.1.1 --- Response.cpp 4 Jul 2005 23:35:05 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 31,35 **** void Response::operator()(DtObjectRef a, DtObjectRef b, const Point& pa, const Point& pb, ! const Vector& v) const { coll_data.point1[X] = pa[X]; coll_data.point1[Y] = pa[Y]; --- 31,36 ---- void Response::operator()(DtObjectRef a, DtObjectRef b, const Point& pa, const Point& pb, ! const Vector& v) const ! { coll_data.point1[X] = pa[X]; coll_data.point1[Y] = pa[Y]; *************** *** 44,48 **** } ! void Response::operator()(DtObjectRef a, DtObjectRef b) const { response(client_data, a, b, 0); } --- 45,50 ---- } ! void Response::operator()(DtObjectRef a, DtObjectRef b) const ! { response(client_data, a, b, 0); } Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Convex.cpp 11 May 2005 23:31:04 -0000 1.5 --- Convex.cpp 4 Jul 2005 23:35:05 -0000 1.6 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 36,40 **** */ ! BBox Convex::bbox(const Transform& t) const { Point mini(t.getOrigin()[X] + dot(t.getBasis()[X], support(-t.getBasis()[X])) - abs_error, --- 36,41 ---- */ ! BBox Convex::bbox(const Transform& t) const ! { Point mini(t.getOrigin()[X] + dot(t.getBasis()[X], support(-t.getBasis()[X])) - abs_error, *************** *** 52,57 **** } ! static Point p[4]; // support points of object A in local coordinates ! static Point q[4]; // support points of object B in local coordinates static Vector y[4]; // support points of A - B in world coordinates --- 53,58 ---- } ! static Point p[4]; // support points of object A in local coordinates ! static Point q[4]; // support points of object B in local coordinates static Vector y[4]; // support points of A - B in world coordinates *************** *** 68,73 **** #endif - - void compute_det() { --- 69,72 ---- *************** *** 77,114 **** if (bits & bit) dp[i][last] = dp[last][i] = dot(y[i], y[last]); dp[last][last] = dot(y[last], y[last]); ! det[last_bit][last] = 1; ! for (int j = 0, sj = 1; j < 4; ++j, sj <<= 1) { ! if (bits & sj) { ! int s2 = sj|last_bit; ! det[s2][j] = dp[last][last] - dp[last][j]; ! det[s2][last] = dp[j][j] - dp[j][last]; ! for (int k = 0, sk = 1; k < j; ++k, sk <<= 1) { ! if (bits & sk) { ! int s3 = sk|s2; ! det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) + ! det[s2][last] * (dp[last][j] - dp[last][k]); ! det[s3][j] = det[sk|last_bit][k] * (dp[k][k] - dp[k][j]) + ! det[sk|last_bit][last] * (dp[last][k] - dp[last][j]); ! det[s3][last] = det[sk|sj][k] * (dp[k][k] - dp[k][last]) + ! det[sk|sj][j] * (dp[j][k] - dp[j][last]); } } } ! } ! if (all_bits == 15) { ! det[15][0] = det[14][1] * (dp[1][1] - dp[1][0]) + ! det[14][2] * (dp[2][1] - dp[2][0]) + ! det[14][3] * (dp[3][1] - dp[3][0]); ! det[15][1] = det[13][0] * (dp[0][0] - dp[0][1]) + ! det[13][2] * (dp[2][0] - dp[2][1]) + ! det[13][3] * (dp[3][0] - dp[3][1]); ! det[15][2] = det[11][0] * (dp[0][0] - dp[0][2]) + ! det[11][1] * (dp[1][0] - dp[1][2]) + ! det[11][3] * (dp[3][0] - dp[3][2]); ! det[15][3] = det[7][0] * (dp[0][0] - dp[0][3]) + ! det[7][1] * (dp[1][0] - dp[1][3]) + ! det[7][2] * (dp[2][0] - dp[2][3]); ! } } --- 76,115 ---- if (bits & bit) dp[i][last] = dp[last][i] = dot(y[i], y[last]); dp[last][last] = dot(y[last], y[last]); ! det[last_bit][last] = 1; ! for (int j = 0, sj = 1; j < 4; ++j, sj <<= 1) ! { ! if (bits & sj) { ! int s2 = sj|last_bit; ! det[s2][j] = dp[last][last] - dp[last][j]; ! det[s2][last] = dp[j][j] - dp[j][last]; ! for (int k = 0, sk = 1; k < j; ++k, sk <<= 1) { ! if (bits & sk) { ! int s3 = sk|s2; ! det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) + ! det[s2][last] * (dp[last][j] - dp[last][k]); ! det[s3][j] = det[sk|last_bit][k] * (dp[k][k] - dp[k][j]) + ! det[sk|last_bit][last] * (dp[last][k] - dp[last][j]); ! det[s3][last] = det[sk|sj][k] * (dp[k][k] - dp[k][last]) + ! det[sk|sj][j] * (dp[j][k] - dp[j][last]); ! } } } } ! if (all_bits == 15) ! { ! det[15][0] = det[14][1] * (dp[1][1] - dp[1][0]) + ! det[14][2] * (dp[2][1] - dp[2][0]) + ! det[14][3] * (dp[3][1] - dp[3][0]); ! det[15][1] = det[13][0] * (dp[0][0] - dp[0][1]) + ! det[13][2] * (dp[2][0] - dp[2][1]) + ! det[13][3] * (dp[3][0] - dp[3][1]); ! det[15][2] = det[11][0] * (dp[0][0] - dp[0][2]) + ! det[11][1] * (dp[1][0] - dp[1][2]) + ! det[11][3] * (dp[3][0] - dp[3][2]); ! det[15][3] = det[7 ][0] * (dp[0][0] - dp[0][3]) + ! det[7 ][1] * (dp[1][0] - dp[1][3]) + ! det[7 ][2] * (dp[2][0] - dp[2][3]); ! } } *************** *** 116,141 **** { for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (all_bits & bit) { ! if (s & bit) ! { ! if (det[s][i] <= 0) return false; ! } ! else if (det[s|bit][i] > 0) return false; } - } return true; } ! inline void compute_vector(int bits1, Vector& v) { Scalar sum = 0; v.setValue(0, 0, 0); ! for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) { ! if (bits1 & bit) { ! sum += det[bits1][i]; ! v += y[i] * det[bits1][i]; } - } v *= 1 / sum; } --- 117,144 ---- { for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (all_bits & bit) { ! if (s & bit) ! { ! if (det[s][i] <= 0) return false; ! } ! else if (det[s|bit][i] > 0) return false; ! } } return true; } ! inline void compute_vector(int bits1, Vector& v) ! { Scalar sum = 0; v.setValue(0, 0, 0); ! for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (bits1 & bit) { ! sum += det[bits1][i]; ! v += y[i] * det[bits1][i]; ! } } v *= 1 / sum; } *************** *** 147,159 **** p2.setValue(0, 0, 0); for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (bits1 & bit) { ! // if the points are the same they cancel each other ! sum += det[bits1][i]; ! p1 += p[i] * det[bits1][i]; ! p2 += q[i] * det[bits1][i]; } - } Scalar s = 1 / sum; p1 *= s; --- 150,162 ---- p2.setValue(0, 0, 0); for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (bits1 & bit) { ! // if the points are the same they cancel each other ! sum += det[bits1][i]; ! p1 += p[i] * det[bits1][i]; ! p2 += q[i] * det[bits1][i]; ! } } Scalar s = 1 / sum; p1 *= s; *************** *** 212,227 **** } ! // The next function is used for detecting degenerate cases that cause ! // termination problems due to rounding errors. ! inline bool degenerate(const Vector& w) { for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! if ((all_bits & bit) && y[i] == w) return true; return false; } ! bool intersect(const Convex& a, const Convex& b, ! const Transform& a2w, const Transform& b2w, ! Vector& v) { Vector w; --- 215,248 ---- } ! /* ! The next function is used for detecting degenerate cases that cause ! termination problems due to rounding errors. ! It checks for duplicate points ! */ ! inline bool degenerate(const Vector& w) ! { for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if((all_bits & bit) && y[i] == w) return true; ! } return false; } ! /*! ! \brief Checks whether or not convex shapes A and B intersect ! \param a [IN] Convex Shape A ! \param b [IN] Convex Shape B ! \param a2w [IN] Transformation Matrix for A ! \param b2w [IN] Transformation Matrix for B ! \param v [OUT] Separating axis ! \note This is core of the GJK Algorithm ! */ ! bool intersect(const Convex& a, ! const Convex& b, ! const Transform& a2w, ! const Transform& b2w, ! Vector& v) ! { Vector w; *************** *** 236,249 **** last = 0; last_bit = 1; ! while (bits & last_bit) { ++last; last_bit <<= 1; } w = a2w(a.support((-v) * a2w.getBasis())) - b2w(b.support(v * b2w.getBasis())); if (dot(v, w) > 0) return false; ! if (degenerate(w)) { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } y[last] = w; all_bits = bits|last_bit; --- 257,273 ---- last = 0; last_bit = 1; ! while (bits & last_bit) ! { ++last; last_bit <<= 1; } ! w = a2w(a.support((-v) * a2w.getBasis())) - b2w(b.support(v * b2w.getBasis())); if (dot(v, w) > 0) return false; ! if (degenerate(w)) ! { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } y[last] = w; all_bits = bits|last_bit; *************** *** 251,261 **** ++num_iterations; #endif ! if (!closest(v)) { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } ! } while (bits < 15 && !approxZero(v)); return true; --- 275,286 ---- ++num_iterations; #endif ! if (!closest(v)) ! { #ifdef STATISTICS ! ++num_irregularities; #endif ! return false; ! } ! } while (bits < 15 && !approxZero(v)); return true; |
From: Rodrigo H. <kw...@us...> - 2005-05-11 23:31:13
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18467/libsolid Modified Files: BBoxTree.cpp C-api.cpp Complex.cpp Complex.h Convex.cpp Convex.h Object.cpp Object.h Transform.h Log Message: Added calls to opbject proceed on Smart Collision check Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Object.cpp 10 May 2005 03:46:23 -0000 1.6 --- Object.cpp 11 May 2005 23:31:04 -0000 1.7 *************** *** 74,78 **** } ! void Object::proceed() { prev = curr; } --- 74,79 ---- } ! void Object::proceed() ! { prev = curr; } *************** *** 186,191 **** { // If one (a) Shape is Complex ! // The Error with dtCollData must be in find_prim or closest_points ! fprintf(stdout,"Simplex vs Convex\n"); if (!find_prim((const Complex&)*a.shapePtr, (const Convex&)*b.shapePtr, --- 187,191 ---- { // If one (a) Shape is Complex ! // Find the primitive to which the convex shape is colliding with if (!find_prim((const Complex&)*a.shapePtr, (const Convex&)*b.shapePtr, *************** *** 193,196 **** --- 193,197 ---- return false; ((Complex *)a.shapePtr)->swapBase(); + // find the closest points between the primitive and the convex shape closest_points((const Convex&)*sa, (const Convex&)*b.shapePtr, Index: Transform.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Transform.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Transform.h 21 Apr 2005 23:20:55 -0000 1.2 --- Transform.h 11 May 2005 23:31:04 -0000 1.3 *************** *** 38,45 **** // Transform(const double m[16]) { setValue(m); } ! Point operator()(const Point& p) const { return Point(dot(basis[X], p) + origin[X], ! dot(basis[Y], p) + origin[Y], ! dot(basis[Z], p) + origin[Z]); } --- 38,50 ---- // Transform(const double m[16]) { setValue(m); } ! /*! \brief transforms a point ! \param p The point to transform ! \return The transformed point ! */ ! Point operator()(const Point& p) const ! { return Point(dot(basis[X], p) + origin[X], ! dot(basis[Y], p) + origin[Y], ! dot(basis[Z], p) + origin[Z]); } *************** *** 64,68 **** private: ! enum { IDENTITY = 0x00, TRANSLATION = 0x01, --- 69,74 ---- private: ! enum ! { IDENTITY = 0x00, TRANSLATION = 0x01, Index: Complex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Complex.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Complex.cpp 10 May 2005 03:46:23 -0000 1.3 --- Complex.cpp 11 May 2005 23:31:04 -0000 1.4 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 33,37 **** BBoxInternal *free_node; ! Complex::~Complex() { if (count >= 2) delete [] root; for (int i = 0; i < count; ++i) delete leaves[i].poly; --- 33,38 ---- BBoxInternal *free_node; ! Complex::~Complex() ! { if (count >= 2) delete [] root; for (int i = 0; i < count; ++i) delete leaves[i].poly; *************** *** 50,54 **** } ! void Complex::changeBase(const void *ptr) { base = ptr; for (int i = 0; i < count; ++i) leaves[i].fitBBox(); --- 51,56 ---- } ! void Complex::changeBase(const void *ptr) ! { base = ptr; for (int i = 0; i < count; ++i) leaves[i].fitBBox(); *************** *** 56,60 **** } ! void Complex::finish(int n, const Polytope **p) { proceed(); leaves = new BBoxLeaf[n]; --- 58,63 ---- } ! void Complex::finish(int n, const Polytope **p) ! { proceed(); leaves = new BBoxLeaf[n]; Index: Complex.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Complex.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Complex.h 10 May 2005 23:26:52 -0000 1.2 --- Complex.h 11 May 2005 23:31:04 -0000 1.3 *************** *** 43,47 **** class Complex : public Shape { public: ! Complex() {} ~Complex(); --- 43,55 ---- class Complex : public Shape { public: ! Complex() ! { ! // Lets not asume the compiler sets these for us, ! // VC++ in debug mode doesn't, this may give us a bit of overhead ! // when creating Complex shapes, but we won't be creating them as often ! // as vectors ! root = NULL; ! leaves = NULL; ! } ~Complex(); Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** C-api.cpp 11 May 2005 14:18:59 -0000 1.8 --- C-api.cpp 11 May 2005 23:31:04 -0000 1.9 *************** *** 348,351 **** --- 348,355 ---- Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); resp(e.obj1->ref, e.obj2->ref, p1, p2, v); + // Added these to see if there is any difference, + // and there is, but not quite what was expected, or is it?. + ((Object *)e.obj1)->proceed(); + ((Object *)e.obj2)->proceed(); return true; } *************** *** 427,432 **** if (prev_closest_points(*obj1, *obj2, sep_axis, p1, p2)) { ! Vector v = obj1->prev(p1) - obj2->prev(p2); ! resp(obj1->ref, obj2->ref, p1, p2, v); } break; --- 431,436 ---- if (prev_closest_points(*obj1, *obj2, sep_axis, p1, p2)) { ! Vector v = obj1->prev(p1) - obj2->prev(p2); ! resp(obj1->ref, obj2->ref, p1, p2, v); } break; Index: BBoxTree.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/BBoxTree.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BBoxTree.cpp 11 May 2005 14:18:58 -0000 1.5 --- BBoxTree.cpp 11 May 2005 23:31:04 -0000 1.6 *************** *** 151,156 **** const Transform& b2a, Vector& v, ShapePtr& p) { - // tree is invalid here, why on earth does GCC compiles proper code? - // am I missing something? I think it may be the runtime type checks if (!intersect(tree->bbox, bb)) return false; if (tree->tag == BBoxNode::LEAF) --- 151,154 ---- Index: Object.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Object.h 21 Apr 2005 23:20:55 -0000 1.2 --- Object.h 11 May 2005 23:31:04 -0000 1.3 *************** *** 82,85 **** --- 82,86 ---- */ Transform curr; + // prev seems to NEVER get set or updated, yet it does get used. Transform prev; DtObjectRef ref; Index: Convex.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Convex.h 10 May 2005 23:26:52 -0000 1.2 --- Convex.h 11 May 2005 23:31:04 -0000 1.3 *************** *** 38,41 **** --- 38,51 ---- virtual ~Convex() {} + /*! \brief Returns the support point for the convex shape + + The support point is the point that results from projecting a vector "v" + onto the surface of the shape. + In order to add new predefined convex shapes to FreeSOLID one mush create a class + derived from Convex and implement it's support function as well as add the apropiate + functions in C-api .cpp and .h + \param v vector to project + \return the support point + */ virtual Point support(const Vector& v) const = 0; virtual BBox bbox(const Transform& t) const; Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Convex.cpp 10 May 2005 03:45:11 -0000 1.4 --- Convex.cpp 11 May 2005 23:31:04 -0000 1.5 *************** *** 70,74 **** ! void compute_det() { static Scalar dp[4][4]; --- 70,75 ---- ! void compute_det() ! { static Scalar dp[4][4]; *************** *** 112,119 **** } ! inline bool valid(int s) { ! for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) { ! if (all_bits & bit) { ! if (s & bit) { if (det[s][i] <= 0) return false; } else if (det[s|bit][i] > 0) return false; } --- 113,126 ---- } ! inline bool valid(int s) ! { ! for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (all_bits & bit) ! { ! if (s & bit) ! { ! if (det[s][i] <= 0) return false; ! } else if (det[s|bit][i] > 0) return false; } *************** *** 134,143 **** } ! inline void compute_points(int bits1, Point& p1, Point& p2) { Scalar sum = 0; p1.setValue(0, 0, 0); p2.setValue(0, 0, 0); ! for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) { ! if (bits1 & bit) { sum += det[bits1][i]; p1 += p[i] * det[bits1][i]; --- 141,154 ---- } ! inline void compute_points(int bits1, Point& p1, Point& p2) ! { Scalar sum = 0; p1.setValue(0, 0, 0); p2.setValue(0, 0, 0); ! for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) ! { ! if (bits1 & bit) ! { ! // if the points are the same they cancel each other sum += det[bits1][i]; p1 += p[i] * det[bits1][i]; *************** *** 290,297 **** } - - - - bool common_point(const Convex& a, const Convex& b, const Transform& a2w, const Transform& b2w, --- 301,304 ---- *************** *** 387,394 **** void closest_points(const Convex& a, const Convex& b, const Transform& a2w, const Transform& b2w, ! Point& pa, Point& pb) { static Vector zero(0, 0, 0); ! Vector v = a2w(a.support(zero)) - b2w(b.support(zero)); Scalar dist = v.length(); --- 394,404 ---- void closest_points(const Convex& a, const Convex& b, const Transform& a2w, const Transform& b2w, ! Point& pa, Point& pb) ! { static Vector zero(0, 0, 0); ! // Transform a's support point relative to the origin as well ! // as b's, substract b's transformed support point from a's Vector v = a2w(a.support(zero)) - b2w(b.support(zero)); + // Find the distance from the origin to the point found. Scalar dist = v.length(); |
From: Rodrigo H. <kw...@us...> - 2005-05-11 23:31:13
|
Update of /cvsroot/freesolid/freesolid/sample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18467/sample Modified Files: walk.cpp Log Message: Added calls to opbject proceed on Smart Collision check Index: walk.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/walk.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** walk.cpp 10 May 2005 01:29:22 -0000 1.3 --- walk.cpp 11 May 2005 23:31:04 -0000 1.4 *************** *** 42,46 **** } Player; ! void LoadWorld(); void DrawWorld(); void DrawEllipsoid(float xradius, float yradius, float zradius); --- 42,46 ---- } Player; ! bool LoadWorld(); void DrawWorld(); void DrawEllipsoid(float xradius, float yradius, float zradius); *************** *** 87,96 **** object2.id = 2; ! LoadWorld(); ellipsoid = dtEllipsoid(player.radii[0],player.radii[1],player.radii[2]); dtCreateObject(&player, ellipsoid); dtCreateObject(&object2, world); ! dtDisableCaching(); dtSetDefaultResponse(CollideCallback, DT_SMART_RESPONSE, stdout); --- 87,98 ---- object2.id = 2; ! if (!LoadWorld()) return -1; ellipsoid = dtEllipsoid(player.radii[0],player.radii[1],player.radii[2]); + //ellipsoid = dtSphere(player.radii[2]); + //ellipsoid = dtBox(player.radii[0],player.radii[1],player.radii[2]); dtCreateObject(&player, ellipsoid); dtCreateObject(&object2, world); ! //dtDisableCaching(); dtSetDefaultResponse(CollideCallback, DT_SMART_RESPONSE, stdout); *************** *** 171,175 **** } ! void LoadWorld() { world = dtNewComplexShape(); --- 173,177 ---- } ! bool LoadWorld() { world = dtNewComplexShape(); *************** *** 183,187 **** // Quit if not found. ! if(!arg_s) { cout << "?????" <<endl;return;} // if no vertextree is declared, skip the lines --- 185,189 ---- // Quit if not found. ! if(!arg_s) { cout << "?????" <<endl;return false;} // if no vertextree is declared, skip the lines *************** *** 214,221 **** arg_s >> index >> ch; if (index >= 0) ! { ! dtVertexIndex(index); ! indexes.push_back(index); ! } } while (index >= 0); --- 216,223 ---- arg_s >> index >> ch; if (index >= 0) ! { ! dtVertexIndex(index); ! indexes.push_back(index); ! } } while (index >= 0); *************** *** 230,234 **** dtEndComplexShape(); fprintf(stdout, "done.\n"); ! } --- 232,236 ---- dtEndComplexShape(); fprintf(stdout, "done.\n"); ! return true; } |
From: Rodrigo H. <kw...@us...> - 2005-05-11 23:31:12
|
Update of /cvsroot/freesolid/freesolid/include/SOLID In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18467/include/SOLID Modified Files: solid.h Log Message: Added calls to opbject proceed on Smart Collision check Index: solid.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/include/SOLID/solid.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** solid.h 9 May 2005 04:10:18 -0000 1.5 --- solid.h 11 May 2005 23:31:04 -0000 1.6 *************** *** 47,51 **** DT_SIMPLE_RESPONSE, DT_SMART_RESPONSE, ! DT_WITNESSED_RESPONSE } DtResponseType; --- 47,51 ---- DT_SIMPLE_RESPONSE, DT_SMART_RESPONSE, ! DT_WITNESSED_RESPONSE, } DtResponseType; |
From: Rodrigo H. <kw...@us...> - 2005-05-11 23:31:12
|
Update of /cvsroot/freesolid/freesolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18467 Modified Files: FreeSOLID.sln Log Message: Added calls to opbject proceed on Smart Collision check Index: FreeSOLID.sln =================================================================== RCS file: /cvsroot/freesolid/freesolid/FreeSOLID.sln,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FreeSOLID.sln 10 May 2005 01:29:21 -0000 1.2 --- FreeSOLID.sln 11 May 2005 23:31:03 -0000 1.3 *************** *** 6,9 **** --- 6,10 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Walk", "Walk.vcproj", "{328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}" ProjectSection(ProjectDependencies) = postProject + {A8809DA4-2ADE-4948-80CD-CB766119CE5C} = {A8809DA4-2ADE-4948-80CD-CB766119CE5C} EndProjectSection EndProject |
From: Rodrigo H. <kw...@us...> - 2005-05-11 14:19:21
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27283/libsolid Modified Files: BBoxTree.cpp C-api.cpp Log Message: minor changes, none in code Index: BBoxTree.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/BBoxTree.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BBoxTree.cpp 10 May 2005 23:26:52 -0000 1.4 --- BBoxTree.cpp 11 May 2005 14:18:58 -0000 1.5 *************** *** 151,168 **** const Transform& b2a, Vector& v, ShapePtr& p) { ! //tree is invalid here, why on earth does GCC compiles proper code? ! // am I missing something? I think it may be the runtime type checks if (!intersect(tree->bbox, bb)) return false; ! if (tree->tag == BBoxNode::LEAF) { ! if (intersect(*((const BBoxLeaf *)tree)->poly, c, b2a, v)) { ! p = ((const BBoxLeaf *)tree)->poly; ! return true; } - else return false; - } - else { - return find_prim(((const BBoxInternal *)tree)->lson, c, bb, b2a, v, p) || - find_prim(((const BBoxInternal *)tree)->rson, c, bb, b2a, v, p); - } } --- 151,171 ---- const Transform& b2a, Vector& v, ShapePtr& p) { ! // tree is invalid here, why on earth does GCC compiles proper code? ! // am I missing something? I think it may be the runtime type checks if (!intersect(tree->bbox, bb)) return false; ! if (tree->tag == BBoxNode::LEAF) ! { ! if (intersect(*((const BBoxLeaf *)tree)->poly, c, b2a, v)) ! { ! p = ((const BBoxLeaf *)tree)->poly; ! return true; ! } ! else return false; ! } ! else ! { ! return find_prim(((const BBoxInternal *)tree)->lson, c, bb, b2a, v, p) || ! find_prim(((const BBoxInternal *)tree)->rson, c, bb, b2a, v, p); } } Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** C-api.cpp 10 May 2005 23:26:52 -0000 1.7 --- C-api.cpp 11 May 2005 14:18:59 -0000 1.8 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen *************** *** 329,362 **** static Point p1, p2; const Response& resp = respTable.find(e.obj1->ref, e.obj2->ref); ! switch (resp.type) { ! case DT_SIMPLE_RESPONSE: ! if (intersect(*e.obj1, *e.obj2, e.sep_axis)) { ! resp(e.obj1->ref, e.obj2->ref); ! return true; } - break; - case DT_SMART_RESPONSE: - fprintf(stdout,"object_test DT_SMART_RESPONSE\n"); - if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) - { - fprintf(stdout,"prev_closest_points returned true\n"); - fprintf(stdout,"Previous Points:\n%f,%f,%f\n%f,%f,%f\n", - e.obj1->prev(p1)[X],e.obj1->prev(p1)[Y],e.obj1->prev(p1)[Z], - e.obj2->prev(p2)[X],e.obj2->prev(p2)[Y],e.obj1->prev(p2)[Z]); - Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); - resp(e.obj1->ref, e.obj2->ref, p1, p2, v); - return true; - } - break; - case DT_WITNESSED_RESPONSE: - if (common_point(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) - { - resp(e.obj1->ref, e.obj2->ref, p1, p2, Vector(0, 0, 0)); - return true; - } - break; - default: - return false; - } return false; } --- 329,364 ---- static Point p1, p2; const Response& resp = respTable.find(e.obj1->ref, e.obj2->ref); ! switch (resp.type) ! { ! case DT_SIMPLE_RESPONSE: ! if (intersect(*e.obj1, *e.obj2, e.sep_axis)) ! { ! resp(e.obj1->ref, e.obj2->ref); ! return true; ! } ! break; ! case DT_SMART_RESPONSE: ! fprintf(stdout,"object_test DT_SMART_RESPONSE\n"); ! if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) ! { ! fprintf(stdout,"prev_closest_points returned true\n"); ! fprintf(stdout,"Previous Points:\n%f,%f,%f\n%f,%f,%f\n", ! e.obj1->prev(p1)[X],e.obj1->prev(p1)[Y],e.obj1->prev(p1)[Z], ! e.obj2->prev(p2)[X],e.obj2->prev(p2)[Y],e.obj1->prev(p2)[Z]); ! Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); ! resp(e.obj1->ref, e.obj2->ref, p1, p2, v); ! return true; ! } ! break; ! case DT_WITNESSED_RESPONSE: ! if (common_point(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) ! { ! resp(e.obj1->ref, e.obj2->ref, p1, p2, Vector(0, 0, 0)); ! return true; ! } ! break; ! default: ! return false; } return false; } |
From: Rodrigo H. <kw...@us...> - 2005-05-10 23:27:01
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24458/libsolid Modified Files: BBox.h BBoxTree.cpp C-api.cpp Complex.h Convex.h Log Message: Looking for the dtCallData Error Index: BBoxTree.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/BBoxTree.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BBoxTree.cpp 21 Apr 2005 23:20:55 -0000 1.3 --- BBoxTree.cpp 10 May 2005 23:26:52 -0000 1.4 *************** *** 149,155 **** bool find_prim(const BBoxNode *tree, const Convex& c, const BBox& bb, ! const Transform& b2a, Vector& v, ShapePtr& p) { ! if (!intersect(tree->bbox, bb)) return false; ! if (tree->tag == BBoxNode::LEAF) { if (intersect(*((const BBoxLeaf *)tree)->poly, c, b2a, v)) { --- 149,157 ---- bool find_prim(const BBoxNode *tree, const Convex& c, const BBox& bb, ! const Transform& b2a, Vector& v, ShapePtr& p) ! { ! //tree is invalid here, why on earth does GCC compiles proper code? ! // am I missing something? I think it may be the runtime type checks ! if (!intersect(tree->bbox, bb)) return false; if (tree->tag == BBoxNode::LEAF) { if (intersect(*((const BBoxLeaf *)tree)->poly, c, b2a, v)) { Index: BBox.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/BBox.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BBox.h 21 Apr 2005 23:20:55 -0000 1.3 --- BBox.h 10 May 2005 23:26:52 -0000 1.4 *************** *** 87,91 **** }; ! inline bool intersect(const BBox& a, const BBox& b) { return fabs(a.center[X] - b.center[X]) <= a.extent[X] + b.extent[X] && fabs(a.center[Y] - b.center[Y]) <= a.extent[Y] + b.extent[Y] && --- 87,92 ---- }; ! inline bool intersect(const BBox& a,const BBox& b) ! { return fabs(a.center[X] - b.center[X]) <= a.extent[X] + b.extent[X] && fabs(a.center[Y] - b.center[Y]) <= a.extent[Y] + b.extent[Y] && Index: Complex.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Complex.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Complex.h 21 Oct 2002 21:53:16 -0000 1.1.1.1 --- Complex.h 10 May 2005 23:26:52 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** C-api.cpp 10 May 2005 03:45:11 -0000 1.6 --- C-api.cpp 10 May 2005 23:26:52 -0000 1.7 *************** *** 86,91 **** extern Scalar rel_error; - extern "C" - { DtShapeRef dtBox(DT_Scalar x,DT_Scalar y,DT_Scalar z) { return (DtShapeRef)new Box(x,y,z); --- 86,89 ---- *************** *** 324,327 **** --- 322,328 ---- void dtSetTolerance(DT_Scalar tol) { rel_error = tol; } + /*! \brief tests 2 objects for collision + \param e data about the 2 colliding objects + */ bool object_test(Encounter& e) { *************** *** 349,356 **** break; case DT_WITNESSED_RESPONSE: ! if (common_point(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) { ! resp(e.obj1->ref, e.obj2->ref, p1, p2, Vector(0, 0, 0)); ! return true; ! } break; default: --- 350,358 ---- break; case DT_WITNESSED_RESPONSE: ! if (common_point(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) ! { ! resp(e.obj1->ref, e.obj2->ref, p1, p2, Vector(0, 0, 0)); ! return true; ! } break; default: *************** *** 360,384 **** } ! DT_Count dtTest() { ! DT_Count cnt = 0; ! if (caching) { for (ObjectList::const_iterator j = objectList.begin(); ! j != objectList.end(); ++j) { ! (*j).second->do_broadphase(); ! } ! for (ProxList::iterator i = proxList.begin(); i != proxList.end(); ++i) ! if (object_test((Encounter &)*i)) ++cnt; ! } ! else { ! int c=0; ! for (ObjectList::const_iterator j = objectList.begin(); ! j != objectList.end(); ++j) ! for (ObjectList::const_iterator i = objectList.begin(); ! i != j; ++i) { ! Encounter e((*i).second, (*j).second); ! c++; ! if (object_test(e)) ++cnt; ! } ! } return cnt; } --- 362,391 ---- } ! DT_Count dtTest() ! { ! DT_Count cnt = 0; ! if (caching) ! { for (ObjectList::const_iterator j = objectList.begin(); ! j != objectList.end(); ++j) ! { ! (*j).second->do_broadphase(); ! } ! for (ProxList::iterator i = proxList.begin(); i != proxList.end(); ++i) ! if (object_test((Encounter &)*i)) ++cnt; ! } ! else ! { ! int c=0; ! for (ObjectList::const_iterator j = objectList.begin(); ! j != objectList.end(); ++j) ! for (ObjectList::const_iterator i = objectList.begin(); ! i != j; ++i) ! { ! Encounter e((*i).second, (*j).second); ! c++; ! if (object_test(e)) ++cnt; ! } ! } return cnt; } *************** *** 416,420 **** break; case DT_SMART_RESPONSE: - fprintf(stdout,"dtTestObjects DT_SMART_RESPONSE\n"); if (prev_closest_points(*obj1, *obj2, sep_axis, p1, p2)) { --- 423,426 ---- *************** *** 429,431 **** } } - } --- 435,436 ---- Index: Convex.h =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Convex.h 21 Oct 2002 21:53:10 -0000 1.1.1.1 --- Convex.h 10 May 2005 23:26:52 -0000 1.2 *************** *** 1,4 **** /* ! SOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen --- 1,4 ---- /* ! FreeSOLID - Software Library for Interference Detection Copyright (C) 1997-1998 Gino van den Bergen |
From: Rodrigo H. <kw...@us...> - 2005-05-10 23:27:00
|
Update of /cvsroot/freesolid/freesolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24458 Modified Files: FreeSOLID.vcproj Walk.vcproj Log Message: Looking for the dtCallData Error Index: Walk.vcproj =================================================================== RCS file: /cvsroot/freesolid/freesolid/Walk.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Walk.vcproj 10 May 2005 01:29:21 -0000 1.1 --- Walk.vcproj 10 May 2005 23:26:52 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- BasicRuntimeChecks="3" RuntimeLibrary="2" + RuntimeTypeInfo="FALSE" UsePrecompiledHeader="0" WarningLevel="3" Index: FreeSOLID.vcproj =================================================================== RCS file: /cvsroot/freesolid/freesolid/FreeSOLID.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FreeSOLID.vcproj 10 May 2005 01:29:21 -0000 1.2 --- FreeSOLID.vcproj 10 May 2005 23:26:52 -0000 1.3 *************** *** 24,28 **** MinimalRebuild="TRUE" BasicRuntimeChecks="3" ! RuntimeLibrary="1" UsePrecompiledHeader="0" WarningLevel="3" --- 24,29 ---- MinimalRebuild="TRUE" BasicRuntimeChecks="3" ! RuntimeLibrary="5" ! RuntimeTypeInfo="FALSE" UsePrecompiledHeader="0" WarningLevel="3" *************** *** 69,73 **** <Tool Name="VCCLCompilerTool" ! PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESOLID_EXPORTS" RuntimeLibrary="0" UsePrecompiledHeader="0" --- 70,75 ---- <Tool Name="VCCLCompilerTool" ! AdditionalIncludeDirectories=".\qhull\src;.\libbroad;.\libmoto;.\include" ! PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESOLID_EXPORTS;DLL_EXPORT;USE_QHULL" RuntimeLibrary="0" UsePrecompiledHeader="0" |
From: Rodrigo H. <kw...@us...> - 2005-05-10 03:46:32
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16454/libsolid Modified Files: Complex.cpp Object.cpp Log Message: Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Object.cpp 10 May 2005 03:45:11 -0000 1.5 --- Object.cpp 10 May 2005 03:46:23 -0000 1.6 *************** *** 186,189 **** --- 186,190 ---- { // If one (a) Shape is Complex + // The Error with dtCollData must be in find_prim or closest_points fprintf(stdout,"Simplex vs Convex\n"); if (!find_prim((const Complex&)*a.shapePtr, Index: Complex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Complex.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Complex.cpp 11 Jan 2003 18:22:45 -0000 1.2 --- Complex.cpp 10 May 2005 03:46:23 -0000 1.3 *************** *** 90,93 **** --- 90,95 ---- } + /* \brief Find primitive? + */ bool find_prim(const Complex& a, const Convex& b, const Transform& a2w, const Transform& b2w, |
From: Rodrigo H. <kw...@us...> - 2005-05-10 03:45:21
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16263/libsolid Modified Files: C-api.cpp Convex.cpp Object.cpp Log Message: Trying to solve dtCollideData Issue Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Object.cpp 10 May 2005 01:29:22 -0000 1.4 --- Object.cpp 10 May 2005 03:45:11 -0000 1.5 *************** *** 146,149 **** --- 146,157 ---- } + /*! \brief I THINK this returns closest points from last test + \param a Object A to test against B ? + \param b Object B to test against A ? + \param v No idea. + \param pa Point in A? + \param pb Point in B? + \returns true if a collision was detected and false if not. + */ bool prev_closest_points(const Object& a, const Object& b, Vector& v, Point& pa, Point& pb) *************** *** 178,181 **** --- 186,190 ---- { // If one (a) Shape is Complex + fprintf(stdout,"Simplex vs Convex\n"); if (!find_prim((const Complex&)*a.shapePtr, (const Convex&)*b.shapePtr, Index: C-api.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/C-api.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** C-api.cpp 9 May 2005 04:10:18 -0000 1.5 --- C-api.cpp 10 May 2005 03:45:11 -0000 1.6 *************** *** 324,328 **** void dtSetTolerance(DT_Scalar tol) { rel_error = tol; } ! bool object_test(Encounter& e) { static Point p1, p2; const Response& resp = respTable.find(e.obj1->ref, e.obj2->ref); --- 324,329 ---- void dtSetTolerance(DT_Scalar tol) { rel_error = tol; } ! bool object_test(Encounter& e) ! { static Point p1, p2; const Response& resp = respTable.find(e.obj1->ref, e.obj2->ref); *************** *** 335,343 **** break; case DT_SMART_RESPONSE: ! if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) { ! Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); ! resp(e.obj1->ref, e.obj2->ref, p1, p2, v); ! return true; ! } break; case DT_WITNESSED_RESPONSE: --- 336,350 ---- break; case DT_SMART_RESPONSE: ! fprintf(stdout,"object_test DT_SMART_RESPONSE\n"); ! if (prev_closest_points(*e.obj1, *e.obj2, e.sep_axis, p1, p2)) ! { ! fprintf(stdout,"prev_closest_points returned true\n"); ! fprintf(stdout,"Previous Points:\n%f,%f,%f\n%f,%f,%f\n", ! e.obj1->prev(p1)[X],e.obj1->prev(p1)[Y],e.obj1->prev(p1)[Z], ! e.obj2->prev(p2)[X],e.obj2->prev(p2)[Y],e.obj1->prev(p2)[Z]); ! Vector v = e.obj1->prev(p1) - e.obj2->prev(p2); ! resp(e.obj1->ref, e.obj2->ref, p1, p2, v); ! return true; ! } break; case DT_WITNESSED_RESPONSE: *************** *** 409,416 **** break; case DT_SMART_RESPONSE: ! if (prev_closest_points(*obj1, *obj2, sep_axis, p1, p2)) { ! Vector v = obj1->prev(p1) - obj2->prev(p2); ! resp(obj1->ref, obj2->ref, p1, p2, v); ! } break; case DT_WITNESSED_RESPONSE: --- 416,425 ---- break; case DT_SMART_RESPONSE: ! fprintf(stdout,"dtTestObjects DT_SMART_RESPONSE\n"); ! if (prev_closest_points(*obj1, *obj2, sep_axis, p1, p2)) ! { ! Vector v = obj1->prev(p1) - obj2->prev(p2); ! resp(obj1->ref, obj2->ref, p1, p2, v); ! } break; case DT_WITNESSED_RESPONSE: Index: Convex.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Convex.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Convex.cpp 21 Apr 2005 23:20:55 -0000 1.3 --- Convex.cpp 10 May 2005 03:45:11 -0000 1.4 *************** *** 383,387 **** #endif ! void closest_points(const Convex& a, const Convex& b, const Transform& a2w, const Transform& b2w, --- 383,388 ---- #endif ! /*! \brief Gets the closest points to each of the shapes ? ! */ void closest_points(const Convex& a, const Convex& b, const Transform& a2w, const Transform& b2w, |
From: Rodrigo H. <kw...@us...> - 2005-05-10 01:29:31
|
Update of /cvsroot/freesolid/freesolid/libsolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23294/libsolid Modified Files: Object.cpp Log Message: More on Walk sample Index: Object.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/libsolid/Object.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Object.cpp 21 Apr 2005 18:29:23 -0000 1.3 --- Object.cpp 10 May 2005 01:29:22 -0000 1.4 *************** *** 147,175 **** bool prev_closest_points(const Object& a, const Object& b, ! Vector& v, Point& pa, Point& pb) { ShapePtr sa, sb; ! if (a.shapePtr->getType() == COMPLEX) { ! if (b.shapePtr->getType() == COMPLEX) { ! if (!find_prim((const Complex&)*a.shapePtr, (const Complex&)*b.shapePtr, ! a.curr, b.curr, v, sa, sb)) return false; ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ((Complex *)b.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, (const Convex&)*sb, a.prev, b.prev, pa, pb); ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ((Complex *)b.shapePtr)->swapBase(); ! } ! else { ! if (!find_prim((const Complex&)*a.shapePtr, (const Convex&)*b.shapePtr, ! a.curr, b.curr, v, sa)) return false; ! ((Complex *)a.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, (const Convex&)*b.shapePtr, a.prev, b.prev, pa, pb); ! ((Complex *)a.shapePtr)->swapBase(); } ! } ! else { ! if (!intersect(a, b, v)) return false; ! closest_points((const Convex&)*a.shapePtr, (const Convex&)*b.shapePtr, a.prev, b.prev, pa, pb); ! } ! return true; } --- 147,203 ---- bool prev_closest_points(const Object& a, const Object& b, ! Vector& v, Point& pa, Point& pb) ! { ShapePtr sa, sb; ! if (a.shapePtr->getType() == COMPLEX) ! { ! if (b.shapePtr->getType() == COMPLEX) ! { ! // If both shapes are complex ! if (!find_prim((const Complex&)*a.shapePtr, ! (const Complex&)*b.shapePtr, ! a.curr, ! b.curr, ! v, ! sa, ! sb)) return false; ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ! ((Complex *)b.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, ! (const Convex&)*sb, ! a.prev, ! b.prev, ! pa, ! pb); ! ((Complex *)a.shapePtr)->swapBase(); ! if (b.shapePtr != a.shapePtr) ! ((Complex *)b.shapePtr)->swapBase(); ! } ! else ! { ! // If one (a) Shape is Complex ! if (!find_prim((const Complex&)*a.shapePtr, ! (const Convex&)*b.shapePtr, ! a.curr, b.curr, v, sa)) ! return false; ! ((Complex *)a.shapePtr)->swapBase(); ! closest_points((const Convex&)*sa, ! (const Convex&)*b.shapePtr, ! a.prev, ! b.prev, ! pa, ! pb); ! ((Complex *)a.shapePtr)->swapBase(); ! } } ! else ! { ! // if both are simplex ! if (!intersect(a, b, v)) return false; ! closest_points((const Convex&)*a.shapePtr, ! (const Convex&)*b.shapePtr, ! a.prev, b.prev, pa, pb); ! } return true; } |
From: Rodrigo H. <kw...@us...> - 2005-05-10 01:29:31
|
Update of /cvsroot/freesolid/freesolid/sample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23294/sample Modified Files: walk.cpp Log Message: More on Walk sample Index: walk.cpp =================================================================== RCS file: /cvsroot/freesolid/freesolid/sample/walk.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** walk.cpp 9 May 2005 23:40:17 -0000 1.2 --- walk.cpp 10 May 2005 01:29:22 -0000 1.3 *************** *** 52,59 **** const DtCollData *coll_data) { ! fprintf(stdout,"Collided Point 1 %f,%f,%f Point 2 %f,%f,%f Normal %f,%f,%f\n", ! coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); } --- 52,62 ---- const DtCollData *coll_data) { ! if(coll_data!=NULL) ! { ! fprintf(stdout,"Collided Point 1 %f,%f,%f\nPoint 2 %f,%f,%f\nNormal %f,%f,%f\n", ! coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! coll_data->point1[X],coll_data->point1[Y],coll_data->point1[Z], ! coll_data->normal[X],coll_data->normal[Y],coll_data->normal[Z]); ! } } *************** *** 131,134 **** --- 134,139 ---- sphereqobj = gluNewQuadric(); + dtDisableCaching(); + while(bRunning) { |
From: Rodrigo H. <kw...@us...> - 2005-05-10 01:29:30
|
Update of /cvsroot/freesolid/freesolid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23294 Modified Files: FreeSOLID.sln FreeSOLID.vcproj Added Files: Walk.vcproj Log Message: More on Walk sample Index: FreeSOLID.sln =================================================================== RCS file: /cvsroot/freesolid/freesolid/FreeSOLID.sln,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FreeSOLID.sln 21 Apr 2005 22:08:37 -0000 1.1 --- FreeSOLID.sln 10 May 2005 01:29:21 -0000 1.2 *************** *** 4,7 **** --- 4,11 ---- EndProjectSection EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Walk", "Walk.vcproj", "{328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection + EndProject Global GlobalSection(SolutionConfiguration) = preSolution *************** *** 14,17 **** --- 18,25 ---- {A8809DA4-2ADE-4948-80CD-CB766119CE5C}.Release.ActiveCfg = Release|Win32 {A8809DA4-2ADE-4948-80CD-CB766119CE5C}.Release.Build.0 = Release|Win32 + {328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}.Debug.ActiveCfg = Debug|Win32 + {328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}.Debug.Build.0 = Debug|Win32 + {328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}.Release.ActiveCfg = Release|Win32 + {328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution --- NEW FILE: Walk.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="Walk" ProjectGUID="{328CC121-0DA2-44B4-93A7-3ED6ECD31B5E}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="4"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="SDLmain.lib SDL.lib OpenGL32.lib Glu32.lib $(OutDir)/FreeSOLID.lib" OutputFile="$(OutDir)/Walk.exe" LinkIncremental="2" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/Walk.pdb" SubSystem="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="4" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/Walk.exe" LinkIncremental="1" GenerateDebugInformation="TRUE" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> <File RelativePath=".\sample\walk.cpp"> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> </Filter> <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> Index: FreeSOLID.vcproj =================================================================== RCS file: /cvsroot/freesolid/freesolid/FreeSOLID.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FreeSOLID.vcproj 21 Apr 2005 22:08:37 -0000 1.1 --- FreeSOLID.vcproj 10 May 2005 01:29:21 -0000 1.2 *************** *** 150,153 **** --- 150,156 ---- </File> <File + RelativePath=".\libsolid\Ellipsoid.cpp"> + </File> + <File RelativePath=".\libmoto\GEN_random.cpp"> </File> *************** *** 285,288 **** --- 288,294 ---- </File> <File + RelativePath=".\libsolid\Ellipsoid.h"> + </File> + <File RelativePath=".\libsolid\Encounter.h"> </File> |