Artec 3D Scanning SDK  2.0
IMesh.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: 3D mesh interface implementation - geometry only.
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 
11 #ifndef _IMESH_H_
12 #define _IMESH_H_
13 
14 #include <artec/sdk/base/IBlob.h>
15 #include <artec/sdk/base/IArray.h>
18 
19 namespace artec { namespace sdk { namespace base
20 {
21 
22 class IImage;
23 
24 /**
25 * @brief Indexed triangle mesh
26 *
27 * @details Contains points (vertices) and triangles (triplets of vertex indices).
28 * It may contain flat (per-triangle) and smooth (per-vertex) normals, calculate various data (triangle areas, edge lengths, etc.)
29 * and store one's internal data.
30 * @nosubgrouping
31 */
32 class IMesh : public IRevision
33 {
34 public:
35  /// @{ @name Data access functions
36  /**
37  * @brief Get points (vertices).
38  * @details IArrayPoint3F is used to access individual points.
39  * @return Pointer to the IArrayPoint3F array.
40  */
41  virtual IArrayPoint3F* getPoints() const = 0;
42 
43  /**
44  * @brief Set points (vertices).
45  * @param points Pointer to the IArrayPoint3F array.
46  */
47  virtual void setPoints(IArrayPoint3F* points) = 0;
48 
49  /**
50  * @brief Get triangles (triplets of vertex indices).
51  * @details IArrayIndexTriplet is used to access individual triangles.
52  * @return Pointer to the IArrayIndexTriplet array.
53  */
54  virtual IArrayIndexTriplet* getTriangles() const = 0;
55 
56  /**
57  * @brief Set triangles (triplets of vertex indices).
58  * @param triangles Pointer to the IArrayIndexTriplet array.
59  */
60  virtual void setTriangles(IArrayIndexTriplet* triangles) = 0;
61 
62  /**
63  * @brief Get vertex normals (smooth).
64  * @details IArrayPoint3F is used to access individual normals.
65  * @return Pointer to the IArrayPoint3F array.
66  */
67  virtual IArrayPoint3F* getPointsNormals() const = 0;
68 
69  /**
70  * @brief Set vertex normals (smooth).
71  * @param normals Pointer to the IArrayPoint3F array.
72  */
73  virtual void setPointsNormals(IArrayPoint3F* normals) = 0;
74 
75  /**
76  * @brief Get triangle normals (flat).
77  * @details IArrayPoint3F is used to access individual normals.
78  * @return Pointer to the IArrayPoint3F array.
79  */
80  virtual IArrayPoint3F* getTrianglesNormals() const = 0;
81 
82  /**
83  * @brief Set triangle normals (flat).
84  * @param normals Pointer to the IArrayPoint3F array.
85  */
86  virtual void setTrianglesNormals(IArrayPoint3F* normals) = 0;
87 
88  /**
89  * @brief Return point coordinates for i-th triangle.
90  * @param i Triangle index
91  * @return Triangle structure
92  */
93  virtual Triangle getTriangle(int i) const = 0;
94  /// @}
95 
96  /// @{ @name Calculated data functions
97  /**
98  * @brief Create calculated data.
99  * @param requested_mode Request to calculate information
100  * @param recreate_mode Request to re-calculate information
101  * @return Calculation result: the combination of the current flags.
102  */
103  virtual unsigned int calculate(unsigned int requested_mode, unsigned int recreate_mode = CM_None) = 0;
104 
105  /**
106  * @brief Get calculated data flags.
107  * @return Combination of the current flags .
108  */
109  virtual unsigned int getCalculated() = 0;
110 
111  /**
112  * @brief Clear unneeded data from mesh. Doing so won't clear any dependent data.
113  * @param requested_mode request to clear information (modes can be combined)
114  */
115  virtual void clear(int requested_mode = CM_ClearEverything) = 0;
116  /// @}
117 
118  /// @{ @name Point transformation functions
119  /**
120  * @brief Apply full transformation (motion / rotation / scale).
121  * @param matrix Transformation matrix.
122  */
123  virtual void transform(const Matrix4x4D& matrix) = 0;
124 
125  /**
126  * Apply translation.
127  * @param direction Direction vector.
128  */
129  virtual void translate(const Point3F & direction) = 0;
130 
131  /**
132  * Apply rotation.
133  * @param matrix Rotation matrix.
134  */
135  virtual void rotate(const Matrix4x4D& matrix) = 0;
136 
137  /**
138  * @brief Scale.
139  * @param factor Scale factor.
140  */
141  virtual void scale(float factor) = 0;
142 
143  /**
144  * @brief Scale.
145  * @param factor Scale factor.
146  * @param center Scaling center coordinates.
147  */
148  virtual void scale(float factor, const Point3F & center) = 0;
149  /// @}
150 
151  /// @{ @name Calculated data access functions
152 
153  /// @return Array of values.
154  virtual const IArrayPoint3F* getTrianglesCenters() const = 0;
155  virtual const IArrayPoint3F* getTrianglesAngles() const = 0;
156  virtual const IArrayFloat* getTrianglesAreas() const = 0;
157  virtual const IArrayPoint3F* getEdgeLengths() const = 0;
158  /// @}
159 
160  /// Check whether the mesh is empty.
161  virtual bool isEmpty() const = 0;
162 
163  /// @{ @name Calculated data existence verification
164 
165  /// @return True if property is present.
166  virtual bool hasNormals() const = 0;
167  virtual bool hasPointsNormals() const = 0;
168  virtual bool hasTrianglesNormals() const = 0;
169 
170  virtual bool hasTrianglesCenters() const = 0;
171  virtual bool hasTrianglesAngles() const = 0;
172  virtual bool hasTrianglesAreas() const = 0;
173  virtual bool hasEdgeLengths() const = 0;
174  /// @}
175 
176  /// @{ @name Internal functions
177 
178  /// @brief Set internal data (used for compatibility with existing code). Do not use this function.
179  virtual void setInternalData(void* p) = 0;
180  /// @brief Get internal data (used for compatibility with existing code). Do not use this function.
181  virtual void* getInternalData() const = 0;
182  /// @}
183 
184 };
185 
186 } } } // namespace artec::sdk::base
187 
188 #endif // _IMESH_H_
Indexed triangle mesh.
Definition: IMesh.h:32
virtual void setPointsNormals(IArrayPoint3F *normals)=0
Set vertex normals (smooth).
virtual void translate(const Point3F &direction)=0
Apply translation.
virtual void setTriangles(IArrayIndexTriplet *triangles)=0
Set triangles (triplets of vertex indices).
virtual void setTrianglesNormals(IArrayPoint3F *normals)=0
Set triangle normals (flat).
Transformation matrix.
Definition: Matrix.h:26
virtual bool hasPointsNormals() const =0
Interface to retrieve the object's revision history It can be used to create change history...
Definition: IRevision.h:24
Interface for array of float data that supports smart reference counting.
Definition: IArray.h:95
virtual void setInternalData(void *p)=0
Set internal data (used for compatibility with existing code). Do not use this function.
virtual void scale(float factor)=0
Scale.
virtual IArrayIndexTriplet * getTriangles() const =0
Get triangles (triplets of vertex indices).
virtual bool hasTrianglesNormals() const =0
virtual Triangle getTriangle(int i) const =0
Return point coordinates for i-th triangle.
virtual bool hasTrianglesAreas() const =0
virtual bool hasTrianglesCenters() const =0
virtual const IArrayPoint3F * getTrianglesCenters() const =0
virtual IArrayPoint3F * getPoints() const =0
Get points (vertices).
virtual unsigned int calculate(unsigned int requested_mode, unsigned int recreate_mode=CM_None)=0
Create calculated data.
virtual unsigned int getCalculated()=0
Get calculated data flags.
virtual void setPoints(IArrayPoint3F *points)=0
Set points (vertices).
Triangle defined by the three points
Definition: Types.h:49
virtual const IArrayPoint3F * getTrianglesAngles() const =0
virtual void transform(const Matrix4x4D &matrix)=0
Apply full transformation (motion / rotation / scale).
virtual void clear(int requested_mode=CM_ClearEverything)=0
Clear unneeded data from mesh.
virtual IArrayPoint3F * getTrianglesNormals() const =0
Get triangle normals (flat).
virtual void * getInternalData() const =0
Get internal data (used for compatibility with existing code). Do not use this function.
virtual IArrayPoint3F * getPointsNormals() const =0
Get vertex normals (smooth).
virtual void rotate(const Matrix4x4D &matrix)=0
Apply rotation.
virtual bool hasEdgeLengths() const =0
virtual const IArrayFloat * getTrianglesAreas() const =0
virtual const IArrayPoint3F * getEdgeLengths() const =0
virtual bool hasTrianglesAngles() const =0
Interface for array of point positions (vertices and normal vectors); F for float type...
Definition: IArray.h:128
Interface for array of triangles (relationship between vertices).
Definition: IArray.h:162
virtual bool isEmpty() const =0
Check whether the mesh is empty.
virtual bool hasNormals() const =0