A.I.M.S algorithms


geometric.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 
36 #ifndef AIMS_MESH_GEOMETRIC_H
37 #define AIMS_MESH_GEOMETRIC_H
38 
39 #include <aims/mesh/texture.h>
40 #include <aims/mesh/surface.h>
41 #include <list>
42 
43 template <class T>
44 inline float sign(T x)
45 {
46  if (x>(T)0) return(1);
47  else
48  if (x<(T)0) return(-1);
49  else
50  return(0);
51 }
52 
53 
54 
55 // Cross product between two 3D points
57 {
58 
59  Point3df n;
60  n[0] = a[1]*b[2] - a[2]*b[1];
61  n[1] = a[2]*b[0] - a[0]*b[2];
62  n[2] = a[0]*b[1] - a[1]*b[0];
63  return (n);
64 }
65 
66 namespace aims
67 {
69  {
70  public:
71  typedef std::vector< std::list<unsigned> > NeighborList;
72  typedef std::vector< std::list<float> > WeightNeighborList;
73  typedef std::vector<float> WeightList;
74 
75  protected:
77  virtual ~GeometricProperties(); //car class derivee
78 
79  void doPhi();
80  void doTheta();
81  void doAlpha();
82  void doSimpleAlpha();
83  void doBeta();
84  void doDot();
85  void doSurface();
86  void doNeighbor();
87 
88  const WeightNeighborList & getPhi() const ;
89  const WeightNeighborList & getTheta() const ;
90  const WeightNeighborList & getDot() const ;
91  const WeightNeighborList & getSurface() const ;
92  const WeightList & getAlpha() const ;
93  const WeightList & getSimpleAlpha() const ;
94  const WeightList & getBeta() const ;
95  const NeighborList & getNeighbor() const;
96  const AimsSurfaceTriangle & getMesh() const;
97 
98  private:
99  const AimsSurfaceTriangle & _mesh;
100  NeighborList _neighbourso ;
101  NeighborList _triangleNeighbourso ;
102  WeightNeighborList _phi ;
103  WeightNeighborList _theta;
104  WeightList _alpha; // this represents sum(l*l*cotan(alpha))
105  WeightList _simplealpha; // this is just sum(alpha)
106  WeightList _beta;
107  WeightNeighborList _dot;
108  WeightNeighborList _surface;
109  NeighborList doTriangleNeighbor() ;
110 
111  };
112 
114  {
115  public:
116  Curvature(const AimsSurfaceTriangle & mesh);
117  virtual ~Curvature();
118  virtual Texture<float> doIt() = 0; //car defini dnas les classes derivees -> classe abstraite non instantiable
119  static void regularize(Texture<float> & tex, float ratio); // pas lie a une instance de la classe
120  static void getTextureProperties(const Texture<float> & tex); // pas lie a une instance de la classe
121  };
122 
124  {
125  public:
126  Curvature * createCurvature(const AimsSurfaceTriangle & mesh, const std::string & method );
127 
128  };
129 
131  {
132  public:
134  virtual ~FiniteElementCurvature();
135  virtual Texture<float> doIt();
136  };
137 
138 
139  // All these are Mean Curvature estimates
140 
141  class BoixCurvature : public Curvature
142  {
143  public:
144  BoixCurvature(const AimsSurfaceTriangle & mesh);
145  virtual ~BoixCurvature();
146  virtual Texture<float> doIt();
147  };
148 
150  {
151  public:
153  virtual ~BarycenterCurvature();
154  virtual Texture<float> doIt();
155  };
156 
157  // This is a Gaussian Curvature estimate
158 
160  {
161  public:
163  virtual ~BoixGaussianCurvature();
164  virtual Texture<float> doIt();
165  };
166 
167 
168 
169 }
170 
171 
172 
173 #endif
const WeightNeighborList & getDot() const
std::vector< std::list< float > > WeightNeighborList
Definition: geometric.h:72
const WeightNeighborList & getTheta() const
Curvature(const AimsSurfaceTriangle &mesh)
const WeightList & getBeta() const
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
const WeightNeighborList & getSurface() const
const WeightList & getAlpha() const
const NeighborList & getNeighbor() const
Curvature * createCurvature(const AimsSurfaceTriangle &mesh, const std::string &method)
std::vector< std::list< unsigned > > NeighborList
Definition: geometric.h:71
std::vector< float > WeightList
Definition: geometric.h:73
Point3df cross(Point3df a, Point3df b)
Definition: geometric.h:56
static void getTextureProperties(const Texture< float > &tex)
virtual Texture< float > doIt()
virtual ~BoixCurvature()
static void regularize(Texture< float > &tex, float ratio)
BoixGaussianCurvature(const AimsSurfaceTriangle &mesh)
virtual ~Curvature()
const AimsSurfaceTriangle & getMesh() const
FiniteElementCurvature(const AimsSurfaceTriangle &mesh)
BarycenterCurvature(const AimsSurfaceTriangle &mesh)
const WeightList & getSimpleAlpha() const
virtual Texture< float > doIt()
GeometricProperties(const AimsSurfaceTriangle &mesh)
const WeightNeighborList & getPhi() const
virtual Texture< float > doIt()=0
virtual Texture< float > doIt()
virtual Texture< float > doIt()
float sign(T x)
Definition: geometric.h:44
BoixCurvature(const AimsSurfaceTriangle &mesh)