Thread: [Opal-commits] opal/src Mass.h,NONE,1.1 Point3r.cpp,NONE,1.1 BlueprintManager.cpp,1.43,1.44 Defines.
Status: Inactive
Brought to you by:
tylerstreeter
|
From: Olex <ole...@us...> - 2005-12-01 02:05:05
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9152/src Modified Files: BlueprintManager.cpp Defines.h Makefile.am Makefile.in Point3r.h Simulator.cpp Solid.h Vec3r.cpp opal.h testRaycastSensor.cpp testsolid.cpp Added Files: Mass.h Point3r.cpp Log Message: Implemented Solid::setMass, added unit tests to test it. Added missing Point3r implementation file. Index: opal.h =================================================================== RCS file: /cvsroot/opal/opal/src/opal.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** opal.h 26 Nov 2005 22:40:18 -0000 1.29 --- opal.h 1 Dec 2005 02:04:54 -0000 1.30 *************** *** 37,40 **** --- 37,41 ---- #include "CapsuleShapeData.h" #include "PlaneShapeData.h" + #include "Mass.h" #include "MeshShapeData.h" #include "Motor.h" Index: Makefile.in =================================================================== RCS file: /cvsroot/opal/opal/src/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 30 Nov 2005 06:28:12 -0000 1.4 --- Makefile.in 1 Dec 2005 02:04:54 -0000 1.5 *************** *** 217,221 **** $(top_builddir)/src/ODE/libodeimpl.a $(top_builddir)/src/libopalode.a -lode ! noinst_HEADERS = Mass.h Matrix33r.h all: all-recursive --- 217,221 ---- $(top_builddir)/src/ODE/libodeimpl.a $(top_builddir)/src/libopalode.a -lode ! noinst_HEADERS = Mass.h all: all-recursive Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Defines.h 30 Nov 2005 06:28:12 -0000 1.78 --- Defines.h 1 Dec 2005 02:04:54 -0000 1.79 *************** *** 243,247 **** /// The highest value that can be used for the Simulator's /// max contacts parameter. ! const int maxMaxContacts=(int)128; // Pre-defined material settings --- 243,247 ---- /// The highest value that can be used for the Simulator's /// max contacts parameter. ! const unsigned int maxMaxContacts=(int)128; // Pre-defined material settings Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Simulator.cpp 26 Nov 2005 22:40:18 -0000 1.67 --- Simulator.cpp 1 Dec 2005 02:04:54 -0000 1.68 *************** *** 1,28 **** /************************************************************************* ! * * ! * Open Physics Abstraction Layer * ! * Copyright (C) 2004-2005 * ! * Alan Fischer ala...@gm... * ! * Andres Reinot an...@re... * ! * Tyler Streeter tyl...@gm... * ! * All rights reserved. * ! * Web: opal.sourceforge.net * ! * * [...2090 lines suppressed...] --- 1057,1075 ---- } ! void Simulator::destroyGarbage() ! { ! // Destroy garbage Solids. ! while ( !mSolidGarbageList.empty() ) ! { ! destroySolid( mSolidGarbageList.back() ); ! mSolidGarbageList.pop_back(); ! } ! // Destroy garbage Joints. ! while ( !mJointGarbageList.empty() ) ! { ! destroyJoint( mJointGarbageList.back() ); ! mJointGarbageList.pop_back(); ! } ! } } Index: testRaycastSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/testRaycastSensor.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testRaycastSensor.cpp 26 Nov 2005 22:40:18 -0000 1.2 --- testRaycastSensor.cpp 1 Dec 2005 02:04:54 -0000 1.3 *************** *** 118,122 **** RaycastResult r = f.sensor->fireRay( 500 ); Point3r hitPoint = r.intersection; ! Solid * hit = r.solid; real diff = r.distance; --- 118,122 ---- RaycastResult r = f.sensor->fireRay( 500 ); Point3r hitPoint = r.intersection; ! //Solid * hit = r.solid; real diff = r.distance; Index: Vec3r.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Vec3r.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Vec3r.cpp 30 Nov 2005 06:28:12 -0000 1.1 --- Vec3r.cpp 1 Dec 2005 02:04:54 -0000 1.2 *************** *** 89,93 **** return z; default: ! assert( i < 3 && i > -1 ); } } --- 89,94 ---- return z; default: ! assert( i < 3 ); ! return z; } } *************** *** 104,108 **** return z; default: ! assert( i < 3 && i > -1 ); } } --- 105,110 ---- return z; default: ! assert( i < 3 ); ! return z; } } Index: testsolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/testsolid.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testsolid.cpp 15 Nov 2005 03:32:43 -0000 1.3 --- testsolid.cpp 1 Dec 2005 02:04:54 -0000 1.4 *************** *** 205,207 **** --- 205,225 ---- QT_CHECK_EQUAL( current, m ); } + + QT_TEST( setMass_default ) + { + SolidBoxFixture f; + Matrix44r m = f.s->getInertiaTensor(); + + Mass mass; + f.s->setMass( mass, Matrix44r() ); + + Matrix44r m_set = f.s->getInertiaTensor(); + QT_CHECK_EQUAL( m, m_set ); + QT_CHECK_CLOSE( f.s->getMass(), mass.mass, 0.001 ); + + mass.mass = 2; + f.s->setMass( mass, Matrix44r() ); + + QT_CHECK_CLOSE( f.s->getMass(), mass.mass, 0.001 ); + } } --- NEW FILE: Point3r.cpp --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * Oleksandr Lozitskiy mr....@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ // project headers #include "Point3r.h" namespace opal { } Index: Solid.h =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.h,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** Solid.h 6 Nov 2005 05:12:21 -0000 1.92 --- Solid.h 1 Dec 2005 02:04:54 -0000 1.93 *************** *** 35,38 **** --- 35,39 ---- namespace opal { + class Mass; class Simulator; class Space; *************** *** 195,198 **** --- 196,202 ---- virtual Vec3r OPAL_CALL getGlobalAngularVel()const = 0; + /// Set a new mass, center, and intertia for the solid. + virtual void OPAL_CALL setMass( const Mass & newmass, const Matrix44r & offset ) = 0; + /// Translate the Solid's mass using the given offset vector /// specified in global coordinates. --- NEW FILE: Mass.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * Oleksandr Lozitskiy mr....@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_MASS_H #define OPAL_MASS_H // project headers #include "Matrix44r.h" #include "OpalMath.h" #include "Vec3r.h" namespace opal { class Mass { public: /// Default values are set Mass() { mass = 1; center = Vec3r( 0, 0, 0 ); inertia.makeIdentity(); inertia[ 0 ] = 1 / 6.0; inertia[ 5 ] = 1 / 6.0; inertia[ 10 ] = 1 / 6.0; } /// Total mass of the rigid body /// Default is 1 real mass; /// Center of gravity position in body frame (x,y,z). /// Default is (0,0,0) Vec3r center; /// 3x3 inertia tensor in body frame, about POR /// Default is inertia of a box Matrix44r inertia; }; } #endif Index: Point3r.h =================================================================== RCS file: /cvsroot/opal/opal/src/Point3r.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Point3r.h 30 Nov 2005 06:28:12 -0000 1.14 --- Point3r.h 1 Dec 2005 02:04:54 -0000 1.15 *************** *** 114,118 **** return z; default: ! assert( i < 3 && i > -1 ); } } --- 114,119 ---- return z; default: ! assert( i < 3 ); ! return z; } } *************** *** 129,133 **** return z; default: ! assert( i < 3 && i > -1 ); } } --- 130,135 ---- return z; default: ! assert( i < 3 ); ! return z; } } Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** BlueprintManager.cpp 24 Jun 2005 17:50:48 -0000 1.43 --- BlueprintManager.cpp 1 Dec 2005 02:04:54 -0000 1.44 *************** *** 1,28 **** /************************************************************************* ! * * ! * Open Physics Abstraction Layer * ! * Copyright (C) 2004-2005 * ! * Alan Fischer ala...@gm... * ! * Andres Reinot an...@re... * ! * Tyler Streeter tyl...@gm... * ! * All rights reserved. * ! * Web: opal.sourceforge.net * ! * * [...3123 lines suppressed...] ! TiXmlElement * elementPtr = ! const_cast<TiXmlNode*>( nodePtr ) ->ToElement(); ! const char* temp = elementPtr->Attribute( name.c_str() ); ! if ( NULL == temp ) ! { ! OPAL_LOGGER( "warning" ) << ! "opal::BlueprintManager::getAttributeString: Element " ! << nodePtr->Value() << " is missing attribute '" ! << name << "'. Parameter will be set to \"\"." ! << std::endl; ! return ""; ! } ! else ! { ! return temp; ! } ! } ! } } Index: Makefile.am =================================================================== RCS file: /cvsroot/opal/opal/src/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 30 Nov 2005 06:28:12 -0000 1.4 --- Makefile.am 1 Dec 2005 02:04:54 -0000 1.5 *************** *** 18,20 **** test_opal_LDADD = $(top_builddir)/src/external/tinyxml/libtinyxml.a \ $(top_builddir)/src/ODE/libodeimpl.a $(top_builddir)/src/libopalode.a -lode ! noinst_HEADERS = Mass.h Matrix33r.h --- 18,20 ---- test_opal_LDADD = $(top_builddir)/src/external/tinyxml/libtinyxml.a \ $(top_builddir)/src/ODE/libodeimpl.a $(top_builddir)/src/libopalode.a -lode ! noinst_HEADERS = Mass.h |