Biomechanical Joint Model
 Author: Anderson Maciel

comecollide.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002 by Anderson Maciel                                 *
00003  *   andi.maciel@gmail.com                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  **************************************************************************/
00020 
00031 
00032 #ifndef __COMECOLLIDE_H
00033 #define __COMECOLLIDE_H
00034 
00035 #ifndef __COME_SCENARIO_H
00036 class COME_Scenario;
00037 #endif
00038 
00039 #include <general/come.h>
00040 #include <physics/comecollision.h>
00041 #include <bio/comebiostructure.h>
00042 #include <physics/comeproximity.h>
00043 
00044 
00045 struct COME_2ndPassItem{
00046         
00047         COME_Vertex3D   *innerV;
00048         COME_Face       *otherF;
00049 };
00050 
00051 
00059 
00060 class COME_Collide : public COME{
00061 
00062 protected:
00063         
00064         vector<COME_Collision>          collisions;
00065         int                                             collisions1stLevel; // used to determine which pairs of objects potentially collide
00066         vector<COME_2ndPassItem>        vector2ndPass;
00067         
00068         vector<COME_Proximity>          proximityStructure;
00069         
00070 public:
00071         
00072         COME_Collide( COME_Scenario* scene );   
00073         ~COME_Collide();
00074 
00075         void    detectContacts();
00076         bool    detectContactsDisplacement();
00077         void    detectContacts( COME_BioStructure* organ1, COME_BioStructure* organ2 );
00078         void    detectContactsHybrid( COME_BioStructure* organ1, COME_BioStructure* organ2 );
00079         bool    detectContactsDisplacement( COME_BioStructure* organ1, COME_BioStructure* organ2 );
00080         void    resetCollisions();
00081         void    treatCollisions();
00082 
00083         void                    setCollisions1stLevel( int detectionType );
00084         int                     getNumberOfCollisions() const;
00085         vector<COME_Collision>  getCollisions() const;
00086         int                     getCollisions1stLevel() const;
00087         
00088         bool    isNotAlreadyIn(vector<int> group, int part);
00089         double  findMinProjection(COME_Vector3D dir, COME_Vertex3D base, COME_Molecule* nearestMol, vector<int> faces, COME_Mesh* mesh);
00090         double  findMaxProjection(COME_Vector3D dir, COME_Vertex3D base, COME_Molecule* nearestMol, vector<int> faces, COME_Mesh* mesh);
00091         bool    IsInAcceptableRange(COME_Vector3D dir1,COME_Vector3D dir2,COME_Vertex3D base, double maxdir1,double mindir1,double maxDir2,double minDir2, COME_Face* face);
00092         
00093         void    initializeProximityStructure();
00094         int     addProximities( COME_Mesh *mA, COME_Mesh * mB, double hardSoft );
00095         void    updateProximityStructure();
00096         void    geometricResponse();
00097         void    resetProximitiesDisps();
00098         
00099         vector<COME_Proximity>* getProximityStructurePt();
00100         
00101         void    updateVelocity( COME_Face *faceB, COME_Vertex3D *objA );
00102         void    sphericalSlidingResponse();
00103         double  signedDistance( COME_Face *faceB, COME_Point3D p, COME_Point3D pointOnB, COME_Vector3D normal );
00104         void    updatePosition( COME_Face *faceB, COME_Vertex3D *objA, COME_Point3D pointOnB );
00105         double softhard;
00106         
00107         long int CONTADIST;
00108 };
00109 
00110 #endif // __COMECOLLIDE_H
00111 

Generated on Thu Dec 1 10:13:33 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5