Subversion Repositories gelsvn

Rev

Rev 183 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
149 jab 1
#ifndef __HMESHUTIL_BUILD_MANIFOLD_H__
2
#define __HMESHUTIL_BUILD_MANIFOLD_H__
3
 
4
#include <vector>
5
#include "HMesh/Manifold.h"
362 jab 6
#include "Geometry/TriMesh.h"
149 jab 7
 
150 jab 8
namespace HMesh
149 jab 9
{
183 jab 10
 
149 jab 11
  /** Build a manifold from an indexed face set. The arguments are 
12
      the manifold m, the number of vertices, no_vertices, the vector 
13
      of vertices, vertvec, the number of faces, no_faces. facevec 
14
      is an array where each entry indicates the number of vertices
15
      in that face. The array indices contains all the corresponding 
16
      vertex indices in one concatenated list. touch is an optional array 
17
      of touch values for the vertices. */
18
	void build_manifold(HMesh::Manifold& m,
19
			    int no_vertices,
20
			    const CGLA::Vec3f* vertvec,
21
			    int no_faces,
22
			    const int *facevec,
23
			    const int * indices,
24
			    const int * touch=0);
362 jab 25
 
26
	/// Build a manifold directly from a TriMesh.
27
	inline void build_manifold(HMesh::Manifold& m, const Geometry::TriMesh& mesh)
28
	{
29
		std::vector<int> faces(mesh.geometry.no_faces(), 3);
30
		build_manifold(m, mesh.geometry.no_vertices(), 
31
						  &mesh.geometry.vertex(0), 
32
						  faces.size(), &faces[0], 
33
						  reinterpret_cast<const int*>(&mesh.geometry.face(0)));
34
	}
149 jab 35
 
36
}
37
 
38
#endif