00001 /*************************************************************************** 00002 * Copyright (c) 2005 Imetric 3D GmbH * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef MESH_DEGENERATION_H 00025 #define MESH_DEGENERATION_H 00026 00027 #include <bitset> 00028 #include <string> 00029 #include <vector> 00030 00031 #include "Evaluation.h" 00032 #include "Definitions.h" 00033 00034 namespace MeshCore { 00035 00036 class MeshKernel; 00037 class MeshGeomFacet; 00038 class MeshFacetIterator; 00039 00047 class MeshExport MeshEvalInvalids : public MeshEvaluation 00048 { 00049 public: 00053 MeshEvalInvalids (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00057 ~MeshEvalInvalids () { } 00061 bool Evaluate (); 00065 std::vector<unsigned long> GetIndices() const; 00066 }; 00067 00073 class MeshExport MeshFixInvalids : public MeshValidation 00074 { 00075 public: 00079 MeshFixInvalids (MeshKernel &rclM) : MeshValidation( rclM ) { } 00083 ~MeshFixInvalids () { } 00087 bool Fixup (); 00088 }; 00089 00098 class MeshExport MeshEvalDuplicatePoints : public MeshEvaluation 00099 { 00100 public: 00104 MeshEvalDuplicatePoints (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00108 ~MeshEvalDuplicatePoints () { } 00112 bool Evaluate (); 00116 std::vector<unsigned long> GetIndices() const; 00117 }; 00118 00124 class MeshExport MeshFixDuplicatePoints : public MeshValidation 00125 { 00126 public: 00130 MeshFixDuplicatePoints (MeshKernel &rclM) : MeshValidation( rclM ) { } 00134 ~MeshFixDuplicatePoints () { } 00138 bool Fixup (); 00139 }; 00140 00148 class MeshExport MeshEvalDuplicateFacets : public MeshEvaluation 00149 { 00150 public: 00154 MeshEvalDuplicateFacets (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00158 ~MeshEvalDuplicateFacets () { } 00162 bool Evaluate (); 00166 std::vector<unsigned long> GetIndices() const; 00167 }; 00168 00174 class MeshExport MeshFixDuplicateFacets : public MeshValidation 00175 { 00176 public: 00180 MeshFixDuplicateFacets (MeshKernel &rclM) : MeshValidation( rclM ) { } 00184 ~MeshFixDuplicateFacets () { } 00188 bool Fixup (); 00189 }; 00190 00200 class MeshExport MeshEvalDegeneratedFacets : public MeshEvaluation 00201 { 00202 public: 00206 MeshEvalDegeneratedFacets (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00210 ~MeshEvalDegeneratedFacets () { } 00214 bool Evaluate (); 00218 unsigned long CountEdgeTooSmall (float fMinEdgeLength) const; 00222 std::vector<unsigned long> GetIndices() const; 00223 }; 00224 00230 class MeshExport MeshFixDegeneratedFacets : public MeshValidation 00231 { 00232 public: 00236 MeshFixDegeneratedFacets (MeshKernel &rclM) : MeshValidation( rclM ) { } 00240 ~MeshFixDegeneratedFacets () { } 00244 bool Fixup (); 00249 unsigned long RemoveEdgeTooSmall (float fMinEdgeLength = MeshDefinitions::_fMinPointDistance, 00250 float fMinEdgeAngle = MeshDefinitions::_fMinEdgeAngle); 00251 }; 00252 00258 class MeshExport MeshEvalDeformedFacets : public MeshEvaluation 00259 { 00260 public: 00264 MeshEvalDeformedFacets (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00268 ~MeshEvalDeformedFacets () { } 00272 bool Evaluate (); 00276 std::vector<unsigned long> GetIndices() const; 00277 }; 00278 00286 class MeshExport MeshFixDeformedFacets : public MeshValidation 00287 { 00288 public: 00292 MeshFixDeformedFacets (MeshKernel &rclM, float fAngle) : MeshValidation( rclM ), fMaxAngle(fAngle) { } 00296 ~MeshFixDeformedFacets () { } 00300 bool Fixup (); 00301 00302 private: 00303 float fMaxAngle; 00304 }; 00305 00306 class MeshExport MeshEvalFoldsOnSurface : public MeshEvaluation 00307 { 00308 public: 00309 MeshEvalFoldsOnSurface (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00310 ~MeshEvalFoldsOnSurface() {} 00311 00312 bool Evaluate(); 00313 std::vector<unsigned long> GetIndices() const; 00314 00315 private: 00316 std::vector<unsigned long> indices; 00317 }; 00318 00319 class MeshExport MeshFixFoldsOnSurface : public MeshValidation 00320 { 00321 public: 00322 MeshFixFoldsOnSurface (MeshKernel &rclM) : MeshValidation( rclM ) { } 00323 ~MeshFixFoldsOnSurface() {} 00324 00325 bool Fixup(); 00326 }; 00327 00328 class MeshExport MeshEvalFoldsOnBoundary : public MeshEvaluation 00329 { 00330 public: 00331 MeshEvalFoldsOnBoundary (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00332 ~MeshEvalFoldsOnBoundary() {} 00333 00334 bool Evaluate(); 00335 std::vector<unsigned long> GetIndices() const; 00336 00337 private: 00338 std::vector<unsigned long> indices; 00339 }; 00340 00341 class MeshExport MeshFixFoldsOnBoundary : public MeshValidation 00342 { 00343 public: 00344 MeshFixFoldsOnBoundary (MeshKernel &rclM) : MeshValidation( rclM ) { } 00345 ~MeshFixFoldsOnBoundary() {} 00346 00347 bool Fixup(); 00348 }; 00349 00350 class MeshExport MeshEvalFoldOversOnSurface : public MeshEvaluation 00351 { 00352 public: 00353 MeshEvalFoldOversOnSurface (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00354 ~MeshEvalFoldOversOnSurface() {} 00355 00356 bool Evaluate(); 00357 std::vector<unsigned long> GetIndices() const 00358 { return this->indices; } 00359 00360 private: 00361 std::vector<unsigned long> indices; 00362 }; 00363 00369 class MeshExport MeshEvalBorderFacet : public MeshEvaluation 00370 { 00371 public: 00372 MeshEvalBorderFacet (const MeshKernel &rclB, std::vector<unsigned long>& f) 00373 : MeshEvaluation(rclB), _facets(f) {} 00374 virtual ~MeshEvalBorderFacet () {} 00375 bool Evaluate(); 00376 00377 protected: 00378 std::vector<unsigned long>& _facets; 00379 }; 00380 00381 // ---------------------------------------------------- 00382 00392 class MeshExport MeshEvalRangeFacet : public MeshEvaluation 00393 { 00394 public: 00398 MeshEvalRangeFacet (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00402 ~MeshEvalRangeFacet () { } 00406 bool Evaluate (); 00410 std::vector<unsigned long> GetIndices() const; 00411 }; 00412 00418 class MeshExport MeshFixRangeFacet : public MeshValidation 00419 { 00420 public: 00424 MeshFixRangeFacet (MeshKernel &rclM) : MeshValidation( rclM ) { } 00428 ~MeshFixRangeFacet () { } 00432 bool Fixup (); 00433 }; 00434 00440 class MeshExport MeshEvalRangePoint : public MeshEvaluation 00441 { 00442 public: 00446 MeshEvalRangePoint (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00450 ~MeshEvalRangePoint () { } 00454 bool Evaluate (); 00458 std::vector<unsigned long> GetIndices() const; 00459 }; 00460 00466 class MeshExport MeshFixRangePoint : public MeshValidation 00467 { 00468 public: 00472 MeshFixRangePoint (MeshKernel &rclM) : MeshValidation( rclM ) { } 00476 ~MeshFixRangePoint () { } 00480 bool Fixup (); 00481 }; 00482 00489 class MeshExport MeshEvalCorruptedFacets : public MeshEvaluation 00490 { 00491 public: 00495 MeshEvalCorruptedFacets (const MeshKernel &rclM) : MeshEvaluation( rclM ) { } 00499 ~MeshEvalCorruptedFacets () { } 00503 bool Evaluate (); 00507 std::vector<unsigned long> GetIndices() const; 00508 }; 00509 00516 class MeshExport MeshFixCorruptedFacets : public MeshValidation 00517 { 00518 public: 00522 MeshFixCorruptedFacets (MeshKernel &rclM) : MeshValidation( rclM ) { } 00526 ~MeshFixCorruptedFacets () { } 00530 bool Fixup (); 00531 }; 00532 00533 } // namespace MeshCore 00534 00535 #endif // MESH_DEGENERATION_H