Changeset 834


Ignore:
Timestamp:
04/26/06 19:02:47 (18 years ago)
Author:
gumbau
Message:

GeoLodTreeLibrary? leaves load from older leaf file format

Location:
GTP/trunk/Lib/Geom/shared
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj

    r831 r834  
    157157                        </File> 
    158158                        <File 
    159                                 RelativePath=".\src\hoja.cpp"> 
    160                         </File> 
    161                         <File 
    162159                                RelativePath=".\src\policy.cpp"> 
    163160                        </File> 
     
    377374                        </File> 
    378375                        <File 
    379                                 RelativePath=".\src\libs\leaves\hoja.h"> 
    380                         </File> 
    381                         <File 
    382376                                RelativePath=".\include\hoja.h"> 
    383377                        </File> 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/hoja.h

    r832 r834  
    1010                float  Normal[3]; 
    1111                float  Cuantas_hojas; 
     12                float Centro[3]; 
    1213                int padre; 
    1314                int hijoi; 
     
    1516                int visible; 
    1617                int raiz; 
    17          
     18 
     19                bool existe; 
     20                int hoja_cerca; 
     21                float dist; 
     22                long int hoja_cop; 
     23                float coplanar; 
     24                float criterio; 
     25                long int hoja_crit; 
     26 
     27                 
     28                // Identificadores de los triángulos que forman la hoja 
     29                long int id_triangulo[2]; 
    1830                 
    1931        public : 
     
    2335                virtual ~Hoja (void); // Destructor 
    2436 
    25  
     37                float Distancia (Hoja&); 
     38                float Coplanaridad (Hoja&); 
    2639}; 
    2740 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp

    r774 r834  
    176176                v2=mesh->mSubMesh[meshLeaves].mIndex[j+1]; 
    177177                v3=mesh->mSubMesh[meshLeaves].mIndex[j+2]; 
    178                 Hojasa[pos].Vertices[0]=v1; 
    179                 Hojasa[pos].Vertices[1]=v2; 
    180                 Hojasa[pos].Vertices[2]=v3; 
     178                Hojasa[pos].Vert_Hoja[0]=v1; 
     179                Hojasa[pos].Vert_Hoja[1]=v2; 
     180                Hojasa[pos].Vert_Hoja[2]=v3; 
    181181                num_triangulo++; 
    182182                Hojasa[pos].id_triangulo[0]=num_triangulo; 
     
    184184                // Segundo triángulo 
    185185                v3=mesh->mSubMesh[meshLeaves].mIndex[j+5]; 
    186                 Hojasa[pos].Vertices[3]=v3; 
     186                Hojasa[pos].Vert_Hoja[3]=v3; 
    187187                num_triangulo++; 
    188188                Hojasa[pos].id_triangulo[1]=num_triangulo; 
     
    231231         
    232232        //x1 
    233         max_x   =       max(max(Vertex[Hoja1.Vertices[0]][0], 
    234                                                                         Vertex[Hoja1.Vertices[1]][0]), 
    235                                                 max(Vertex[Hoja1.Vertices[2]][0], 
    236                                                                         Vertex[Hoja1.Vertices[3]][0])); 
    237          
    238         min_x   =       min(min(Vertex[Hoja1.Vertices[0]][0], 
    239                                                                         Vertex[Hoja1.Vertices[1]][0]), 
    240                                                 min(Vertex[Hoja1.Vertices[2]][0], 
    241                                                                         Vertex[Hoja1.Vertices[3]][0])); 
     233        max_x   =       max(max(Vertex[Hoja1.Vert_Hoja[0]][0], 
     234                                                                        Vertex[Hoja1.Vert_Hoja[1]][0]), 
     235                                                max(Vertex[Hoja1.Vert_Hoja[2]][0], 
     236                                                                        Vertex[Hoja1.Vert_Hoja[3]][0])); 
     237         
     238        min_x   =       min(min(Vertex[Hoja1.Vert_Hoja[0]][0], 
     239                                                                        Vertex[Hoja1.Vert_Hoja[1]][0]), 
     240                                                min(Vertex[Hoja1.Vert_Hoja[2]][0], 
     241                                                                        Vertex[Hoja1.Vert_Hoja[3]][0])); 
    242242 
    243243        Hoja1.Centro[0] = (max_x + min_x)/2; 
    244244 
    245245        //y1 
    246         max_y   =       max(max(Vertex[Hoja1.Vertices[0]][1], 
    247                                                                         Vertex[Hoja1.Vertices[1]][1]), 
    248                                                 max(Vertex[Hoja1.Vertices[2]][1], 
    249                                                                         Vertex[Hoja1.Vertices[3]][1])); 
    250          
    251         min_y   =       min(min(Vertex[Hoja1.Vertices[0]][1], 
    252                                                                         Vertex[Hoja1.Vertices[1]][1]), 
    253                                                 min(Vertex[Hoja1.Vertices[2]][1], 
    254                                                                         Vertex[Hoja1.Vertices[3]][1])); 
     246        max_y   =       max(max(Vertex[Hoja1.Vert_Hoja[0]][1], 
     247                                                                        Vertex[Hoja1.Vert_Hoja[1]][1]), 
     248                                                max(Vertex[Hoja1.Vert_Hoja[2]][1], 
     249                                                                        Vertex[Hoja1.Vert_Hoja[3]][1])); 
     250         
     251        min_y   =       min(min(Vertex[Hoja1.Vert_Hoja[0]][1], 
     252                                                                        Vertex[Hoja1.Vert_Hoja[1]][1]), 
     253                                                min(Vertex[Hoja1.Vert_Hoja[2]][1], 
     254                                                                        Vertex[Hoja1.Vert_Hoja[3]][1])); 
    255255 
    256256        Hoja1.Centro[1] =       (max_y + min_y) / 2; 
    257257         
    258258        //z1 
    259         max_z   =       max(max(Vertex[Hoja1.Vertices[0]][2], 
    260                                                                         Vertex[Hoja1.Vertices[1]][2]), 
    261                                                 max(Vertex[Hoja1.Vertices[2]][2], 
    262                                                                         Vertex[Hoja1.Vertices[3]][2])); 
    263          
    264         min_z   =       min(min(Vertex[Hoja1.Vertices[0]][2], 
    265                                                                         Vertex[Hoja1.Vertices[1]][2]), 
    266                                                 min(Vertex[Hoja1.Vertices[2]][2], 
    267                                                                         Vertex[Hoja1.Vertices[3]][2])); 
     259        max_z   =       max(max(Vertex[Hoja1.Vert_Hoja[0]][2], 
     260                                                                        Vertex[Hoja1.Vert_Hoja[1]][2]), 
     261                                                max(Vertex[Hoja1.Vert_Hoja[2]][2], 
     262                                                                        Vertex[Hoja1.Vert_Hoja[3]][2])); 
     263         
     264        min_z   =       min(min(Vertex[Hoja1.Vert_Hoja[0]][2], 
     265                                                                        Vertex[Hoja1.Vert_Hoja[1]][2]), 
     266                                                min(Vertex[Hoja1.Vert_Hoja[2]][2], 
     267                                                                        Vertex[Hoja1.Vert_Hoja[3]][2])); 
    268268 
    269269        Hoja1.Centro[2] =       (max_z + min_z) / 2; 
     
    279279        float threex, threey, threez; 
    280280 
    281         onex=Vertex[aHoja.Vertices[0]][0]; oney= Vertex[aHoja.Vertices[0]][1]; onez = Vertex[aHoja.Vertices[0]][2]; 
    282         twox = Vertex[aHoja.Vertices[1]][0]; twoy = Vertex[aHoja.Vertices[1]][1]; twoz = Vertex[aHoja.Vertices[1]][2]; 
    283         threex = Vertex[aHoja.Vertices[2]][0]; threey = Vertex[aHoja.Vertices[2]][1]; threez = Vertex[aHoja.Vertices[2]][2]; 
     281        onex=Vertex[aHoja.Vert_Hoja[0]][0]; oney= Vertex[aHoja.Vert_Hoja[0]][1]; onez = Vertex[aHoja.Vert_Hoja[0]][2]; 
     282        twox = Vertex[aHoja.Vert_Hoja[1]][0]; twoy = Vertex[aHoja.Vert_Hoja[1]][1]; twoz = Vertex[aHoja.Vert_Hoja[1]][2]; 
     283        threex = Vertex[aHoja.Vert_Hoja[2]][0]; threey = Vertex[aHoja.Vert_Hoja[2]][1]; threez = Vertex[aHoja.Vert_Hoja[2]][2]; 
    284284         
    285285        aHoja.Normal[0] = ((twoz-onez)*(threey-oney)) - ((twoy-oney)*(threez-onez)); 
     
    304304        float dist1, dist2, dist3, dist4, distmp, dista, distb, dist; 
    305305 
    306         onex=Vertex[aHoja.Vertices[0]][0]; oney= Vertex[aHoja.Vertices[0]][1]; onez = Vertex[aHoja.Vertices[0]][2]; 
    307         twox = Vertex[aHoja.Vertices[1]][0]; twoy = Vertex[aHoja.Vertices[1]][1]; twoz = Vertex[aHoja.Vertices[1]][2]; 
    308         threex = Vertex[aHoja.Vertices[2]][0]; threey = Vertex[aHoja.Vertices[2]][1]; threez = Vertex[aHoja.Vertices[2]][2]; 
    309         fourx = Vertex[aHoja.Vertices[3]][0]; foury = Vertex[aHoja.Vertices[3]][1]; fourz = Vertex[aHoja.Vertices[3]][2]; 
    310          
    311  
    312         x1 = Vertex[h2.Vertices[0]][0]; y1 = Vertex[h2.Vertices[0]][1]; z1 = Vertex[h2.Vertices[0]][2]; 
    313         x2 = Vertex[h2.Vertices[1]][0]; y2 = Vertex[h2.Vertices[1]][1]; z2 = Vertex[h2.Vertices[1]][2]; 
    314         x3 = Vertex[h2.Vertices[2]][0]; y3 = Vertex[h2.Vertices[2]][1]; z3 = Vertex[h2.Vertices[2]][2]; 
    315         x4 = Vertex[h2.Vertices[3]][0]; y4 = Vertex[h2.Vertices[3]][1]; z4 = Vertex[h2.Vertices[3]][2]; 
     306        onex=Vertex[aHoja.Vert_Hoja[0]][0]; oney= Vertex[aHoja.Vert_Hoja[0]][1]; onez = Vertex[aHoja.Vert_Hoja[0]][2]; 
     307        twox = Vertex[aHoja.Vert_Hoja[1]][0]; twoy = Vertex[aHoja.Vert_Hoja[1]][1]; twoz = Vertex[aHoja.Vert_Hoja[1]][2]; 
     308        threex = Vertex[aHoja.Vert_Hoja[2]][0]; threey = Vertex[aHoja.Vert_Hoja[2]][1]; threez = Vertex[aHoja.Vert_Hoja[2]][2]; 
     309        fourx = Vertex[aHoja.Vert_Hoja[3]][0]; foury = Vertex[aHoja.Vert_Hoja[3]][1]; fourz = Vertex[aHoja.Vert_Hoja[3]][2]; 
     310         
     311 
     312        x1 = Vertex[h2.Vert_Hoja[0]][0]; y1 = Vertex[h2.Vert_Hoja[0]][1]; z1 = Vertex[h2.Vert_Hoja[0]][2]; 
     313        x2 = Vertex[h2.Vert_Hoja[1]][0]; y2 = Vertex[h2.Vert_Hoja[1]][1]; z2 = Vertex[h2.Vert_Hoja[1]][2]; 
     314        x3 = Vertex[h2.Vert_Hoja[2]][0]; y3 = Vertex[h2.Vert_Hoja[2]][1]; z3 = Vertex[h2.Vert_Hoja[2]][2]; 
     315        x4 = Vertex[h2.Vert_Hoja[3]][0]; y4 = Vertex[h2.Vert_Hoja[3]][1]; z4 = Vertex[h2.Vert_Hoja[3]][2]; 
    316316 
    317317        // guardo las distancias mínimas de cada vértice a los 4 contrarios. 
     
    648648        //inicializo al primero de los vértices de las hojas 
    649649 
    650         xmax = Vertex[Hojasa[0].Vertices[0]][0]; 
     650        xmax = Vertex[Hojasa[0].Vert_Hoja[0]][0]; 
    651651        xmin = xmax; 
    652652 
    653         ymax = Vertex[Hojasa[0].Vertices[0]][1]; 
     653        ymax = Vertex[Hojasa[0].Vert_Hoja[0]][1]; 
    654654        ymin = ymax; 
    655655 
    656         zmax = Vertex[Hojasa[0].Vertices[0]][2]; 
     656        zmax = Vertex[Hojasa[0].Vert_Hoja[0]][2]; 
    657657        zmin = zmax; 
    658658 
     
    674674                { 
    675675                         
    676                 if ( xmax < Vertex[Hojasa[i].Vertices[j]][0]) xmax = Vertex[Hojasa[i].Vertices[j]][0]; 
    677                 if ( xmin > Vertex[Hojasa[i].Vertices[j]][0]) xmin = Vertex[Hojasa[i].Vertices[j]][0]; 
    678  
    679                 if ( ymax < Vertex[Hojasa[i].Vertices[j]][1]) ymax = Vertex[Hojasa[i].Vertices[j]][1]; 
    680                 if ( ymin > Vertex[Hojasa[i].Vertices[j]][1]) ymin = Vertex[Hojasa[i].Vertices[j]][1]; 
     676                if ( xmax < Vertex[Hojasa[i].Vert_Hoja[j]][0]) xmax = Vertex[Hojasa[i].Vert_Hoja[j]][0]; 
     677                if ( xmin > Vertex[Hojasa[i].Vert_Hoja[j]][0]) xmin = Vertex[Hojasa[i].Vert_Hoja[j]][0]; 
     678 
     679                if ( ymax < Vertex[Hojasa[i].Vert_Hoja[j]][1]) ymax = Vertex[Hojasa[i].Vert_Hoja[j]][1]; 
     680                if ( ymin > Vertex[Hojasa[i].Vert_Hoja[j]][1]) ymin = Vertex[Hojasa[i].Vert_Hoja[j]][1]; 
    681681                 
    682                 if ( zmax < Vertex[Hojasa[i].Vertices[j]][2]) zmax = Vertex[Hojasa[i].Vertices[j]][2]; 
    683                 if ( zmin > Vertex[Hojasa[i].Vertices[j]][2]) zmin = Vertex[Hojasa[i].Vertices[j]][2]; 
     682                if ( zmax < Vertex[Hojasa[i].Vert_Hoja[j]][2]) zmax = Vertex[Hojasa[i].Vert_Hoja[j]][2]; 
     683                if ( zmin > Vertex[Hojasa[i].Vert_Hoja[j]][2]) zmin = Vertex[Hojasa[i].Vert_Hoja[j]][2]; 
    684684 
    685685                } 
     
    900900 
    901901 
    902         a = Vertex[Hoja1.Vertices[0]][0]; 
    903         b = Vertex[Hoja1.Vertices[0]][1]; 
    904         c = Vertex[Hoja1.Vertices[0]][2]; 
     902        a = Vertex[Hoja1.Vert_Hoja[0]][0]; 
     903        b = Vertex[Hoja1.Vert_Hoja[0]][1]; 
     904        c = Vertex[Hoja1.Vert_Hoja[0]][2]; 
    905905 
    906906        dist[0] = ((Hoja2.Centro[0]-a)*(Hoja2.Centro[0]-a)) + ((Hoja2.Centro[1]-b)*(Hoja2.Centro[1]-b)) + 
     
    908908 
    909909         
    910         a = Vertex[Hoja1.Vertices[1]][0]; 
    911         b = Vertex[Hoja1.Vertices[1]][1]; 
    912         c = Vertex[Hoja1.Vertices[1]][2]; 
     910        a = Vertex[Hoja1.Vert_Hoja[1]][0]; 
     911        b = Vertex[Hoja1.Vert_Hoja[1]][1]; 
     912        c = Vertex[Hoja1.Vert_Hoja[1]][2]; 
    913913 
    914914        dist[1] = ((Hoja2.Centro[0]-a)*(Hoja2.Centro[0]-a)) + ((Hoja2.Centro[1]-b)*(Hoja2.Centro[1]-b)) + 
    915915                   ((Hoja2.Centro[2]-c)*(Hoja2.Centro[2]-c)); 
    916916 
    917         a = Vertex[Hoja1.Vertices[2]][0]; 
    918         b = Vertex[Hoja1.Vertices[2]][1]; 
    919         c = Vertex[Hoja1.Vertices[2]][2]; 
     917        a = Vertex[Hoja1.Vert_Hoja[2]][0]; 
     918        b = Vertex[Hoja1.Vert_Hoja[2]][1]; 
     919        c = Vertex[Hoja1.Vert_Hoja[2]][2]; 
    920920 
    921921        dist[2] = ((Hoja2.Centro[0]-a)*(Hoja2.Centro[0]-a)) + ((Hoja2.Centro[1]-b)*(Hoja2.Centro[1]-b)) + 
     
    923923 
    924924 
    925         a = Vertex[Hoja1.Vertices[3]][0]; 
    926         b = Vertex[Hoja1.Vertices[3]][1]; 
    927         c = Vertex[Hoja1.Vertices[3]][2]; 
     925        a = Vertex[Hoja1.Vert_Hoja[3]][0]; 
     926        b = Vertex[Hoja1.Vert_Hoja[3]][1]; 
     927        c = Vertex[Hoja1.Vert_Hoja[3]][2]; 
    928928 
    929929        dist[3] = ((Hoja2.Centro[0]-a)*(Hoja2.Centro[0]-a)) + ((Hoja2.Centro[1]-b)*(Hoja2.Centro[1]-b)) + 
     
    934934        DosMayores(dist, indices); 
    935935         
    936         Hojasa[counth].Vertices[0] = Hoja1.Vertices[indices[0]];  
    937         Hojasa[counth].Vertices[1] = Hoja1.Vertices[indices[1]];  
     936        Hojasa[counth].Vert_Hoja[0] = Hoja1.Vert_Hoja[indices[0]];  
     937        Hojasa[counth].Vert_Hoja[1] = Hoja1.Vert_Hoja[indices[1]];  
    938938         
    939939        // segunda hoja los dos ultimos vertices 
    940940 
    941941         
    942         a = Vertex[Hoja2.Vertices[0]][0]; 
    943         b = Vertex[Hoja2.Vertices[0]][1]; 
    944         c = Vertex[Hoja2.Vertices[0]][2]; 
     942        a = Vertex[Hoja2.Vert_Hoja[0]][0]; 
     943        b = Vertex[Hoja2.Vert_Hoja[0]][1]; 
     944        c = Vertex[Hoja2.Vert_Hoja[0]][2]; 
    945945 
    946946        dist[0] = ((Hoja1.Centro[0]-a)*(Hoja1.Centro[0]-a)) + ((Hoja1.Centro[1]-b)*(Hoja1.Centro[1]-b)) + 
     
    948948 
    949949         
    950         a = Vertex[Hoja2.Vertices[1]][0]; 
    951         b = Vertex[Hoja2.Vertices[1]][1]; 
    952         c = Vertex[Hoja2.Vertices[1]][2]; 
     950        a = Vertex[Hoja2.Vert_Hoja[1]][0]; 
     951        b = Vertex[Hoja2.Vert_Hoja[1]][1]; 
     952        c = Vertex[Hoja2.Vert_Hoja[1]][2]; 
    953953 
    954954        dist[1] = ((Hoja2.Centro[0]-a)*(Hoja2.Centro[0]-a)) + ((Hoja1.Centro[1]-b)*(Hoja1.Centro[1]-b)) + 
    955955                   ((Hoja2.Centro[2]-c)*(Hoja2.Centro[2]-c)); 
    956956 
    957         a = Vertex[Hoja2.Vertices[2]][0]; 
    958         b = Vertex[Hoja2.Vertices[2]][1]; 
    959         c = Vertex[Hoja2.Vertices[2]][2]; 
     957        a = Vertex[Hoja2.Vert_Hoja[2]][0]; 
     958        b = Vertex[Hoja2.Vert_Hoja[2]][1]; 
     959        c = Vertex[Hoja2.Vert_Hoja[2]][2]; 
    960960 
    961961        dist[2] = ((Hoja1.Centro[0]-a)*(Hoja1.Centro[0]-a)) + ((Hoja1.Centro[1]-b)*(Hoja1.Centro[1]-b)) + 
     
    963963 
    964964 
    965         a = Vertex[Hoja2.Vertices[3]][0]; 
    966         b = Vertex[Hoja2.Vertices[3]][1]; 
    967         c = Vertex[Hoja2.Vertices[3]][2]; 
     965        a = Vertex[Hoja2.Vert_Hoja[3]][0]; 
     966        b = Vertex[Hoja2.Vert_Hoja[3]][1]; 
     967        c = Vertex[Hoja2.Vert_Hoja[3]][2]; 
    968968 
    969969        dist[3] = ((Hoja1.Centro[0]-a)*(Hoja1.Centro[0]-a)) + ((Hoja1.Centro[1]-b)*(Hoja1.Centro[1]-b)) + 
     
    974974        DosMayores(dist, indices); 
    975975         
    976         Hojasa[counth].Vertices[2] = Hoja2.Vertices[indices[0]];  
    977         Hojasa[counth].Vertices[3] = Hoja2.Vertices[indices[1]];  
     976        Hojasa[counth].Vert_Hoja[2] = Hoja2.Vert_Hoja[indices[0]];  
     977        Hojasa[counth].Vert_Hoja[3] = Hoja2.Vert_Hoja[indices[1]];  
    978978 
    979979 
     
    10571057 
    10581058        // Nuevos vértices 
    1059         pasosimp.mNewQuad[0]=Hojasa[counth].Vertices[0]; 
    1060         pasosimp.mNewQuad[1]=Hojasa[counth].Vertices[1]; 
    1061         pasosimp.mNewQuad[2]=Hojasa[counth].Vertices[2]; 
    1062         pasosimp.mNewQuad[3]=Hojasa[counth].Vertices[3]; 
     1059        pasosimp.mNewQuad[0]=Hojasa[counth].Vert_Hoja[0]; 
     1060        pasosimp.mNewQuad[1]=Hojasa[counth].Vert_Hoja[1]; 
     1061        pasosimp.mNewQuad[2]=Hojasa[counth].Vert_Hoja[2]; 
     1062        pasosimp.mNewQuad[3]=Hojasa[counth].Vert_Hoja[3]; 
    10631063 
    10641064        // Insertar el paso de simplificación 
     
    11041104                if ( Hojasa[j].existe == true) // si la hoja aun existe 
    11051105                { 
    1106                         mesh->mSubMesh[idMeshLeaves].mIndex[indice]=Hojasa[j].Vertices[0]; 
    1107                         mesh->mSubMesh[idMeshLeaves].mIndex[indice+1]=Hojasa[j].Vertices[1]; 
    1108                         mesh->mSubMesh[idMeshLeaves].mIndex[indice+2]=Hojasa[j].Vertices[2]; 
    1109                         mesh->mSubMesh[idMeshLeaves].mIndex[indice+3]=Hojasa[j].Vertices[2]; 
    1110                         mesh->mSubMesh[idMeshLeaves].mIndex[indice+4]=Hojasa[j].Vertices[1]; 
    1111                         mesh->mSubMesh[idMeshLeaves].mIndex[indice+5]=Hojasa[j].Vertices[3]; 
     1106                        mesh->mSubMesh[idMeshLeaves].mIndex[indice]=Hojasa[j].Vert_Hoja[0]; 
     1107                        mesh->mSubMesh[idMeshLeaves].mIndex[indice+1]=Hojasa[j].Vert_Hoja[1]; 
     1108                        mesh->mSubMesh[idMeshLeaves].mIndex[indice+2]=Hojasa[j].Vert_Hoja[2]; 
     1109                        mesh->mSubMesh[idMeshLeaves].mIndex[indice+3]=Hojasa[j].Vert_Hoja[2]; 
     1110                        mesh->mSubMesh[idMeshLeaves].mIndex[indice+4]=Hojasa[j].Vert_Hoja[1]; 
     1111                        mesh->mSubMesh[idMeshLeaves].mIndex[indice+5]=Hojasa[j].Vert_Hoja[3]; 
    11121112                        indice=indice+6; 
    11131113                } 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Arbol.cpp

    r831 r834  
    522522        { 
    523523                j=i; 
    524                 while (Hojas[j].padre != -1) j= Hojas[j].padre; 
     524                while (Hojas[j].padre > -1) j= Hojas[j].padre; 
    525525                Hojas[i].raiz = j; 
    526526 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Hoja.cpp

    r830 r834  
    1 #include <GL\glut.h> 
     1#include <math.h> 
    22#include "Hoja.h" 
    33 
     
    77//-------------------------------------------------------------------------------------------------------------------------------- 
    88Hoja::Hoja(void)  
    9 { 
    10          
    11         Vert_Hoja[0] = Vert_Hoja[1] = Vert_Hoja[2] = Vert_Hoja[3] = 0; 
     9{        
     10        Vert_Hoja[0] = Vert_Hoja[1] = Vert_Hoja[2] = Vert_Hoja[3] =0;  
     11        Centro[0] = Centro[1] = Centro[2] = 0; 
    1212        Normal[0] = Normal[1] = Normal[2] = 0; 
     13        hoja_cerca=-1; 
     14        Cuantas_hojas = 1; 
     15        dist = coplanar = criterio = hoja_cop = hoja_crit =-1; 
     16        existe = true; 
    1317        padre=-1; 
    14         Cuantas_hojas = 1; 
    1518        hijoi = hijod = -1; 
    1619        raiz= visible= -1; 
    17 //      prev = next = -1; 
    18          
    19                  
    2020} 
    2121 
     
    2727Hoja::Hoja (const Hoja& aHoja) 
    2828{ 
    29  
    30  
    3129        Cuantas_hojas = aHoja.Cuantas_hojas;; 
     30        hoja_cerca = aHoja.hoja_cerca; 
     31        hoja_crit = aHoja.hoja_crit; 
     32        dist = aHoja.dist; 
     33        existe = aHoja.existe; 
     34        coplanar = aHoja.coplanar; 
     35        hoja_cop = aHoja.hoja_cop; 
     36        criterio = aHoja.criterio; 
     37        for ( int i=0;i<3;i++){ 
     38                Centro[i] = aHoja.Centro[i]; 
     39                Normal[i] = aHoja.Normal[i]; 
     40        } 
     41        for (i = 0L; i < 4; i++) 
     42                Vert_Hoja[i] = aHoja.Vert_Hoja[i];  
     43         
    3244        padre = aHoja.padre; 
    3345        hijoi = aHoja.hijoi; 
     
    3547        visible = aHoja.visible; 
    3648        raiz = aHoja.raiz; 
    37          
    38         for (int i = 0L; i < 4; i++) 
    39                 Vert_Hoja[i] = aHoja.Vert_Hoja[i];  
    40         for ( i = 0L; i < 3; i++) 
    41                 Normal[i] = aHoja.Normal[i];  
    42          
    43  
    4449} 
    4550 
     
    4752 
    4853//-------------------------------------------------------------------------------------------------------------------------------- 
    49 // Destructor. We must deallocate the memory allocated for pointers to Vert_Hoja and edges 
     54// Destructor. We must deallocate the memory allocated for pointers to vertices and edges 
    5055//-------------------------------------------------------------------------------------------------------------------------------- 
    5156Hoja::~Hoja (void) 
     
    5459 
    5560 
     61//-------------------------------------------------------------------------------------------------------------------------------- 
     62//  CALCULA LA DISTANCIA ENTRE HOJAS 
     63//-------------------------------------------------------------------------------------------------------------------------------- 
     64 
     65float Hoja::Distancia (Hoja& Hoja1) 
     66{ 
     67        float dist =0; 
     68        float x1,y1,z1; 
     69 
     70        x1 = Hoja1.Centro[0]; y1 = Hoja1.Centro[1] ; z1 = Hoja1.Centro[2]; 
     71 
     72 
     73        //DISTANCIA ENTRE CENTROS 
     74 
     75        dist = ((Centro[0]-x1)*(Centro[0]-x1)) + ((Centro[1]-y1)*(Centro[1]-y1)) + ((Centro[2]-z1)*(Centro[2]-z1)); 
     76 
     77        return (dist); 
     78} 
     79 
     80 
     81//-------------------------------------------------------------------------------------------------------------------------------- 
     82//  CALCULA LA COPLANARIDAD ENTRE HOJAS 
     83//-------------------------------------------------------------------------------------------------------------------------------- 
     84 
     85float Hoja::Coplanaridad (Hoja& Hoja1) 
     86{ 
     87        float cop =0; 
     88        float modulo1, modulo2; 
     89        float x1,y1,z1, nx1, ny1, nz1; 
     90        float nx, ny, nz; 
     91 
     92        //hoja pasada como parametro, normalizo las componentes 
     93        x1 = Hoja1.Normal[0]; y1 = Hoja1.Normal[1] ; z1 = Hoja1.Normal[2]; 
     94        modulo1 = sqrt ( (x1*x1) + (y1*y1) + (z1*z1)); 
     95        nx1 = x1 / modulo1; 
     96        ny1 = y1 / modulo1; 
     97        nz1 = z1 / modulo1; 
     98 
     99        // hoja desde la que llamo 
     100 
     101        modulo2 = sqrt ( (Normal[0]*Normal[0]) + (Normal[1]*Normal[1]) + (Normal[2]*Normal[2])); 
     102        nx = Normal[0] / modulo2; 
     103        ny = Normal[1] / modulo2; 
     104        nz = Normal[2] / modulo2; 
     105 
     106        // producto escalar : si es proximo a 0, perpendiculares, a 1, coplanares 
     107 
     108        cop = (nx1*nx) + (ny1*ny) + (nz1*nz); 
     109 
     110 
     111        return (fabs(cop)); 
     112 
     113} 
     114 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r829 r834  
    19881988 
    19891989        //      New lod strips object. 
    1990         lodTreeLib      =       new     Geometry::LodTreeLibrary(lodfile, geomesh); 
     1990        lodTreeLib      =       new     Geometry::LodTreeLibrary(lodfile, geomesh,"\\\\quake\\home\\\Modelos\\betula_populifolia\\vertices.obj", 
     1991                                                                                "\\\\quake\\home\\\Modelos\\betula_populifolia\\hojas.obj", 
     1992                                                                                "\\\\quake\\home\\\Modelos\\betula_populifolia\\simplifica.obj"); 
    19911993 
    19921994        //      Sets the slider range. 
Note: See TracChangeset for help on using the changeset viewer.