ccLibAlgorithms.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef CCLIBALGORITHMS_H
  2. #define CCLIBALGORITHMS_H
  3. //##########################################################################
  4. //# #
  5. //# CLOUDCOMPARE #
  6. //# #
  7. //# This program is free software; you can redistribute it and/or modify #
  8. //# it under the terms of the GNU General Public License as published by #
  9. //# the Free Software Foundation; version 2 or later of the License. #
  10. //# #
  11. //# This program is distributed in the hope that it will be useful, #
  12. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  13. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  14. //# GNU General Public License for more details. #
  15. //# #
  16. //# COPYRIGHT: CloudCompare project #
  17. //# #
  18. //##########################################################################
  19. #include "ccHObject.h"
  20. #include <GeometricalAnalysisTools.h>
  21. class QWidget;
  22. class ccGenericPointCloud;
  23. class ccProgressDialog;
  24. namespace ccLibAlgorithms
  25. {
  26. //! Returns a default first guess for algorithms kernel size (one cloud)
  27. double GetDefaultCloudKernelSize(ccGenericPointCloud* cloud, unsigned knn = 12);
  28. //! Returns a default first guess for algorithms kernel size (several clouds)
  29. double GetDefaultCloudKernelSize(const ccHObject::Container& entities, unsigned knn = 12);
  30. /*** CCCoreLib "standalone" algorithms ***/
  31. //! Geometric characteristic (with sub option)
  32. struct GeomCharacteristic
  33. {
  34. GeomCharacteristic(CCCoreLib::GeometricalAnalysisTools::GeomCharacteristic c, int option = 0)
  35. : charac(c)
  36. , subOption(option)
  37. {}
  38. CCCoreLib::GeometricalAnalysisTools::GeomCharacteristic charac;
  39. int subOption = 0;
  40. };
  41. //! Set of GeomCharacteristic instances
  42. typedef std::vector<GeomCharacteristic> GeomCharacteristicSet;
  43. //! Computes geometrical characteristics (see GeometricalAnalysisTools::GeomCharacteristic) on a set of entities
  44. bool ComputeGeomCharacteristics(const GeomCharacteristicSet& characteristics,
  45. PointCoordinateType radius,
  46. ccHObject::Container& entities,
  47. const CCVector3* roughnessUpDir = nullptr,
  48. QWidget* parent = nullptr);
  49. //! Computes a geometrical characteristic (see GeometricalAnalysisTools::GeomCharacteristic) on a set of entities
  50. bool ComputeGeomCharacteristic( CCCoreLib::GeometricalAnalysisTools::GeomCharacteristic algo,
  51. int subOption,
  52. PointCoordinateType radius,
  53. ccHObject::Container& entities,
  54. const CCVector3* roughnessUpDir = nullptr,
  55. QWidget* parent = nullptr,
  56. ccProgressDialog* progressDialog = nullptr);
  57. //CCCoreLib algorithms handled by the 'ApplyCCCoreLibAlgorithm' method
  58. enum CC_LIB_ALGORITHM { CCLIB_ALGO_SF_GRADIENT,
  59. };
  60. //! Applies a standard CCCoreLib algorithm (see CC_LIB_ALGORITHM) on a set of entities
  61. bool ApplyCCLibAlgorithm( CC_LIB_ALGORITHM algo,
  62. ccHObject::Container& entities,
  63. QWidget* parent = nullptr,
  64. void** additionalParameters = nullptr);
  65. //! Scale matching algorithms
  66. enum ScaleMatchingAlgorithm { BB_MAX_DIM, BB_VOLUME, PCA_MAX_DIM, ICP_SCALE };
  67. //! Applies a standard CCCoreLib algorithm (see CC_LIB_ALGORITHM) on a set of entities
  68. bool ApplyScaleMatchingAlgorithm(ScaleMatchingAlgorithm algo,
  69. ccHObject::Container& entities,
  70. double icpRmsDiff,
  71. int icpFinalOverlap,
  72. unsigned refEntityIndex = 0,
  73. QWidget* parent = nullptr);
  74. }
  75. #endif