Biomechanical Joint Model
 Author: Anderson Maciel

cometetra.cpp

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 #include <algebra/cometetra.h>
00033 #include <bio/comemolecule.h>
00034 
00035         
00039 COME_Tetra :: COME_Tetra(){
00040 
00041         
00042 }
00043 
00044 COME_Tetra :: COME_Tetra( vector<COME_Molecule*> moleculesList ){
00045 
00046         molecules = moleculesList;
00047 
00048 }
00049 
00050 
00051 COME_Tetra :: ~COME_Tetra(){
00052 
00053         
00054 }
00055 
00059 void            
00060 COME_Tetra :: setMoleculesList( vector<COME_Molecule*> moleculesList ) {
00061         
00062         molecules = moleculesList;
00063 }
00064 
00065 void
00066 COME_Tetra :: setMoleculeAt( COME_Molecule *molecule, int index ){
00067 
00068         molecules[index] = molecule;
00069 }
00070 
00071 void
00072 COME_Tetra :: addMolecule( COME_Molecule *molecule ){
00073 
00074         molecules.push_back( molecule );
00075 }
00076         
00077         
00081                 
00082 vector<COME_Molecule*>
00083 COME_Tetra :: getMolecules() const{
00084 
00085         return molecules;
00086 
00087 }
00088 
00089 COME_Molecule*
00090 COME_Tetra :: getMoleculeAt( int index ) const {
00091 
00092         return molecules[index];
00093 }
00094 
00095 double
00096 COME_Tetra :: getVolume() const{
00097 
00098         double area = ( ( COME_Vector3D( ( molecules[1]->getPosition() - molecules[0]->getPosition() ) +
00099                                         ( molecules[2]->getPosition() - molecules[0]->getPosition() ) ).vpModule() / 2 ) * 
00100                                         ( COME_Vector3D( molecules[2]->getPosition() - molecules[1]->getPosition() ).vpModule() ) ) / 2;
00101 
00102 
00103         COME_Vector3D unitAB; unitAB.setVector3D( molecules[1]->getPosition() - molecules[0]->getPosition() );
00104         unitAB.vpNormalize();
00105         COME_Vector3D AP; AP.setVector3D( molecules[3]->getPosition() - molecules[0]->getPosition() );
00106         COME_Vector3D AB; AB.setVector3D( molecules[1]->getPosition() - molecules[0]->getPosition() );
00107         COME_Vector3D w1 =  unitAB * AP.vpModule() * AP.vpDotProduct( AB );                  
00108         COME_Vector3D unitAC;   unitAC.setVector3D( molecules[2]->getPosition() - molecules[0]->getPosition() );
00109         unitAC.vpNormalize();
00110         COME_Vector3D AC;       AC.setVector3D( molecules[2]->getPosition() - molecules[0]->getPosition() );
00111         COME_Vector3D w2 =  unitAC * AP.vpModule() * AP.vpDotProduct( AC );     
00112         COME_Point3D pointPlane = w1 + w2 + molecules[3]->getPosition();
00113         double h = molecules[3]->getPosition().vpDistance( pointPlane );
00114 
00115         return area * h / 3;
00116 }
00117 
00123 double
00124 COME_Tetra::getElasticity() const {
00125 
00126         double elasticity = ( molecules[0]->getMaterial()->getYoungsModulus() +
00127                                                  molecules[1]->getMaterial()->getYoungsModulus() +
00128                                                  molecules[2]->getMaterial()->getYoungsModulus() +
00129                                                  molecules[3]->getMaterial()->getYoungsModulus() ) / 4;
00130 
00131         return elasticity;
00132 }
00133 
00134 

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