File: mesh.inl

package info (click to toggle)
sofa-framework 1.0~beta4-11
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 88,820 kB
  • ctags: 27,300
  • sloc: cpp: 151,126; ansic: 2,387; xml: 581; sh: 417; makefile: 68
file content (59 lines) | stat: -rw-r--r-- 2,386 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/******* COPYRIGHT ************************************************
*                                                                 *
*                         FlowVR Render                           *
*                   Parallel Rendering Library                    *
*                                                                 *
*-----------------------------------------------------------------*
* COPYRIGHT (C) 2005 by                                           *
* Laboratoire Informatique et Distribution (UMR5132) and          *
* INRIA Project MOVI. ALL RIGHTS RESERVED.                        *
*                                                                 *
* This source is covered by the GNU LGPL, please refer to the     *
* COPYING-LIB file for further information.                       *
*                                                                 *
*-----------------------------------------------------------------*
*                                                                 *
*  Original Contributors:                                         *
*    Jeremie Allard,                                              *
*    Clement Menier.                                              *
*                                                                 * 
*******************************************************************
*                                                                 *
* File: ./include/flowvr/render/mesh.h                            *
*                                                                 *
* Contacts:                                                       *
*                                                                 *
******************************************************************/
#ifndef FLOWVR_RENDER_MESH_INL
#define FLOWVR_RENDER_MESH_INL

namespace flowvr
{

namespace render
{

template<class Real>
void Mesh::calcExtDistMap(Mat4x4f mat, Real* dest, int nx, int ny, int nz, float /*maxDist*/, float fact)
{
  close(); // make sure the mesh is closed
  calcNormals(true);
  calcEdges();
  for (int z=0;z<nz;z++)
  {
    for (int y=0;y<ny;y++)
      for (int x=0;x<nx;x++)
      {
	*dest = calcDist(transform(mat,Vec3f((float)x,(float)y,(float)z)))*fact;
	++dest;
      }
    std::cout << '.' << std::flush;
  }
  std::cout << std::endl;
}

} // namespace render

} // namespace flowvr

#endif