A.I.M.S


surfaceOperation_d.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 #ifndef AIMS_SURFACE_SURFACEOPERATION_D_H
35 #define AIMS_SURFACE_SURFACEOPERATION_D_H
36 
38 #include <aims/mesh/texture.h>
39 #include <aims/resampling/motion.h>
40 
41 namespace aims
42 {
43 
44  template<int D, class T> std::vector<std::set<uint> >
46  {
47  const std::vector< AimsVector<uint,D> > & poly = surf.polygon();
48  uint n = poly.size();
49  std::vector<std::set<uint> > neigh( surf.vertex().size() );
50 
51  for ( uint i=0; i<n; ++i )
52  for ( uint j=0; j<D; ++j )
53  for ( uint k=0; k<D; ++k )
54  if ( j != k )
55  neigh[poly[i][j]].insert( poly[i][k] );
56 
57  return neigh;
58  }
59 
60  template<int D, class T> std::vector<std::set<uint> >
62  {
63  const std::vector< AimsVector<uint,D> > & poly = surf.polygon();
64  uint n = poly.size();
65  std::vector<std::set<uint> > neigh( surf.vertex().size() );
66 
67  for ( uint i=0; i<n; ++i )
68  for ( uint j=0; j<D; ++j )
69  for ( uint k=0; k<D; ++k )
70  if ( j != k )
71  neigh[poly[i][j]].insert( poly[i][k] );
72 
73  return neigh;
74  }
75 
76  template<int D, class T> std::vector<std::set<uint> >
78  {
79  const std::vector< AimsVector<uint,D> > & poly = surf.polygon();
80  uint n = poly.size();
81  std::vector<std::set<uint> > neigh( surf.vertex().size() );
82  std::vector<std::set<uint> > neigh_final( surf.vertex().size() );
83 
84  for ( uint i=0; i<n; ++i )
85  for ( uint j=0; j<D; ++j )
86  for ( uint k=0; k<D; ++k )
87  if ( j != k )
88  neigh[poly[i][j]].insert( poly[i][k] );
89 
90  for ( uint i=0; i<neigh.size() ; ++i)
91  {
92  std::set<uint> voisin=neigh[i];
93  std::set<uint> voisin_final=neigh[i];
94  std::set<uint>::iterator voisin_pt=voisin.begin();
95  for ( ; voisin_pt!=voisin.end(); ++voisin_pt)
96  {
97  uint j=*voisin_pt;
98  std::set<uint> vois2=neigh[j];
99  std::set<uint>::iterator v_pt=vois2.begin();
100  for ( ; v_pt!=vois2.end(); ++v_pt)
101  voisin_final.insert(*v_pt);
102  }
103  neigh_final[i]=voisin_final;
104  }
105 
106  return neigh_final;
107  }
108 
109 
110  template<int D, class T> std::vector<std::map<uint, float> >
112  {
113  const std::vector< AimsVector<uint,D> > & poly = surf.polygon();
114  uint n = poly.size();
115  const std::vector<Point3df> & vert = surf.vertex();
116  std::vector<std::map<uint, float> > neighDist(surf.vertex().size());
117  Point3df diff;
118  float dist;
119 
120  for ( uint i=0; i<n; ++i )
121  for ( uint j=0; j<D; ++j )
122  for ( uint k=0; k<D; ++k )
123  if ( j != k )
124  {
125  diff=vert[poly[i][j]] - vert[poly[i][k]]; // COURANT - VOISIN
126  dist = diff.norm(); //DISTANCE ENTRE LES DEUX;
127  neighDist[poly[i][j]][poly[i][k]] = dist;
128  }
129 
130  return neighDist;
131  }
132 
133  template<int D, class T>
135  {
136  typename AimsTimeSurface<D,T>::iterator is, fs=surface.end();
137  typename std::vector< AimsVector<uint,D> >::iterator ip, fp;
138  uint n = D/2;
139  for ( is=surface.begin(); is!=fs; ++is )
140  {
141  AimsSurface<D, T> & surf = is->second;
142  std::vector< AimsVector<uint,D> > & poly = surf.polygon();
143 
144  for ( ip=poly.begin(), fp=poly.end(); ip!=fp; ++ip )
145  {
146  AimsVector<uint,D> & p = *ip;
147  for ( uint i=0; i<n; ++i )
148  {
149  uint vert = p[i];
150  p[i] = p[D-i-1];
151  p[D-i-1] = vert;
152  }
153  }
154  }
155  }
156 
157 
158  template<int D, class T>
160  const AimsTimeSurface<D,T> & add )
161  {
162  typename AimsTimeSurface<D, T>::const_iterator is, es = add.end();
163  for( is=add.begin(); is!=es; ++is )
164  {
165  int t = is->first;
166  const AimsSurface<D, T> & imesh = is->second;
167  AimsSurface<D, T> & omesh = dst[t];
168  std::vector<Point3df> & vert = omesh.vertex();
169  std::vector<Point3df> & norm = omesh.normal();
170  std::vector<AimsVector<uint,D> > & poly = omesh.polygon();
171  const std::vector<Point3df> & vert2 = imesh.vertex();
172  const std::vector<Point3df> & norm2 = imesh.normal();
173  const std::vector<AimsVector<uint,D> > & poly2 = imesh.polygon();
174  unsigned i, j, n = vert.size(), m = vert2.size(), p = poly2.size();
175 
176  // copy vertices & normals
177  for ( i=0; i<m; ++i )
178  vert.push_back( vert2[i] );
179  for ( i=0, m=norm2.size(); i<m; ++i )
180  norm.push_back( norm2[i] );
181 
182  // translate & copy polygons
183  for ( i=0; i<p; ++i )
184  {
185  AimsVector<uint,D> pol;
186  for ( j=0; j<D; ++j )
187  pol[j] = poly2[i][j] + n;
188  poly.push_back( pol );
189  }
190  if( t == 0 )
191  dst.header().setProperty( "vertex_number", int( n + m ) );
192  }
193  }
194 
195  template<int D, class T>
197  const std::list<AimsTimeSurface<D,T> > & src )
198  {
199  dst.erase();
200  typename std::list<AimsTimeSurface<D,T> >::const_iterator
201  im, em = src.end();
202  for ( im=src.begin(); im!=em; ++im )
203  meshMerge( dst, *im );
204  }
205 
206 
207  template<int D, class T>
209  const Motion & motion )
210  {
211  typename AimsTimeSurface<D,T>::iterator itime, tend = mesh.end();
212  float norm;
213 
214  for( itime=mesh.begin(); itime!=tend; ++itime )
215  {
216  typedef std::vector< Point3df > Points;
217  Points& vertex = itime->second.vertex();
218  Points& normal = itime->second.normal();
219  unsigned nnorm = normal.size();
220  for( Points::size_type k = 0; k < vertex.size(); ++k )
221  {
222  vertex[ k ] = motion.transform( vertex[ k ] );
223  /* Denis: applying this transformation to normals is WRONG if
224  there is any scale factor ! */
225  if( k < nnorm )
226  {
227  normal[ k ] = motion.transform( normal[ k ] )
228  - motion.translation();
229  // normalize normals
230  norm = normal[k][0] * normal[k][0] + normal[k][1] * normal[k][1]
231  + normal[k][2] * normal[k][2];
232  norm = 1. / sqrt( norm );
233  normal[k][0] *= norm;
234  normal[k][1] *= norm;
235  normal[k][2] *= norm;
236  }
237  }
238  }
239  if( !motion.isDirect() )
240  invertSurfacePolygons( mesh );
241  }
242 
243 
244  template <int D, typename T>
247  const TimeTexture<int16_t> & tex,
248  int16_t value,
249  std::vector<size_t> ** overtIndex )
250  {
252  typename AimsTimeSurface<D,T>::const_iterator imt, jmt, emt = mesh.end();
253  typename TimeTexture<int16_t>::const_iterator itt, jtt, ett = tex.end();
254  if( overtIndex )
255  * overtIndex = new std::vector<size_t>;
256  jmt = mesh.begin();
257  imt = jmt;
258  jtt = tex.begin();
259  itt = jtt;
260  int ti = 0;
261  while( jmt != emt || jtt != ett )
262  {
263  if( jmt != emt )
264  imt = jmt;
265  if( jtt != ett )
266  itt = jtt;
267  AimsSurface<D,T> & mh = (*omesh)[ ti ];
268  std::vector<Point3df> & overt = mh.vertex();
269  std::vector<Point3df> & onorm = mh.normal();
270  std::vector<AimsVector<uint, D> > & opoly = mh.polygon();
271  const std::vector<Point3df> & vert = imt->second.vertex();
272  const std::vector<Point3df> & norm = imt->second.normal();
273  const std::vector<AimsVector<uint, D> > & poly = imt->second.polygon();
274  typename std::vector<AimsVector<uint, D> >::const_iterator
275  im, em = poly.end();
276  int i = 0, k;
277  const Texture<int16_t> & tx = itt->second;
278  std::map<uint, uint> vmap;
279  typename std::map<uint, uint>::iterator iv, ev = vmap.end();
280  unsigned nt;
281  bool absmaj, hasdist;
282  int16_t y, mval = 0;
283  Point3df g;
284  float dist, dist2;
285  for( im=poly.begin(); im != em; ++im )
286  {
287  std::map<int16_t, unsigned> vals;
288  nt = 0;
289  absmaj = false;
290  g = Point3df( 0, 0, 0 );
291  // let's have a vote
292  for( k=0; k<D; ++k )
293  {
294  g += vert[ (*im)[k] ];
295  y = tx[ (*im)[k] ];
296  unsigned & x = vals[y];
297  ++x;
298  if( x > nt )
299  {
300  nt = x;
301  mval = y;
302  absmaj = true;
303  }
304  else if( x == nt )
305  absmaj = false;
306  }
307  if( vals[ value ] == nt )
308  {
309  // 'value' is amongst the most taken value
310  if( !absmaj )
311  {
312  // take nearest vertex from barycenter with value in majority
313  g /= D;
314  dist = 0;
315  hasdist = false;
316  for( k=0; k<D; ++k )
317  {
318  y = tx[ (*im)[k] ];
319  if( vals[ y ] == nt )
320  {
321  dist2 = ( vert[ (*im)[k] ] - g ).norm2();
322  if( !hasdist || dist2 < dist )
323  {
324  dist = dist2;
325  mval = y;
326  }
327  }
328  }
329  if( mval == value )
330  absmaj = true;
331  }
332  // else absmaj == true: value has absolute majority
333  }
334  else
335  // value is in minority
336  absmaj = false;
337  if( absmaj )
338  { // copy polygon
340  for( k=0; k<D; ++k )
341  {
342  iv = vmap.find( (*im)[k] );
343  if( iv == ev )
344  {
345  vmap[ (*im)[k] ] = i;
346  p[k] = i;
347  overt.push_back( vert[ (*im)[k] ] );
348  onorm.push_back( norm[ (*im)[k] ] );
349  if( overtIndex )
350  (** overtIndex).push_back((*im)[k]);
351  ++i;
352  }
353  else
354  p[k] = iv->second;
355  }
356  opoly.push_back( p );
357  }
358  }
359  ++ti;
360  if( jmt != emt )
361  ++jmt;
362  if( jtt != ett )
363  ++jtt;
364  }
365  return omesh;
366  }
367 
368 
369  template <int D, typename T>
372  bool asDistance )
373  {
375  typename AimsTimeSurface<D,T>::const_iterator is, es = mesh.end();
376  uint i;
377 
378  for( is=mesh.begin(); is!=es; ++is )
379  {
380  const AimsSurface<D,T> & surf = is->second;
381  const std::vector<Point3df> & vert = surf.vertex();
382  const std::vector<AimsVector<uint,D> > & poly = surf.polygon();
383 
384  // create corresponding timestep texture
385  std::vector<float> & tx = (*tex)[ is->first ].data();
386  std::vector<unsigned> counts;
387  tx.reserve( vert.size() );
388  tx.insert( tx.end(), vert.size(), 0. );
389  counts.reserve( vert.size() );
390  counts.insert( counts.end(), vert.size(), 0 );
391 
392  // record edges sizes on all polygons
393  typename std::vector<AimsVector<uint,D> >::const_iterator
394  ip, ep = poly.end(), jp;
395  float n;
396 
397  for( ip=poly.begin(); ip!=ep; ++ip )
398  {
399  for( i=0; i<D; ++i )
400  {
401  // edge distance, accounted on both vertices of the edge
402  uint vi = (*ip)[i];
403  uint vj = (*ip)[ (i+1) % D ];
404  n = ( vert[ vi ] - vert[ vj ] ).norm();
405  tx[ vi ] += n;
406  tx[ vj ] += n;
407  // count
408  ++counts[ vi ];
409  ++counts[ vj ];
410  }
411  }
412 
413  // now average distances, and invert them to get a density
414  std::vector<float>::iterator it, et = tx.end();
415  std::vector<unsigned>::const_iterator itc;
416  if( asDistance )
417  for( it=tx.begin(), itc=counts.begin(); it!=et; ++it, ++itc )
418  if( *itc != 0. )
419  *it /= float( *itc );
420  else
421  *it = 0.; // to avoid NaN
422  else
423  for( it=tx.begin(), itc=counts.begin(); it!=et; ++it, ++itc )
424  *it = float( *itc ) / *it;
425  }
426 
427  return tex;
428  }
429 
430 
431  template <int D, typename T>
434  const AimsTimeSurface<D,T> & nummesh,
435  const AimsTimeSurface<D,T> & denommesh )
436  {
438  typename AimsTimeSurface<D,T>::const_iterator is, es = nummesh.end(),
439  ids, eds = denommesh.end();
440  uint i;
441 
442  for( is=nummesh.begin(), ids=denommesh.begin(); is!=es && ids!=eds;
443  ++is, ++ids )
444  {
445  const AimsSurface<D,T> & surf = is->second;
446  const std::vector<Point3df> & vert = surf.vertex();
447  const std::vector<AimsVector<uint,D> > & poly = surf.polygon();
448  const std::vector<Point3df> & dvert = ids->second.vertex();
449 
450  // create corresponding timestep texture
451  std::vector<float> & tx = (*tex)[ is->first ].data();
452  std::vector<unsigned> counts;
453  tx.reserve( vert.size() );
454  tx.insert( tx.end(), vert.size(), 0. );
455  counts.reserve( vert.size() );
456  counts.insert( counts.end(), vert.size(), 0 );
457 
458  // record edges sizes on all polygons
459  typename std::vector<AimsVector<uint,D> >::const_iterator
460  ip, ep = poly.end(), jp;
461  float n, dn;
462 
463  for( ip=poly.begin(); ip!=ep; ++ip )
464  {
465  for( i=0; i<D; ++i )
466  {
467  // edge distance, accounted on both vertices of the edge
468  uint vi = (*ip)[i];
469  uint vj = (*ip)[ (i+1) % D ];
470  n = ( vert[ vi ] - vert[ vj ] ).norm();
471  dn = ( dvert[ vi ] - dvert[ vj ] ).norm();
472  if( dn == 0. )
473  n = 1.; // what to do else ? (leave inf ?)
474  else
475  n /= dn;
476  tx[ vi ] = std::max( tx[ vi ], n );
477  tx[ vj ] = std::max( tx[ vj ], n );
478  // count
479  ++counts[ vi ];
480  ++counts[ vj ];
481  }
482  }
483 
484  /*
485  // now average distances
486  std::vector<float>::iterator it, et = tx.end();
487  std::vector<unsigned>::const_iterator itc;
488  for( it=tx.begin(), itc=counts.begin(); it!=et; ++it, ++itc )
489  if( *itc != 0. )
490  *it /= float( *itc );
491  else
492  *it = 0.; // to avoid NaN
493  */
494  }
495 
496  return tex;
497  }
498 
499 
500  namespace internal
501  {
503  std::map<std::pair<uint,uint>, uint> & segments,
504  uint i, uint j,
505  const std::vector<Point3df> & vert,
506  std::vector<Point3df> & overt )
507  {
508  std::pair<uint,uint> seg = std::make_pair( i, j );
509  std::map<std::pair<uint,uint>, uint>::const_iterator
510  iseg = segments.find( seg );
511  uint iout;
512  if( iseg == segments.end() )
513  {
514  Point3df p = ( vert[i] + vert[j] ) / 2;
515  iout = overt.size();
516  overt.push_back( p );
517  segments[ seg ] = iout;
518  }
519  else
520  iout = iseg->second;
521  return iout;
522  }
523 
524  }
525 
526 
527  template <typename T>
530  const Texture<T> & tex, T region )
531  {
532  const std::vector<Point3df> & vert = mesh.vertex();
533  const std::vector<AimsVector<uint,3> > & poly = mesh.polygon();
535  std::map<std::pair<uint,uint>, uint> segments;
536  std::vector<AimsVector<uint,3> >::const_iterator ip, ep = poly.end();
537  uint i, j, k;
538  bool ii, jj, kk;
539  std::vector<Point3df> & overt = outmesh->vertex();
540  std::vector<AimsVector<uint,2> > & opoly = outmesh->polygon();
541 
542  for( ip=poly.begin(); ip!=ep; ++ip )
543  {
544  bool done = false;
545  i = (*ip)[0];
546  j = (*ip)[1];
547  k = (*ip)[2];
548  // order indices
549  if( i > j )
550  {
551  i = j;
552  j = (*ip)[0];
553  }
554  if( i > k )
555  {
556  k = i;
557  i = (*ip)[2];
558  }
559  if( j > k )
560  {
561  uint w = k;
562  k = j;
563  j = w;
564  }
565  // find boundaries in triangle
566  if( region >= 0 )
567  {
568  if( tex[i] == region )
569  ii = true;
570  else
571  ii = false;
572  if( tex[j] == region )
573  jj = true;
574  else
575  jj = false;
576  if( tex[k] == region )
577  kk = true;
578  else
579  kk = false;
580  }
581  else
582  {
583  if( tex[i] != tex[j] && tex[i] != tex[k] && tex[j] != tex[k] )
584  {
585  // all different
586  Point3df center = ( vert[i] + vert[j] + vert[k] ) / 3.;
587  uint iop = overt.size();
588  overt.push_back( center );
589  uint iout = internal::take_mid_point_and_insert( segments, i, j, vert,
590  overt );
591  opoly.push_back( AimsVector<uint,2>( iout, iop ) );
592  iout = internal::take_mid_point_and_insert( segments, i, k, vert,
593  overt );
594  opoly.push_back( AimsVector<uint,2>( iout, iop ) );
595  iout = internal::take_mid_point_and_insert( segments, j, k, vert,
596  overt );
597  opoly.push_back( AimsVector<uint,2>( iout, iop ) );
598  done = true;
599  }
600  else
601  {
602  ii = false;
603  if( tex[i] == tex[j] )
604  jj = false;
605  else
606  jj = true;
607  if( tex[i] == tex[k] )
608  kk = false;
609  else
610  kk = true;
611  }
612  }
613 
614  if( !done && ( ii != jj || ii != kk ) )
615  {
616  std::vector<uint> ipts;
617  if( ii != jj )
618  ipts.push_back( internal::take_mid_point_and_insert( segments, i, j,
619  vert, overt ) );
620  if( ii != kk )
621  ipts.push_back( internal::take_mid_point_and_insert( segments, i, k,
622  vert, overt ) );
623  if( jj != kk )
624  ipts.push_back( internal::take_mid_point_and_insert( segments, j, k,
625  vert, overt ) );
626  opoly.push_back( AimsVector<uint,2>( ipts[0], ipts[1] ) );
627  }
628  }
629  return outmesh;
630  }
631 
632 
633  template <typename T>
636  const TimeTexture<T> & tex, T region )
637  {
638  AimsSurfaceTriangle::const_iterator imesh, jmesh, emesh = mesh.end();
639  imesh = mesh.begin();
640  jmesh = imesh;
641  if( jmesh != emesh )
642  ++jmesh;
644  itex = tex.begin(), jtex=itex, etex = tex.end();
645  if( jtex != etex )
646  ++jtex;
648  while( imesh != emesh && itex != etex )
649  {
650  unsigned mtimestep = imesh->first;
651  unsigned ttimestep = itex->first;
652  AimsSurface<2, Void> *tmesh = meshTextureBoundary( imesh->second,
653  itex->second, region );
654  (*outmesh)[ std::max( mtimestep, ttimestep ) ] = *tmesh;
655  delete tmesh;
656  if( jmesh->first < jtex->first )
657  {
658  imesh = jmesh;
659  if( jmesh != emesh )
660  ++jmesh;
661  }
662  else if( jmesh->first > jtex->first )
663  {
664  itex = jtex;
665  if( jtex != etex )
666  ++jtex;
667  }
668  else
669  {
670  imesh = jmesh;
671  if( jmesh != emesh )
672  ++jmesh;
673  itex = jtex;
674  if( jtex != etex )
675  ++jtex;
676  }
677  }
678  return outmesh;
679  }
680 
681 
682  template <int D, typename T>
684  int timestep,
685  const Point3df & direction )
686  {
687  const std::vector<Point3df> & vert = mesh[timestep].vertex();
688  std::vector<AimsVector<uint, D> > & poly = mesh[timestep].polygon();
689  std::multimap<float, AimsVector<uint, D> > sorted;
690  typename std::vector<AimsVector<uint, D> >::iterator
691  ip, ep = poly.end();
692  typename std::multimap<float, AimsVector<uint, D> >::iterator
693  im, em = sorted.end();
694  int d;
695  Point3df center;
696 
697  // sort using a map
698  for( ip=poly.begin(); ip!=ep; ++ip )
699  {
700  center = vert[(*ip)[0]];
701  for( d=1; d<D; ++d )
702  center += vert[(*ip)[d]];
703  sorted.insert( std::make_pair( center.dot( direction ), *ip ) );
704  }
705 
706  // rewrite polygons
707  for( im=sorted.begin(), ip=poly.begin(); im!=em; ++im, ++ip )
708  *ip = im->second;
709  }
710 
711 
712 }
713 
714 #endif
static std::vector< std::set< uint > > surfaceNeighbours2ndOrder(const AimsTimeSurface< D, T > &surf)
static void invertSurfacePolygons(AimsTimeSurface< D, T > &surface)
static TimeTexture< float > * meshEdgeLengthRatioTexture(const AimsTimeSurface< D, T > &nummesh, const AimsTimeSurface< D, T > &denommesh)
Calculate an edge length ratio in edges of two meshes with the same topology.
int nt
static TimeTexture< float > * meshDensity(const AimsTimeSurface< D, T > &mesh, bool asDistance=false)
Calculate a mesh density: inverse of the average edges distance If asDistance is true, then the average distance is returned instead of the density.
std::map< int, Texture< T > >::const_iterator const_iterator
Definition: texture.h:121
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
Definition: surface.h:547
static void meshTransform(AimsTimeSurface< D, T > &mesh, const Motion &trans)
Applies a transformation to a mesh.
float norm2(const AimsVector< T, D > &v1)
Definition: vector.h:838
static AimsTimeSurface< D, T > * meshExtract(const AimsTimeSurface< D, T > &mesh, const TimeTexture< int16_t > &tex, int16_t value, std::vector< size_t > **overtIndex=0)
bool isDirect() const
true if the transformation is direct, false if it changes orientation
std::map< int, AimsSurface< D, T > >::iterator iterator
Definition: surface.h:308
The template class to manage a mesh with time if needed.
Definition: surface.h:290
static std::vector< std::set< uint > > surfaceNeighbours(const AimsSurface< D, T > &surf)
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of vertices.
Definition: surface.h:93
AimsVector< float, 3 > Point3df
Definition: vector.h:237
static void sortPolygonsAlongDirection(AimsTimeSurface< D, T > &mesh, int timestep, const Point3df &direction)
Sort polygons along a given direction.
Point3dd transform(double x, double y, double z) const
const std::vector< AimsVector< uint, D > > & polygon() const
Get a const reference to the vector of polygons.
Definition: surface.h:108
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of verteces of the surface of index 0.
Definition: surface.h:335
const std::vector< Point3df > & normal() const
Get a const reference to the vector of normals.
Definition: surface.h:98
uint take_mid_point_and_insert(std::map< std::pair< uint, uint >, uint > &segments, uint i, uint j, const std::vector< Point3df > &vert, std::vector< Point3df > &overt)
const aims::PythonHeader & header() const
Get the header.
Definition: surface.h:317
The template class to manage a mesh.
Definition: surface.h:56
unsigned int uint
static std::vector< std::map< uint, float > > surfaceNeighbourDistance(const AimsTimeSurface< D, T > &surf)
static void meshMerge(AimsTimeSurface< D, T > &dst, const AimsTimeSurface< D, T > &add)
concatenates 2 meshes into one (adds the second to the first one)
virtual void setProperty(const std::string &, Object)
AIMSDATA_API float norm(const Tensor &thing)
Definition: tensor.h:141
static AimsSurface< 2, Void > * meshTextureBoundary(const AimsSurface< 3, Void > &mesh, const Texture< T > &tex, T region)
Extracts the boundary of region of value of the input texture, on the mesh.
const std::vector< Point3df > & normal() const
Get a const reference to the vector of normals of the 0 surface.
Definition: surface.h:341
T dot(const AimsVector< T, D > &other) const
Get the dot product between 2 vectors.
Definition: vector.h:698
std::map< int, AimsSurface< D, T > >::const_iterator const_iterator
Definition: surface.h:310
Affine 3D transformation.
const std::vector< AimsVector< uint, D > > & polygon() const
Get a const reference to the vector of polygons of the 0 surface.
Definition: surface.h:353
void erase()
Clear all the meshes.
Definition: surface.h:491