X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBLSURFPlugin%2FBLSURFPlugin_Attractor.hxx;fp=src%2FBLSURFPlugin%2FBLSURFPlugin_Attractor.hxx;h=74260d6ff49985229c9e0a7274c9cbe389bb0684;hb=a02d4651d47c998d20ab26462c12a4eaba31fd2d;hp=0000000000000000000000000000000000000000;hpb=7f427dc3f53ebc8ba6da06a2b88ad0dd57988013;p=plugins%2Fblsurfplugin.git diff --git a/src/BLSURFPlugin/BLSURFPlugin_Attractor.hxx b/src/BLSURFPlugin/BLSURFPlugin_Attractor.hxx new file mode 100644 index 0000000..74260d6 --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_Attractor.hxx @@ -0,0 +1,144 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D +// +// This library is free software; 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 2.1 of the License. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// --- +// File : BLSURFPlugin_Attractor.hxx +// Authors : Renaud Nédélec (OCC) +// --- +// +// The idea of the algorithm used to calculate the distance on a +// non-euclidian parametric surface has been found in the ref. below: +// +// Ref:"Accurate Anisotropic Fast Marching for Diffusion-Based Geodesic Tractography" +// S. Jbabdi, P. Bellec, R. Toro, Daunizeau, M. Pélégrini-Issac, and H. Benali1 +// + +#ifndef _BLSURFPlugin_Attractor_HXX_ +#define _BLSURFPlugin_Attractor_HXX_ + +#include +#include +#include +#include +#include +#include +#include + +// OPENCASCADE includes +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifndef WNT +#include +#endif + +#include +#include +#include +#include +#include +#include + +#define TYPE_EXP 0 +#define TYPE_LIN 1 + +class BLSURFPlugin_Attractor { + + public: + + BLSURFPlugin_Attractor (); + BLSURFPlugin_Attractor (const TopoDS_Face& Face, const TopoDS_Shape& Attractor, const std::string& attEntry, double Step = 0.015); + bool init(); // Calculates the discrete points correponding to attractor + // and intialises the map of distances + double GetSize (double u, double v); + TopoDS_Face GetFace() const { return _face; } + TopoDS_Shape GetAttractorShape() const { return _attractorShape; } + std::string GetAttractorEntry() const { return _attEntry; } + double GetStep() const { return _step; } + std::vector GetParameters() const + { + double tab_params[] = {_startSize, _endSize, _actionRadius, _constantRadius}; + std::vector params (tab_params, tab_params + sizeof(tab_params) / sizeof(double) ); + return params; + } + + void SetParameters(double Start_Size, double End_Size, double Action_Radius, double Constant_Radius); + void SetType(int type){ _type = type; } + + void BuildMap(); // Builds the map of distances between source point and any point P(u,v) + bool IsMapBuilt() const { return _isMapBuilt; } // Controls if the map has been built + bool Empty() const { return _isEmpty; } + + typedef std::vector TDiscreteParam; + typedef std::vector< std::vector > TDistMap; + typedef std::vector< std::vector > TPointSet; + typedef std::set< std::vector > TTrialSet; + typedef std::vector Trial_Pnt; + typedef std::vector IJ_Pnt; + + private: + + TopoDS_Face _face; + TopoDS_Shape _attractorShape; + std::string _attEntry; + TDiscreteParam _vectU; + TDiscreteParam _vectV; + TDistMap _DMap; + TPointSet _known; + TTrialSet _trial; + int _type; // Type of function used to calculate the size from the distance (unused for now) + double _step; // Step between to value of the discretized parametric space in U or V direction + int _gridU; // Number of grid points in U direction + int _gridV; // Number of grid points in V direction + double _u1, _u2, _v1, _v2; // Bounds of the parametric space of the face + double _startSize, _endSize; // User parameters + double _actionRadius, _constantRadius; // + + bool _isMapBuilt; + bool _isEmpty; + + double _distance(double u, double v); +}; + +#endif