Changeset 988 for GTP


Ignore:
Timestamp:
05/26/06 09:12:36 (18 years ago)
Author:
gumbau
Message:
 
Location:
GTP/trunk/Lib/Geom/shared
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h

    r987 r988  
    248248 
    249249        //      Simplify the mesh object. 
    250         //bool 
    251         void    simplifyEdgeCollapse(); 
     250        bool    simplifyEdgeCollapse(); 
    252251 
    253252        //      Simplify the mesh object. 
  • GTP/trunk/Lib/Geom/shared/GeoTool/out.objf

    r986 r988  
    102102q 1255 1275 
    103103q 1277 
    104 q 1287 1277 
    105 q 1278 1277 
     104q 1287 
     105q 1278 
     106q 1279 1278 
     107q 1259 1278 
    106108q 1257 
     109q 1277 1257 
    107110q 1255 
    108111q 1256 1255 
     
    114117q 1256 
    115118q 1258 
    116 q 1257 
    117 q 1259 
    118 q 1278 
    119 q 1279 
    120 q 1287 1279 
    121 q 1280 1279 
    122 q 1261 
    123 q 1259 
     119q 1257 1258 
     120q 1259 1258 
    124121q 1260 
    125 q 1258 1260 
    126 q 1273 1260 
    127 q 1262 
    128 q 1261 
    129 q 1263 
    130 q 1280 1263 
    131 q 1281 
    132 q 1265 1281 
    133 q 1282 1281 
    134 q 1288 
    135 q 1280 1288 
    136 q 1287 1283 
    137 t 1267 1282 1267 1265 
    138 q 1266 1265 
    139 q 1264 
    140 q 1263 1264 
    141 q 1262 1264 
    142 q 1272 1266 
    143 t 1272 1262 1272 1273 
     122q 1273 
     123q 1262 1273 
     124q 1272 1273 
    144125q 1270 1273 
    145126q 1271 1274 
    146127t 1271 1268 1270 1269 
     128t 1288 1283 1288 1287 
     129q 1280 
     130q 1279 
     131q 1261 
     132q 1259 1261 
     133q 1260 1261 
     134q 1262 1261 
     135q 1263 
     136q 1280 
     137q 1281 
     138q 1288 1281 
     139q 1282 1281 
     140q 1265 
     141q 1263 
     142q 1264 
     143q 1262 1264 
     144q 1272 1264 
     145q 1266 
     146q 1265 
     147q 1267 1282 
    147148t 1453 1452 1453 1479 
    148149q 1478 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r985 r988  
    952952                                { 
    953953                                        //      Simplify the mesh object. 
    954                                         simplifyEdgeCollapse(); 
    955                                          
    956                                         delete  mMeshSimplifier; 
    957                                         geoMeshView->restoreContext(); 
     954                                        if(simplifyEdgeCollapse()) 
     955                                        { 
     956                                                delete  mMeshSimplifier; 
     957                                                geoMeshView->restoreContext(); 
     958                                        } 
    958959                                } 
    959960                                break; 
     
    10041005 
    10051006                                        //      Simplify the mesh object. 
    1006                                         simplifyEdgeCollapse(); 
    1007  
    1008                                         //      Create the simplification sequence. 
    1009                                         createSimplificationSequence(); 
     1007                                        if (simplifyEdgeCollapse()) 
     1008                                        { 
     1009                                                //      Create the simplification sequence. 
     1010                                                createSimplificationSequence(); 
     1011                                        } 
    10101012 
    10111013                                } 
     
    10411043                                        mGeoMesh        =       mesh_aux; 
    10421044 
     1045                                        // Visualize mesh. 
     1046                                        geoMeshView->setMesh(mGeoMesh); 
     1047 
    10431048                                        //      Simplify the mesh object. 
    1044                                         simplifyEdgeCollapse(); 
    1045  
    1046                                         //      Create the simplification sequence. 
    1047                                         createSimplificationSequence(); 
    1048                                          
    1049                                         delete  mMeshSimplifier; 
    1050                                         geoMeshView->restoreContext(); 
     1049                                        if (simplifyEdgeCollapse()) 
     1050                                        { 
     1051                                                //      Create the simplification sequence. 
     1052                                                createSimplificationSequence(); 
     1053                                                 
     1054                                                delete  mMeshSimplifier; 
     1055                                                geoMeshView->restoreContext(); 
     1056                                        } 
    10511057                                } 
    10521058 
     
    19051911//      Simplify the mesh object. 
    19061912//--------------------------------------------------------------------------- 
    1907 void    GeoMeshViewUI::simplifyEdgeCollapse() 
    1908 { 
    1909         Real    percent; 
    1910  
    1911         //----------------- 
    1912         geoMeshView->saveContext(); 
    1913  
    1914         //      Gets simplify option. 
    1915         if (mGeometryBased->value()) 
    1916         { 
    1917                 simplificationState     =       MESHSIMP; 
    1918                 mMeshSimplifier                 = new GeometryBasedSimplifier(mGeoMesh, 
    1919                                                                                                                                                                                                                         progress_function); 
    1920         } 
    1921         else 
    1922         { 
    1923                 simplificationState     =       VIEWPOINTDRIVEN; 
    1924                 mMeshSimplifier                 = new ViewPointDrivenSimplifier(mGeoMesh, 
    1925                                                                                                                                                                                                                                 progress_function); 
    1926         } 
    1927  
    1928         mMeshSimplifier->setMeshLeaves(idMeshLeaves); 
    1929  
    1930         if (mPercent->value()) 
    1931         { 
    1932                 // Simplificación por porcentaje 
    1933                 if (mMeshReduction->fvalue() <= 100.0 && mMeshReduction->fvalue()>0.0) 
    1934                 { 
    1935                         percent = mMeshReduction->fvalue(); 
    1936                         percent =       percent / 100.0; 
    1937                          
    1938  
    1939                         // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
    1940                         mMeshSimplifier->Simplify(percent); 
    1941  
    1942                         //      Deletes the previous mesh. 
    1943                         delete mUndoMesh; 
    1944  
    1945                         mUndoMesh       =       new Mesh(); 
    1946  
    1947                         //      Sets the undo mesh. 
    1948                         *mUndoMesh      =       *mGeoMesh; 
    1949  
    1950                         delete  mGeoMesh; 
    1951  
    1952                         mGeoMesh        =       mMeshSimplifier->GetMesh(); 
    1953  
    1954                         //      Visualize mesh. 
    1955                         geoMeshView->setMesh(mGeoMesh); 
    1956  
    1957                 } 
    1958                 else 
    1959                 { 
    1960                         fltk::alert("Wrong value for simplification.\n" 
    1961                                         "Valid values [0..100]"); 
    1962                 } 
    1963         } 
    1964         else 
    1965         { 
    1966                 // Simplificar hasta un número de vértices. 
    1967                 uint32 v        =       (uint32)mMeshReduction->fvalue(); 
    1968  
    1969                 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
    1970                 mMeshSimplifier->Simplify(v); 
    1971  
    1972                 //      Deletes the previous mesh. 
    1973                 delete mUndoMesh; 
    1974  
    1975                 mUndoMesh       =       new Mesh(); 
    1976  
    1977                 //      Sets the undo mesh. 
    1978                 *mUndoMesh      =       *mGeoMesh; 
    1979  
    1980                 delete  mGeoMesh; 
    1981  
    1982                 mGeoMesh        =       mMeshSimplifier->GetMesh(); 
    1983  
    1984                 //      Visualize the mesh. 
    1985                 geoMeshView->setMesh(mGeoMesh); 
    1986         } 
    1987 } 
     1913bool GeoMeshViewUI::simplifyEdgeCollapse() 
     1914{ 
     1915    Real    percent; 
     1916 
     1917    //    If input field empty. 
     1918    if (mMeshReduction->fvalue() <= 0.0) 
     1919    { 
     1920        return false; 
     1921    } 
     1922 
     1923    geoMeshView->saveContext(); 
     1924 
     1925    //    Debug. 
     1926    cout    <<    "Mesh Reduction: " 
     1927                <<    mMeshReduction->fvalue() 
     1928                <<    endl; 
     1929     
     1930    //    Gets simplify option. 
     1931    if (mGeometryBased->value()) 
     1932    { 
     1933        simplificationState    =    MESHSIMP; 
     1934        mMeshSimplifier         = new GeometryBasedSimplifier(mGeoMesh, 
     1935                                                                        
     1936                                     progress_function); 
     1937    } 
     1938    else 
     1939    { 
     1940        simplificationState    =    VIEWPOINTDRIVEN; 
     1941        mMeshSimplifier         = new ViewPointDrivenSimplifier(mGeoMesh, 
     1942                                                                        
     1943                                         progress_function); 
     1944    } 
     1945 
     1946    mMeshSimplifier->setMeshLeaves(idMeshLeaves); 
     1947 
     1948    if (mPercent->value()) 
     1949    { 
     1950        // Simplificación por porcentaje 
     1951        if (mMeshReduction->fvalue() <= 100.0 &&  
     1952mMeshReduction->fvalue() > 0.0) 
     1953        { 
     1954            percent    = mMeshReduction->fvalue(); 
     1955            percent    =    percent    / 100.0; 
     1956 
     1957            // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
     1958            mMeshSimplifier->Simplify(percent); 
     1959 
     1960            //    Deletes the previous mesh. 
     1961            delete mUndoMesh; 
     1962 
     1963            mUndoMesh    =    new Mesh(); 
     1964 
     1965            //    Sets the undo mesh. 
     1966            *mUndoMesh    =    *mGeoMesh; 
     1967 
     1968            delete    mGeoMesh; 
     1969 
     1970            mGeoMesh    =    mMeshSimplifier->GetMesh(); 
     1971 
     1972            //    Visualize mesh. 
     1973            geoMeshView->setMesh(mGeoMesh); 
     1974 
     1975        } 
     1976        else 
     1977        { 
     1978            fltk::alert("Wrong value for simplification.\n" 
     1979                    "Valid values [0..100]"); 
     1980             
     1981            return    false; 
     1982        } 
     1983    } 
     1984    else 
     1985    { 
     1986        // Simplificar hasta un número de vértices. 
     1987        uint32 v    =    (uint32)mMeshReduction->fvalue(); 
     1988 
     1989        // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
     1990        mMeshSimplifier->Simplify(v); 
     1991 
     1992        //    Deletes the previous mesh. 
     1993        delete mUndoMesh; 
     1994 
     1995        mUndoMesh    =    new Mesh(); 
     1996 
     1997        //    Sets the undo mesh. 
     1998        *mUndoMesh    =    *mGeoMesh; 
     1999 
     2000        delete    mGeoMesh; 
     2001 
     2002        mGeoMesh    =    mMeshSimplifier->GetMesh(); 
     2003 
     2004        //    Visualize the mesh. 
     2005        geoMeshView->setMesh(mGeoMesh); 
     2006    } 
     2007 
     2008    return    true; 
     2009} 
     2010 
    19882011 
    19892012//--------------------------------------------------------------------------- 
     
    20602083        secsimpl->Save(Geometry::Serializer("SimplifSequence.txt",Serializer::WRITE)); 
    20612084 
    2062         delete  secsimpl; 
     2085        //delete        secsimpl; 
    20632086} 
    20642087 
Note: See TracChangeset for help on using the changeset viewer.