File: GenericIndexedMesh.h

package info (click to toggle)
cloudcompare 2.11.3-7.1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 58,224 kB
  • sloc: cpp: 229,982; ansic: 30,723; makefile: 84; sh: 20
file content (95 lines) | stat: -rw-r--r-- 3,328 bytes parent folder | download | duplicates (3)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//##########################################################################
//#                                                                        #
//#                               CCLIB                                    #
//#                                                                        #
//#  This program is free software; you can redistribute it and/or modify  #
//#  it under the terms of the GNU Library General Public License as       #
//#  published by the Free Software Foundation; version 2 or later of the  #
//#  License.                                                              #
//#                                                                        #
//#  This program is distributed in the hope that it will be useful,       #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          #
//#  GNU General Public License for more details.                          #
//#                                                                        #
//#          COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI)             #
//#                                                                        #
//##########################################################################

#ifndef GENERIC_INDEXED_MESH_HEADER
#define GENERIC_INDEXED_MESH_HEADER

//Local
#include "GenericMesh.h"

namespace CCLib
{

//! Triangle described by the indexes of its 3 vertices
struct VerticesIndexes
{
	union
	{
		struct
		{
			unsigned i1, i2, i3;
		};
		unsigned i[3];
	};

	//! Constructor with specified indexes
	VerticesIndexes(unsigned _i1, unsigned _i2, unsigned _i3)
		: i1(_i1)
		, i2(_i2)
		, i3(_i3)
	{}

	//! Default constructor
	VerticesIndexes()
		: i1(0)
		, i2(0)
		, i3(0)
	{}
};

//! A generic mesh with index-based vertex access
/** Implements the GenericMehs interface.
**/
class CC_CORE_LIB_API GenericIndexedMesh : public GenericMesh
{
public:

	//! Default destructor
	~GenericIndexedMesh() override = default;

	//! Returns the ith triangle
	/**	Virtual method to request a triangle with a specific index.
		The returned object can be temporary.
		\param triangleIndex of the requested triangle (between 0 and the mesh size-1)
		\return the requested triangle, or 0 if index value is not valid
	**/
	virtual GenericTriangle* _getTriangle(unsigned triangleIndex) = 0;

	//! Returns the indexes of the vertices of a given triangle
	/**	\param triangleIndex index of the triangle (between 0 and size(mesh)-1)
		\return the triangle indexes (or 0 if index value is not valid)
	**/
	virtual VerticesIndexes* getTriangleVertIndexes(unsigned triangleIndex) = 0;

	//! Returns the vertices of a given triangle
	/**	\param[in] triangleIndex index of the triangle (between 0 and the size(mesh)-1)
		\param[out] A first vertex
		\param[out] B second vertex
		\param[out] C third vertex
	**/
	virtual void getTriangleVertices(unsigned triangleIndex, CCVector3& A, CCVector3& B, CCVector3& C) const = 0;

	//! Returns the indexes of the vertices of the next triangle (relatively to the global iterator position)
	/**	\return the triangle indexes (or 0 if the global iterator is out of bounds)
	**/
	virtual VerticesIndexes* getNextTriangleVertIndexes() = 0;
};

}

#endif //GENERIC_INDEXED_MESH_HEADER