Skip to content
Snippets Groups Projects
TriangleMesh.h 1.47 KiB
Newer Older
#ifndef __TRIANGLEMESH__FOR_MT__
#define __TRIANGLEMESH__FOR_MT__

#include <vector>
#include "../src/params.h"

/**
 * This is simple, minimalistically compatible (somewhat at the syntax level (*))
 * class alternative to the main MotionTracking class ActiveMesh.
 *
 * (*) It uses standard container (std::vector) instead of those of MotionTracking (MArray).
 * Data from both containers, however, can be accessed in a syntactically the same fashion,
 * i.e., with pointers and []. Modifying lengths of the containers differ.
 *
 * (*) Also the Vector3F is different from the MotionTracking one, yet they are similar.
 *
 * It is meant for rapid trying/debugging of basic "mesh-processing" mesh-not-modifying algorithms.
 */
class ActiveMesh
{
  public:
	std::vector<Vector3FC> Pos;        //list of mesh vertices
	std::vector<long unsigned int> ID; //list of triangles organized in tripplets of indices into the Pos array of vertices;
                                      //the array length should be 3x the number of triangles in the mesh
	std::vector<Vector3F> norm;        //list of vectors that are normal/orthogonal to the planes given by the individual triangles

	///input is filename
	///returns 0 on success, otherwise non-zero
	int ImportSTL(const char* filename);
	int ImportVTK(const char* filename);

	void CenterMesh(const Vector3F& newCentre);
	void ScaleMesh(const Vector3F& scale);

	void displayMesh(void); //defined in graphics.cpp
};

#endif