Biomechanical Joint Model
 Author: Anderson Maciel

comeface.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 __COMEFACE_H    
00033 #define __COMEFACE_H    
00034 
00035 #include <general/come.h>
00036 #include <algebra/comevector3d.h>
00037 #include <algebra/comevertex3d.h>
00038 
00039 #ifndef max
00040 #define max(a,b) ((a)>(b)?(a):(b))
00041 #define min(a,b) ((a)<(b)?(a):(b))
00042 #endif
00043 
00044 class COME_Mesh;
00045 class COME_Molecule;
00046 
00047 class COME_Face : public COME{
00048 
00049 protected:
00050         vector<int>     vertices;                         
00051         COME_Vector3D   normal;                           
00052         COME_Vector3D   normalGlobalPosition; 
00053         COME_Molecule   *nearestMolecule;         
00054         vector<int>     neighbourFaces;           
00055         double          color[4];
00056         bool            collisionDetectable;
00057 
00058 
00059 public:
00060         
00061         bool showFace;
00062         COME_Vector3D referenceFace;
00063 
00064         
00065         COME_Face();
00066         //COME_Face( const COME_Face& pFace );
00067         COME_Face( vector<int> verticeN, COME_Mesh* parentN );
00068         COME_Face( vector<int> verticeN );
00069         ~COME_Face();
00070 
00071 
00072         void                    setVertex( vector<int> verticeN );
00073         void                    setNormal( COME_Vector3D normalN );
00074         void                    setNearestMolecule( COME_Molecule *nearest );
00075         void                    setCollisionDetectable( bool yesno );
00076         
00077         int                     getIndexVertex( int iPosN ) const;
00078         int                     getNumberVertices() const;
00079         bool                    getCollisionDetectable();
00080 
00081         COME_Vertex3D           getVertex( int iPosN ) const;
00082         COME_Vertex3D*          getClosestVertexPt( COME_Point3D currentPoint );
00083         COME_Vector3D           getNormal() const;
00084         vector<COME_Vertex3D>   getVertices() const;    
00085         COME_Molecule*          getNearestMolecule() const;
00086         COME_Point3D            getCenter();
00087         double                  getArea();
00088         double                  getStress();
00089         bool                    containsVertexIndex( int v );
00090         void                    replaceIndex( int v1, int v2 );
00091         
00092         double                  getElasticity();
00093         void                    updateNormal();
00094         double                  distanceFaceFace( COME_Face face );
00095         bool                    isInside( COME_Point3D currentPoint );
00096         void                    update();
00097         
00098         double                  geoSolidAngle( COME_Point3D point2Check );
00099 
00100         COME_Vector3D           vectorVertexFaceGlobalPosition( COME_Vertex3D vertex );
00101         
00102         double  distancePointPlaneGlobalPosition( COME_Point3D pPos );
00103         
00104         double  distancePointFace( COME_Point3D pPos );
00105         void            getClosestEdge( COME_Point3D &pA, COME_Point3D &pB, COME_Point3D p );
00106         bool            isInside2D( COME_Point3D pPos );
00107         double  distancePointFaceGlobal( COME_Point3D pPos );
00108         double  signedDistancePointFaceGlobal( COME_Point3D pPos );
00109         void            getClosestEdgeGlobal( COME_Point3D &pA, COME_Point3D &pB, COME_Point3D p );
00110         bool            isInside2DGlobal( COME_Point3D pPos );
00111         
00112         COME_Point3D            getClosestPointOnFaceToPoint( COME_Point3D pPos );
00113         COME_Vector3D   getBlendedVelocity( COME_Point3D pPos );
00114         bool            isInsideGlobalGOOD( COME_Point3D pPos );
00115         bool            intersectionRayTriangle( COME_Vector3D vRay, COME_Point3D &intersection );
00116 
00117         
00118         //*************** Added by Jean-Philippe ******************
00119 
00120         
00121         COME_Vertex3D           getVertexGlobalPosition( int iPosN ) const;
00122         vector<COME_Vertex3D>   getVerticesGlobalPosition() const;
00123         COME_Vertex3D*          getVertexGlobalPositionPt( int iPosN );
00124         vector<COME_Vertex3D*>  getVerticesGlobalPositionPt();
00125 
00126         void                    updateNormalGlobalPosition();
00127         COME_Vector3D           getNormalGlobalPosition() const;
00128         COME_Vector3D*          getNormalGlobalPositionPt();
00129 
00130         bool                    isCompletelyInside(COME_Face* face2);   
00131         bool                    isInsideGlobalPosition( COME_Point3D currentPoint );
00132         
00133         int                     getPenetratingVertex2(COME_Face* face2);
00134         double          penetrationDistance(COME_Point3D currentPoint);
00135         
00136         double          distanceFaceFaceGlobalPosition( COME_Face* face );
00137         double          distanceVertexPlaneGlobalPosition( COME_Vertex3D vertex );
00138                 
00139         void                    setNeighbourFaces( vector<int> faces);
00140         void                    addNeighbour( int faceIndex);
00141         vector <int>    getNeighbourFaces() const;
00142         COME_Face *     getNeighborClosestTo( COME_Vertex3D *vPos );
00143         
00144         void                    setColor(double* c);
00145         const double*   getColor() const;
00146         
00147         COME_Vertex3D*          getVertexPt( int iPosN );
00148         vector<int>             getIndexVertices();
00149         COME_Vertex3D           getCenterGlobalPosition();
00150         COME_Vertex3D*          getCenterGlobalPositionPt();
00151 
00152         
00153         static double triangleArea( COME_Point3D A, COME_Point3D B, COME_Point3D C );
00154 
00155 };
00156 
00157 #endif // __COMEFACE_H

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