- Timestamp:
- 05/26/06 09:12:36 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
r987 r988 248 248 249 249 // Simplify the mesh object. 250 //bool 251 void simplifyEdgeCollapse(); 250 bool simplifyEdgeCollapse(); 252 251 253 252 // Simplify the mesh object. -
GTP/trunk/Lib/Geom/shared/GeoTool/out.objf
r986 r988 102 102 q 1255 1275 103 103 q 1277 104 q 1287 1277 105 q 1278 1277 104 q 1287 105 q 1278 106 q 1279 1278 107 q 1259 1278 106 108 q 1257 109 q 1277 1257 107 110 q 1255 108 111 q 1256 1255 … … 114 117 q 1256 115 118 q 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 119 q 1257 1258 120 q 1259 1258 124 121 q 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 122 q 1273 123 q 1262 1273 124 q 1272 1273 144 125 q 1270 1273 145 126 q 1271 1274 146 127 t 1271 1268 1270 1269 128 t 1288 1283 1288 1287 129 q 1280 130 q 1279 131 q 1261 132 q 1259 1261 133 q 1260 1261 134 q 1262 1261 135 q 1263 136 q 1280 137 q 1281 138 q 1288 1281 139 q 1282 1281 140 q 1265 141 q 1263 142 q 1264 143 q 1262 1264 144 q 1272 1264 145 q 1266 146 q 1265 147 q 1267 1282 147 148 t 1453 1452 1453 1479 148 149 q 1478 -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r985 r988 952 952 { 953 953 // Simplify the mesh object. 954 simplifyEdgeCollapse(); 955 956 delete mMeshSimplifier; 957 geoMeshView->restoreContext(); 954 if(simplifyEdgeCollapse()) 955 { 956 delete mMeshSimplifier; 957 geoMeshView->restoreContext(); 958 } 958 959 } 959 960 break; … … 1004 1005 1005 1006 // 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 } 1010 1012 1011 1013 } … … 1041 1043 mGeoMesh = mesh_aux; 1042 1044 1045 // Visualize mesh. 1046 geoMeshView->setMesh(mGeoMesh); 1047 1043 1048 // 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 } 1051 1057 } 1052 1058 … … 1905 1911 // Simplify the mesh object. 1906 1912 //--------------------------------------------------------------------------- 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 } 1913 bool 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 && 1952 mMeshReduction->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 1988 2011 1989 2012 //--------------------------------------------------------------------------- … … 2060 2083 secsimpl->Save(Geometry::Serializer("SimplifSequence.txt",Serializer::WRITE)); 2061 2084 2062 delete secsimpl;2085 //delete secsimpl; 2063 2086 } 2064 2087
Note: See TracChangeset
for help on using the changeset viewer.