/**************************************************************************** Copyright (C) 2010-2012 the Office National des Forêts (ONF), France and the Laboratoire des Sciences de l'Information et des Systèmes (LSIS), Marseille, France. All rights reserved. Contact : alexandre.piboule@onf.fr alexandra.bac@esil.univmed.fr Developers : Joris Ravaglia (ONF/LSIS) With modifications by : Alexandre PIBOULE (ONF) This file is part of PluginONFLSIS library 2.0. PluginONFLSIS is free library: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PluginShared is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PluginShared. If not, see . *****************************************************************************/ #ifndef OL_STEPTHROWPARTICULES05_H #define OL_STEPTHROWPARTICULES05_H #include "ct_step/abstract/ct_abstractstep.h" #include "ct_itemdrawable/ct_pointcluster.h" #include "ct_itemdrawable/abstract/ct_abstractitemgroup.h" #include "ct_pointcloudindex/ct_pointcloudindexvector.h" #ifdef USE_PCL #include "pcl/octree/octree_search.h" #endif class OL_StepThrowParticules05 : public CT_AbstractStep { // IMPORTANT pour avoir le nom de l'étape Q_OBJECT public: OL_StepThrowParticules05(); QString description() const override; CT_VirtualAbstractStep* createNewInstance() const final; protected: void declareInputModels(CT_StepInModelStructureManager& manager) final; void fillPostInputConfigurationDialog(CT_StepConfigurableDialog* postInputConfigDialog) final; void declareOutputModels(CT_StepOutModelStructureManager& manager) final; void compute() final; private: CT_AutoRenameModels _outParticulesModelName; CT_ResultGroup* _outRes; int _nbPtsMin; /** Nombre de points a partir duquel on opere une simplification sur le groupe */ double _distanceBetweenPoints; /** Distance entre deux points sur l'arc */ int _kNeighborsParticle; /** Nombre de voisins a prendre en compte lors de la projection des particules sur le nuage. */ double _radiusRepulsion; /** Rayon d'effet de la repulsion d'une particule sur les autres. */ int _kRepulsion; /** Constante entrant en jeu dans le calcul de la repulsion des particules entre elles. */ double _convergeThresh; /** Seuil pour dire si les particules ont converge ou non */ int _nbIterMax; /** Nombre d'iteration maximum sans convergence lors de la recherche des k-voisins */ bool _multiThread; bool _useOfOctree; /** Booleen qui indique si on souhaite utiliser un octree pour les gros groupes ou non */ double _octreeResolution; /** Resolution de l'octree pour la recherche des k-voisins */ int _nbPtsForUsingOctree; /** Nombre de points au dela duquel on utilise un octree lors de la simplification */ CT_PointCluster* simplifyPointCluster (const CT_PointCluster *inputGrp, double length); QList > createParticles(const CT_PointCluster *group, size_t n); #ifdef USE_PCL void projectParticles(const CT_PointCluster *inCluster, QList > &particles, size_t kNeighbors, pcl::octree::OctreePointCloudSearch *octree); #else void projectParticles(const CT_PointCluster *inCluster, QList > &particles, size_t kNeighbors); #endif void relaxParticles(QList > &particles, const double _repulsionRadius, const size_t kRepulsion); CT_Point computeParticleToParticleRepulsion(const CT_Point &query, const CT_Point &repulser, const double repulsionRadius, const size_t kRepulsion); bool hasConverged(const QList > &before, const QList > &after, const double convergeThresh); static void staticSimplifyPointCluster(CT_AbstractItemGroup *group); }; #endif // OL_STEPTHROWPARTICULES05_H