MeVisLab Toolbox Reference
WEMTrianglePatch.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
15 #include "WEMPatch.h"
16 #include "WEMTriangle.h"
17 #include "WEMIndexedFace.h"
18 
19 
20 ML_START_NAMESPACE
21 
23 
26 {
27 public:
29  WEMTrianglePatch(unsigned int bs = 8192);
32  WEMTrianglePatch(WEM* wem, unsigned int bs = 8192);
40  ~WEMTrianglePatch() override = default;
42  WEMPatch* copy() override;
44  virtual void dispose();
45 
47  inline PatchTypes getPatchType() const override { return WEM_PATCH_TRIANGLES; }
48 
50 
52  inline unsigned int getNumFaces() const override { return _triangles.num(); }
54  inline WEMIndexVector<WEMTriangle>* getFaces() { return &_triangles; }
56  inline const WEMIndexVector<WEMTriangle>* getFaces() const { return const_cast<WEMTrianglePatch*>(this)->getFaces(); }
57 
59 
61  inline WEMFace* getFaceAt(unsigned int index) override { return _triangles.at(index); }
63  inline const WEMFace* getFaceAt(unsigned int index) const override { return const_cast<WEMTrianglePatch*>(this)->getFaceAt(index); }
65  inline WEMTriangle* getTriangleAt(unsigned int index) { return _triangles.at(index); }
67  inline const WEMTriangle* getTriangleAt(unsigned int index) const { return const_cast<WEMTrianglePatch*>(this)->getTriangleAt(index); }
69  WEMFace* addFace() override;
76  void delTriangle(WEMTriangle* triangle);
77 
79 
82 
84 
91 
93 
95  void convertIndexedFace(WEMIndexedFace* indexedFace, TriangulationModes triangulationMode);
96 
98  void sortFacesByZPosition() override;
99 
102  friend bool MLWEM_EXPORT operator==(const WEMTrianglePatch &x, const WEMTrianglePatch &y);
104  friend bool MLWEM_EXPORT operator!=(const WEMTrianglePatch &x, const WEMTrianglePatch &y);
105 
106 private:
108  WEMIndexVector<WEMTriangle> _triangles;
109 };
110 
112 
113 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
Defines the mesh component: face.
Definition: WEMFace.h:30
Dynamic vector, based on a memory pool. Keeps track on entry numbers of stored primitives.
Defines the mesh component: an face holding a list of up to 100 indices.
Defines the mesh component: node.
Definition: WEMNode.h:33
Base class for triangle and quad patches.
Definition: WEMPatch.h:48
This represents a WEMPatch consisting of triangles only.
virtual void dispose()
Disposes of internal data structures.
void removeNodeFromPatch(WEMNode *node)
Removes the given node from this patch.
const WEMIndexVector< WEMTriangle > * getFaces() const
Returns the pointer to the internal faces structure.
bool deleteNodeWithValenceThree(WEMNode *node)
Deletes a single node with a valence of three.
friend bool MLWEM_EXPORT operator!=(const WEMTrianglePatch &x, const WEMTrianglePatch &y)
Operator for not equality.
WEMTrianglePatch(unsigned int bs=8192)
Standard constructor.
WEMTriangle * addTriangle()
Instantiates a new WEMTriangle and adds it to the internal faces vector.
WEMFace * getFaceAt(unsigned int index) override
Returns the face at the given index.
void sortFacesByZPosition() override
Sorts the faces by the z-position of their centroids.
WEMTrianglePatch(WEMTrianglePatch &&other) noexcept
Move c'tor.
WEMTriangle * addTriangleNoUpdatePrimitiveValueLists()
Creates and adds a triangle to the internal faces vector. Returns a pointer to this new face.
WEMTrianglePatch & operator=(WEMTrianglePatch &&other) noexcept
Move assignment operator.
const WEMFace * getFaceAt(unsigned int index) const override
Returns the face at the given index.
unsigned int getNumFaces() const override
Returns the number of faces in the patch.
WEMTriangle * getTriangleAt(unsigned int index)
Returns the WEMTriangle at the given index.
WEMPatch * copy() override
Create a (deep) copy of the patch.
WEMTrianglePatch(const WEMTrianglePatch &wemPatch)
Copy constructor.
const WEMTriangle * getTriangleAt(unsigned int index) const
Returns the WEMTriangle at the given index.
~WEMTrianglePatch() override=default
Standard destructor.
WEMFace * addFace() override
Instantiates a new WEMTriangle and adds it to the internal faces vector. Returns a pointer to this ne...
WEMIndexVector< WEMTriangle > * getFaces()
Returns the pointer to the internal faces structure.
WEMTrianglePatch(WEM *wem, unsigned int bs=8192)
Constructor which takes a pointer to the WEM this WEMPatch is in.
void deleteNodesWithValenceThree()
Deletes all nodes with a valence of three.
void deleteTetrahedron(WEMNode *node)
Deletes a tetrahedron.
void convertIndexedFace(WEMIndexedFace *indexedFace, TriangulationModes triangulationMode)
Adds the given indexed face to this patch.
void delTriangle(WEMTriangle *triangle)
Deletes a triangle and erases it from the internal faces vector.
friend bool MLWEM_EXPORT operator==(const WEMTrianglePatch &x, const WEMTrianglePatch &y)
Operator for equality.
PatchTypes getPatchType() const override
Returns the mesh type.
Defines the mesh component: triangle.
Definition: WEMTriangle.h:27
A WEM comprises a number of WEMPatches.
Definition: WEM.h:88
TriangulationModes
Enumeration of the triangulation modes. Note that these are 'mirrored' in the SoWEM part.
PatchTypes
Enumeration of mesh types.
@ WEM_PATCH_TRIANGLES
Patch type: all faces are triangles.