/[ff3d]/ff3d/solver/SurfaceMeshGenerator.cpp
ViewVC logotype

Diff of /ff3d/solver/SurfaceMeshGenerator.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by dobj, Tue Mar 25 18:41:01 2003 UTC revision 1.10 by delpinux, Tue Mar 25 20:09:57 2003 UTC
# Line 134  private: Line 134  private:
134    void __CalculPoint(const Vertex& V0, const Vertex& V1 , const Vertex& V2,    void __CalculPoint(const Vertex& V0, const Vertex& V1 , const Vertex& V2,
135                       const Vertex& Vo0, const Vertex& Vo1 , const Vertex& Vo2,                       const Vertex& Vo0, const Vertex& Vo1 , const Vertex& Vo2,
136                       int nn,int& ttn0,int& ttn1 ,int& ttn2,                       int nn,int& ttn0,int& ttn1 ,int& ttn2,
137                       Vertex * vvn0 , Vertex* vvn1 , Vertex* vvn2);                       Vertex *& vvn0 , Vertex*& vvn1 , Vertex*& vvn2);
138    void __IntersectionPoint(const Scene& scene ,const Reference::Representation& ref,                                                       const Reference::Representation& otherRef,  
139      void __IntersectionPoint(const Scene& scene ,const Reference::Representation& ref,
140                               const Reference::Representation& otherRef,
141                             std::map<Edge::Pair,int>& triangleedge,                             std::map<Edge::Pair,int>& triangleedge,
142                             std::map<Edge::Pair, Vertex*>&  listofVertex);                             std::map<Edge::Pair, Vertex*>&  listofVertex);
143        
# Line 433  void SurfaceMeshGenerator::Internals::__ Line 435  void SurfaceMeshGenerator::Internals::__
435  }  }
436    
437  void SurfaceMeshGenerator::Internals::__CalculPoint(const Vertex& V0, const Vertex& V1 , const Vertex& V2,  void SurfaceMeshGenerator::Internals::__CalculPoint(const Vertex& V0, const Vertex& V1 , const Vertex& V2,
438                     const Vertex& Vo0, const Vertex& Vo1 , const Vertex& Vo2,                                                      const Vertex& Vo0, const Vertex& Vo1 , const Vertex& Vo2,
439                                                      int nn,int& ttn0,int& ttn1 ,int& ttn2,                                                      int nn, int& ttn0, int& ttn1 ,int& ttn2,
440                                                      Vertex * vvn0 , Vertex * vvn1 , Vertex * vvn2)                                                      Vertex *& vvn0 , Vertex *& vvn1 , Vertex *& vvn2)
441  {  {
442      TinyVector<3>  V01,V12,V02;      TinyVector<3>  V01,V12,V02;
443      V01 = V1.Vector3() - V0.Vector3();      V01 = V1.Vector3() - V0.Vector3();
# Line 831  std::cout<<"pbs de precision?? tr out cu Line 833  std::cout<<"pbs de precision?? tr out cu
833  }  }
834    
835  void SurfaceMeshGenerator::Internals::  void SurfaceMeshGenerator::Internals::
836  __IntersectionPoint(const Scene& scene ,const Reference::Representation& ref  __IntersectionPoint(const Scene& scene ,const Reference::Representation& ref,
837                      ,const Reference::Representation& otherRef,                      const Reference::Representation& otherRef,
838                      std::map<Edge::Pair,int>& triangleedge,                      std::map<Edge::Pair,int>& triangleedge,
839                      std::map<Edge::Pair, Vertex*>&  listofVertex)                      std::map<Edge::Pair, Vertex*>&  listofVertex)
840  {  {
841    
842      int nn=0;    int nn=0;
843  EdgePairList::iterator currentTriangle=(*triangleListes[0]).end();    EdgePairList::iterator currentTriangle=(*triangleListes[0]).end();
844  EdgePairList::iterator currentTriangleother=(*triangleListes[1]).end();    EdgePairList::iterator currentTriangleother=(*triangleListes[1]).end();
845      --currentTriangle;    --currentTriangle;
846      --currentTriangleother;    --currentTriangleother;
847            
848      for(SurfaceMeshGenerator::Internals::HexaTetraAssociation::iterator i    for(SurfaceMeshGenerator::Internals::HexaTetraAssociation::iterator i
849          = hexaTetraAssociation.begin();          = hexaTetraAssociation.begin();
850          i != hexaTetraAssociation.end(); ++i) {        i != hexaTetraAssociation.end(); ++i) {
851    
852            
853  std::vector<TetrahedronByEdges>& T = *(((*i).second).first);      std::vector<TetrahedronByEdges>& T = *(((*i).second).first);
854  //      ffout(0) << " hexa*****************************************\n";  //      ffout(0) << " hexa*****************************************\n";
855    
856          for (std::vector<TetrahedronByEdges>::iterator currentT = T.begin();      for (std::vector<TetrahedronByEdges>::iterator currentT = T.begin();
857        currentT < T.end(); ++currentT) {           currentT < T.end(); ++currentT) {
858    
859  std::vector<const Edge*> cutEdges;        std::vector<const Edge*> cutEdges;
860  std::vector<const Edge*> cutEdgesother;        std::vector<const Edge*> cutEdgesother;
861    
862              for(size_t ie=0; ie<6; ++ie) {        for(size_t ie=0; ie<6; ++ie) {
863                  const Edge& e = currentT->edge(ie);          const Edge& e = currentT->edge(ie);
864                  if ((e(0).Ref().isSet(ref)) xor (e(1).Ref().isSet(ref))) {          if ((e(0).Ref().isSet(ref)) xor (e(1).Ref().isSet(ref))) {
865                      cutEdges.push_back(&e);            cutEdges.push_back(&e);
866                  }          }
867                  if ((e(0).Ref().isSet(otherRef)) xor (e(1).Ref().isSet(otherRef))) {          if ((e(0).Ref().isSet(otherRef)) xor (e(1).Ref().isSet(otherRef))) {
868                      cutEdgesother.push_back(&e);            cutEdgesother.push_back(&e);
869                  }          }
870                          }
             }  
871  //          ffout(0) <<cutEdges.size()<<" "<<cutEdgesother.size()<< " tetra__________*****************************************\n";  //          ffout(0) <<cutEdges.size()<<" "<<cutEdgesother.size()<< " tetra__________*****************************************\n";
872    
873              switch (cutEdges.size()) {        switch (cutEdges.size()) {
874                  case 3: {        case 3: {
875                      localTriangleList.push_front(TinyVector<3,Edge::Pair>());          localTriangleList.push_front(TinyVector<3,Edge::Pair>());
876  EdgePairList::iterator currentT = localTriangleList.begin();          EdgePairList::iterator currentT = localTriangleList.begin();
877                      for(size_t i=0; i<3; ++i)          for(size_t i=0; i<3; ++i)
878                                  (*currentT)[i] = (*currentTriangle)[i];            (*currentT)[i] = (*currentTriangle)[i];
879                      --currentTriangle;          --currentTriangle;
880                      break;          break;
881                     }        }
882                              case 4: {
883                  case 4: {          {
884                  {                   localTriangleList.push_front(TinyVector<3,Edge::Pair>());            localTriangleList.push_front(TinyVector<3,Edge::Pair>());
885  EdgePairList::iterator currentT = localTriangleList.begin();            EdgePairList::iterator currentT = localTriangleList.begin();
886                      for(size_t i=0; i<3; ++i)            for(size_t i=0; i<3; ++i)
887                          (*currentT)[i] = (*currentTriangle)[i];              (*currentT)[i] = (*currentTriangle)[i];
                 }  
                     --currentTriangle;  
                       
                     localTriangleList.push_front(TinyVector<3,Edge::Pair>());  
 EdgePairList::iterator currentT = localTriangleList.begin();  
   
                     for(size_t i=0; i<3; ++i)  
                         (*currentT)[i] = (*currentTriangle)[i];  
                     --currentTriangle;  
                     break;  
                 }  
                 case 1:  
                 case 2: {  
                     ffout(0) << "?!\n";  
                     break;  
                 }  
             }  
   
             switch (cutEdgesother.size()) {  
                 case 3: {  
                  localTriangleListother.push_front(TinyVector<3,Edge::Pair>());  
 EdgePairList::iterator currentT = localTriangleListother.begin();  
                     for(size_t i=0; i<3; ++i)  
                         (*currentT)[i] = (*currentTriangleother)[i];  
                     --currentTriangleother;  
                     break;  
                 }  
   
                 case 4: {  
                 {   localTriangleListother.push_front(TinyVector<3,Edge::Pair>());  
 EdgePairList::iterator currentT = localTriangleListother.begin();  
                     for(size_t i=0; i<3; ++i)  
                         (*currentT)[i] = (*currentTriangleother)[i];  
                 }  
                     --currentTriangleother;  
   
                     localTriangleListother.push_front(TinyVector<3,Edge::Pair>());  
 EdgePairList::iterator currentT = localTriangleListother.begin();  
   
                     for(size_t i=0; i<3; ++i)  
                         (*currentT)[i] = (*currentTriangleother)[i];  
                     --currentTriangleother;  
                     break;  
                 }  
                 case 1:  
                 case 2: {  
                     ffout(0) << "?!\n";  
                     break;  
                 }  
             }  
888          }          }
889            --currentTriangle;
890            localTriangleList.push_front(TinyVector<3,Edge::Pair>());
891            EdgePairList::iterator currentT = localTriangleList.begin();
892    
893            for(size_t i=0; i<3; ++i)
894              (*currentT)[i] = (*currentTriangle)[i];
895            --currentTriangle;
896            break;
897          }
898          case 1:
899          case 2: {
900            ffout(0) << "?!\n";
901            break;
902          }
903          }
904    
905          for(SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle1        switch (cutEdgesother.size()) {
906       = localTriangleList.begin();        case 3: {
907       currentTriangle1 != localTriangleList.end();          localTriangleListother.push_front(TinyVector<3,Edge::Pair>());
908       ++currentTriangle1)          EdgePairList::iterator currentT = localTriangleListother.begin();
909            for(size_t i=0; i<3; ++i)
910              (*currentT)[i] = (*currentTriangleother)[i];
911            --currentTriangleother;
912            break;
913          }
914          case 4: {
915          {          {
916          const Edge::Pair& e0=(*currentTriangle1)[0];            localTriangleListother.push_front(TinyVector<3,Edge::Pair>());
917          const Edge::Pair& e1=(*currentTriangle1)[1];            EdgePairList::iterator currentT = localTriangleListother.begin();
918          const Edge::Pair& e2=(*currentTriangle1)[2];            for(size_t i=0; i<3; ++i)
919          //ffout(0) << (*e0.first).Vector3()[0]<<"\n";              (*currentT)[i] = (*currentTriangleother)[i];
920          const Vertex& V0 = *((*verticesListes[0])[e0]);          }
921          const Vertex& V1 = *((*verticesListes[0])[e1]);          --currentTriangleother;
922          const Vertex& V2 = *((*verticesListes[0])[e2]);  
923          //tt[nn] = 0;          localTriangleListother.push_front(TinyVector<3,Edge::Pair>());
924          (triangleedge)[e0]=0;          EdgePairList::iterator currentT = localTriangleListother.begin();
925          (triangleedge)[e1]=0;  
926          (triangleedge)[e2]=0;          for(size_t i=0; i<3; ++i)
927          for(SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle            (*currentT)[i] = (*currentTriangleother)[i];
928       = localTriangleListother.begin();          --currentTriangleother;
929       currentTriangle != localTriangleListother.end();          break;
930       ++currentTriangle) {        }
931                  //std::cout<<"*************************\n";        case 1:
932              const Edge::Pair& eo0=(*currentTriangle)[0];        case 2: {
933              const Edge::Pair& eo1=(*currentTriangle)[1];          ffout(0) << "?!\n";
934              const Edge::Pair& eo2=(*currentTriangle)[2];          break;
935                  const Vertex& Vo0 = *((*verticesListes[1])[eo0]);        }
936                  const Vertex& Vo1 = *((*verticesListes[1])[eo1]);        }
                 const Vertex& Vo2 = *((*verticesListes[1])[eo2]);  
   
                 __CalculPoint(V0,V1,V2,Vo0,Vo1,Vo2,nn,  
                 (triangleedge)[e0],(triangleedge)[e1],(triangleedge)[e2]  
                 ,((listofVertex)[e0]),((listofVertex)[e1]),((listofVertex)[e2]));  
             }  
           
         ++nn;  
         //ffout(0) << "nn "<<nn<<"\n";  
         }  
         localTriangleList.clear();  
         localTriangleListother.clear();  
937      }      }
938    
939    
940        for(SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle1
941              = localTriangleList.begin();
942            currentTriangle1 != localTriangleList.end();
943            ++currentTriangle1) {
944          const Edge::Pair& e0=(*currentTriangle1)[0];
945          const Edge::Pair& e1=(*currentTriangle1)[1];
946          const Edge::Pair& e2=(*currentTriangle1)[2];
947          //ffout(0) << (*e0.first).Vector3()[0]<<"\n";
948          const Vertex& V0 = *((*verticesListes[0])[e0]);
949          const Vertex& V1 = *((*verticesListes[0])[e1]);
950          const Vertex& V2 = *((*verticesListes[0])[e2]);
951          //tt[nn] = 0;
952          (triangleedge)[e0]=0;
953          (triangleedge)[e1]=0;
954          (triangleedge)[e2]=0;
955          for(SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle
956                = localTriangleListother.begin();
957              currentTriangle != localTriangleListother.end();
958              ++currentTriangle) {
959            //std::cout<<"*************************\n";
960            const Edge::Pair& eo0=(*currentTriangle)[0];
961            const Edge::Pair& eo1=(*currentTriangle)[1];
962            const Edge::Pair& eo2=(*currentTriangle)[2];
963            const Vertex& Vo0 = *((*verticesListes[1])[eo0]);
964            const Vertex& Vo1 = *((*verticesListes[1])[eo1]);
965            const Vertex& Vo2 = *((*verticesListes[1])[eo2]);
966    
967            __CalculPoint(V0, V1, V2, Vo0, Vo1, Vo2, nn,
968                          triangleedge[e0], triangleedge[e1], triangleedge[e2],
969                          listofVertex[e0], listofVertex[e1], listofVertex[e2]);
970          }
971          ++nn;
972          //ffout(0) << "nn "<<nn<<"\n";
973        }
974        localTriangleList.clear();
975        localTriangleListother.clear();
976      }
977  /*    nn=0;  /*    nn=0;
978    
979      for(SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle1      for(SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle1
# Line 1851  ffout(0) << "fin troisieme boucle\n"; Line 1849  ffout(0) << "fin troisieme boucle\n";
1849          bool i1 = (ii1==1);          bool i1 = (ii1==1);
1850          bool i2 = (ii2==1);          bool i2 = (ii2==1);
1851    
1852  std::cout<<"inside? "<<i0<<" "<<i1<<" "<<i2<<"\n";          std::cout<<"inside? "<<i0<<" "<<i1<<" "<<i2<<"\n";
1853    
1854          if(tn0+tn1==2) {          if(tn0+tn1==2) {
1855            if(i0) {            if(i0) {
1856              Vertex A=V0;              Vertex A=V0;
1857  //std::cout<<"A "<<A.Vector3()[0]<<"  "<<A.Vector3()[1]<<" "<<A.Vector3()[2]<<"\n";  //std::cout<<"A "<<A.Vector3()[0]<<"  "<<A.Vector3()[1]<<" "<<A.Vector3()[2]<<"\n";
1858                Vertex& B=(*(listofVertex[e0]));
               Vertex& B=(*(listofVertex[e0]));  
1859              Vertex& C=(*(listofVertex[e1]));              Vertex& C=(*(listofVertex[e1]));
1860  //std::cout<<"B "<<B.Vector3()[0]<<"  "<<B.Vector3()[1]<<" "<<B.Vector3()[2]<<"\n";  //std::cout<<"B "<<B.Vector3()[0]<<"  "<<B.Vector3()[1]<<" "<<B.Vector3()[2]<<"\n";
1861  //std::cout<<"C "<<C.Vector3()[0]<<"  "<<C.Vector3()[1]<<" "<<C.Vector3()[2]<<"\n";  //std::cout<<"C "<<C.Vector3()[0]<<"  "<<C.Vector3()[1]<<" "<<C.Vector3()[2]<<"\n";

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26