From fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd Mon Sep 17 00:00:00 2001 From: dan miller Date: Fri, 19 Oct 2007 05:20:07 +0000 Subject: dont ask --- libraries/ode-0.9/ode/demo/demo_feedback.cpp | 314 --------------------------- 1 file changed, 314 deletions(-) delete mode 100644 libraries/ode-0.9/ode/demo/demo_feedback.cpp (limited to 'libraries/ode-0.9/ode/demo/demo_feedback.cpp') diff --git a/libraries/ode-0.9/ode/demo/demo_feedback.cpp b/libraries/ode-0.9/ode/demo/demo_feedback.cpp deleted file mode 100644 index fd49278..0000000 --- a/libraries/ode-0.9/ode/demo/demo_feedback.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/************************************************************************* - * * - * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * - * All rights reserved. Email: russ@q12.org Web: www.q12.org * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of EITHER: * - * (1) The GNU Lesser General Public License as published by the Free * - * Software Foundation; either version 2.1 of the License, or (at * - * your option) any later version. The text of the GNU Lesser * - * General Public License is included with this library in the * - * file LICENSE.TXT. * - * (2) The BSD-style license that is included with this library in * - * the file LICENSE-BSD.TXT. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * - * LICENSE.TXT and LICENSE-BSD.TXT for more details. * - * * - *************************************************************************/ - -// Test for breaking joints, by Bram Stolk - -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include - - -#ifdef _MSC_VER -#pragma warning(disable:4244 4305) // for VC++, no precision loss complaints -#endif - -#ifdef dDOUBLE -#define dsDrawBox dsDrawBoxD -#define dsDrawCylinder dsDrawCylinderD -#endif - - -// dynamics and collision objects (chassis, 3 wheels, environment) - -static dWorldID world; -static dSpaceID space; - -static const int STACKCNT=10; // nr of weights on bridge -static const int SEGMCNT=16; // nr of segments in bridge -static const float SEGMDIM[3] = { 0.9, 4, 0.1 }; - -static dGeomID groundgeom; -static dBodyID segbodies[SEGMCNT]; -static dGeomID seggeoms[SEGMCNT]; -static dBodyID stackbodies[STACKCNT]; -static dGeomID stackgeoms[STACKCNT]; -static dJointID hinges[SEGMCNT-1]; -static dJointID sliders[2]; -static dJointFeedback jfeedbacks[SEGMCNT-1]; -static dReal colours[SEGMCNT]; -static int stress[SEGMCNT-1]; - -static dJointGroupID contactgroup; - - -// this is called by dSpaceCollide when two objects in space are -// potentially colliding. - -static void nearCallback (void *data, dGeomID o1, dGeomID o2) -{ - assert(o1); - assert(o2); - - if (dGeomIsSpace(o1) || dGeomIsSpace(o2)) - { - fprintf(stderr,"testing space %p %p\n", o1,o2); - // colliding a space with something - dSpaceCollide2(o1,o2,data,&nearCallback); - // Note we do not want to test intersections within a space, - // only between spaces. - return; - } - - const int N = 32; - dContact contact[N]; - int n = dCollide (o1,o2,N,&(contact[0].geom),sizeof(dContact)); - if (n > 0) - { - for (int i=0; i forcelimit || l1 > forcelimit) - stress[i]++; - else - stress[i]=0; - if (stress[i]>4) - { - // Low-pass filter the noisy feedback data. - // Only after 4 consecutive timesteps with excessive load, snap. - fprintf(stderr,"SNAP! (that was the sound of joint %d breaking)\n", i); - dJointAttach (hinges[i], 0, 0); - } - } - } -} - - -// simulation loop - -static void simLoop (int pause) -{ - int i; - - double simstep = 0.005; // 5ms simulation steps - double dt = dsElapsedTime(); - int nrofsteps = (int) ceilf(dt/simstep); - for (i=0; i1.0) v=1.0; - if (v<0.5) - { - r=2*v; - g=1.0; - } - else - { - r=1.0; - g=2*(1.0-v); - } - dsSetColor (r,g,b); - drawGeom(seggeoms[i]); - } - dsSetColor (1,1,1); - for (i=0; i