00001 /****************************************************************************** 00002 * SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3 * 00003 * (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify it * 00006 * under the terms of the GNU Lesser General Public License as published by * 00007 * the Free Software Foundation; either version 2.1 of the License, or (at * 00008 * your option) any later version. * 00009 * * 00010 * This library is distributed in the hope that it will be useful, but WITHOUT * 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * 00013 * for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public License * 00016 * along with this library; if not, write to the Free Software Foundation, * 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 00018 ******************************************************************************* 00019 * SOFA :: Modules * 00020 * * 00021 * Authors: The SOFA Team and external contributors (see Authors.txt) * 00022 * * 00023 * Contact information: contact@sofa-framework.org * 00024 ******************************************************************************/ 00025 #ifndef SOFA_COMPONENT_COLLISION_PROXIMITY_H 00026 #define SOFA_COMPONENT_COLLISION_PROXIMITY_H 00027 00028 #include <sofa/component/collision/Triangle.h> 00029 00030 namespace sofa 00031 { 00032 00033 namespace component 00034 { 00035 00036 namespace collision 00037 { 00038 00039 //----------------------------------------------------------------------------- 00040 //--DistanceTriTri-- 00041 //------------------ 00042 // this class computes the shortest distance between a triangle P and a triangle Q 00043 //----------------------------------------------------------------------------- 00044 class DistanceTriTri 00045 { 00046 public: 00047 DistanceTriTri(); // start a Proximity solver 00048 ~DistanceTriTri(); 00049 00050 // init the solver with the new coordinates of the triangle & the segment 00051 // solve the lcp 00052 void NewComputation(Triangle *triP, Triangle *triQ, Vector3 &Presult, Vector3 &Qresult); 00053 00054 //double getAlphaP(){return _result[6];} 00055 //double getBetaP(){return _result[7];} 00056 //double getAlphaQ(){return _result[8];} 00057 //double getBetaQ(){return _result[9];} 00058 00059 00060 private: 00061 //double **_A; 00062 //double *_b; 00063 //double *_result; 00064 }; 00065 00066 //----------------------------------------------------------------------------- 00067 //--DistanceSegTri-- 00068 //------------------ 00069 // this class compute the shortest distance between a triangle and a segment 00070 //----------------------------------------------------------------------------- 00071 class DistanceSegTri 00072 { 00073 public: 00074 DistanceSegTri(); // start a Proximity solver 00075 ~DistanceSegTri(); 00076 00077 // init the solver with the new coordinates of the triangle & the segment 00078 // solve the lcp 00079 void NewComputation(Triangle *tri, const Vector3 &Q1, const Vector3 &Q2, Vector3 &Presult, Vector3 &Qresult); 00080 00081 // we should add the same procedure using with AAB 00082 //double distanceBSphere(Triangle &tri, Vector3 &Q1, Vector3&Q2); 00083 00084 //double distanceBBox(Triangle &tri, Vector3 &Q1, Vector3&Q2); 00085 00086 //double getAlpha(){return _result[5];} 00087 //double getBeta(){return _result[6];} 00088 //double getGamma(){return _result[7];} 00089 00090 private: 00091 //double **_A; 00092 //double *_b; 00093 //double *_result; 00094 }; 00095 00096 //----------------------------------------------------------------------------- 00097 //--DistancePointTri-- 00098 //------------------ 00099 // this class compute the shortest distance between a triangle and a Point 00100 //----------------------------------------------------------------------------- 00101 class DistancePointTri 00102 { 00103 public: 00104 DistancePointTri(); // start a Proximity solver 00105 ~DistancePointTri(); 00106 00107 // init the solver with the new coordinates of the triangle & the segment 00108 // solve the lcp 00109 void NewComputation(Triangle *tri, const Vector3 &Q, Vector3 &Presult); 00110 00111 // distance using bbox precomputed on the triangle 00112 //double distanceBBox(Triangle &tri, const Vector3 &Q); 00113 00114 //double getAlpha(){return _result[4];} 00115 //double getBeta(){return _result[5];} 00116 00117 00118 private: 00119 //double **_A; 00120 //double *_b; 00121 //double *_result; 00122 }; 00123 00124 } // namespace collision 00125 00126 } // namespace component 00127 00128 } // namespace sofa 00129 00130 #endif 00131
1.5.7.1