MeVisLab Toolbox Reference
WEMFace.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 "WEMPrimitive.h"
16 #include "WEMBoundingBox.h"
17 
18 ML_START_NAMESPACE
19 
21 
22 class WEMNode;
23 class WEMEdge;
24 class WEMTrianglePatch;
25 
27 
30 {
31 public:
34 
36  WEMFace(const WEMFace& f);
37  WEMFace(WEMFace &&f) noexcept;
38  WEMFace& operator=(WEMFace &&f) noexcept;
39 
41  ~WEMFace() override;
42 
44  void reset();
45 
47  void clone(WEMFace* face);
48 
50  inline Vector3 getNormal() const { return _normal; }
52  inline void setNormal(const Vector3& normal) { _normal = normal; }
54  virtual void computeNormal() = 0;
55 
57  virtual unsigned int getNumNodes() const = 0;
59  virtual int getIndex(WEMNode* node) const = 0;
61  virtual WEMNode* getNodeAt(unsigned int index) = 0;
63  virtual const WEMNode* getNodeAt(unsigned int index) const = 0;
65  virtual inline void setNode(unsigned int , WEMNode* ) { invalidateBoundingBox(); }
67  virtual void replace(WEMNode* orig, WEMNode* replace) = 0;
69  virtual bool contains(WEMNode* node) const = 0;
71  virtual Vector3 getNodePositionAt(unsigned int index) const = 0;
72 
74  virtual int getIndex(WEMEdge* edge) const = 0;
76  virtual inline WEMEdge* getEdgeAt(unsigned int ) { return nullptr; }
78  virtual inline const WEMEdge* getEdgeAt(unsigned int ) const { return nullptr; }
80  virtual inline void setEdge(unsigned int , WEMEdge* ) { invalidateBoundingBox(); }
82  virtual void replace(WEMEdge* orig, WEMEdge* replace) = 0;
84  virtual bool contains(WEMEdge* edge) const = 0;
86  virtual void removeEdges() = 0;
87 
89  virtual Vector3 getCentroid() const = 0;
90  virtual void getCentroid(Vector3& centroid) const = 0;
92  virtual double getPerimeter() const = 0;
94  virtual double getArea() const = 0;
97  bool isBoundingBoxValid() const { return _isBoundingBoxValid; }
98  void invalidateBoundingBox() { _isBoundingBoxValid = false; }
100  virtual WEMNode* getOther(WEMNode* n1, WEMNode* n2) = 0;
102  virtual const WEMNode* getOther(WEMNode* n1, WEMNode* n2) const = 0;
104  virtual WEMEdge* getOther(WEMEdge* e1, WEMEdge* e2) = 0;
106  virtual const WEMEdge* getOther(WEMEdge* e1, WEMEdge* e2) const = 0;
110  virtual const WEMEdge* getEdgeNotContaining(WEMNode* n) const = 0;
111 
118  virtual double getQuality() const = 0;
121  virtual int isConcave() const = 0;
124  virtual void mirror() = 0;
125 
126 protected:
127 
130 
133 
136 
137 private:
138  void resetFace();
139 };
140 
142 
143 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
This class represents an axis aligned bounding box for a WEMPatch.
Defines the mesh component: edge.
Definition: WEMEdge.h:30
Defines the mesh component: face.
Definition: WEMFace.h:30
WEMBoundingBox _boundingBox
Bounding Box.
Definition: WEMFace.h:132
virtual Vector3 getCentroid() const =0
Returns the geometric centroid of a face.
virtual const WEMEdge * getOther(WEMEdge *e1, WEMEdge *e2) const =0
Returns the edge incident to this face that is not given as a parameter.
virtual WEMNode * getNodeAt(unsigned int index)=0
Returns the node at the given index in face.
bool _isBoundingBoxValid
Is the bounding box valid?
Definition: WEMFace.h:135
WEMFace(WEMFace &&f) noexcept
virtual void computeNormal()=0
Computes the normal.
virtual WEMEdge * getOther(WEMEdge *e1, WEMEdge *e2)=0
Returns the edge incident to this face that is not given as a parameter.
virtual int isConcave() const =0
Checks whether this face is concave.
virtual int getIndex(WEMNode *node) const =0
Returns the index of the given node.
void invalidateBoundingBox()
Definition: WEMFace.h:98
virtual bool contains(WEMNode *node) const =0
Returns whether this face contains the given node.
virtual double getQuality() const =0
Calculates the quality of the face.
void reset()
Resets the object to default constructed state.
virtual double getArea() const =0
Calculates the area of face.
virtual WEMNode * getOther(WEMNode *n1, WEMNode *n2)=0
Returns the node incident to this face that is not given as a parameter.
virtual void replace(WEMNode *orig, WEMNode *replace)=0
Replaces the given orig node by the given replace node.
virtual WEMEdge * getEdgeNotContaining(WEMNode *n)=0
Returns the edge not containing given node.
bool isBoundingBoxValid() const
Definition: WEMFace.h:97
Vector3 getNormal() const
Returns the normal.
Definition: WEMFace.h:50
Vector3 _normal
Normal.
Definition: WEMFace.h:129
virtual void setNode(unsigned int, WEMNode *)
Sets the given node to the given index in face.
Definition: WEMFace.h:65
virtual WEMEdge * getEdgeAt(unsigned int)
Returns the edge at the given index in face.
Definition: WEMFace.h:76
virtual const WEMEdge * getEdgeAt(unsigned int) const
Returns the edge at the given index in face.
Definition: WEMFace.h:78
virtual void replace(WEMEdge *orig, WEMEdge *replace)=0
Replaces the given orig node by the given replace edge.
virtual unsigned int getNumNodes() const =0
Returns the number of nodes.
~WEMFace() override
Standard destructor.
virtual void getCentroid(Vector3 &centroid) const =0
virtual WEMBoundingBox getBoundingBox()
Calculates the bounding box of face.
void setNormal(const Vector3 &normal)
Sets the normal.
Definition: WEMFace.h:52
void clone(WEMFace *face)
Clones given face.
virtual double getPerimeter() const =0
Calculates the perimeter of face.
virtual int getIndex(WEMEdge *edge) const =0
Returns the index of the given edge.
virtual void setEdge(unsigned int, WEMEdge *)
Sets the given edge to the given index in face.
Definition: WEMFace.h:80
WEMFace()
Standard constructor.
virtual Vector3 getNodePositionAt(unsigned int index) const =0
Returns a position of a node at a given index.
virtual void mirror()=0
Mirrors the face.
WEMFace(const WEMFace &f)
Standard copy constructor.
virtual bool contains(WEMEdge *edge) const =0
Returns whether this face contains the given edge.
virtual const WEMNode * getOther(WEMNode *n1, WEMNode *n2) const =0
Returns the node incident to this face that is not given as a parameter.
virtual void removeEdges()=0
Removes all edge pointers of this face.
WEMFace & operator=(WEMFace &&f) noexcept
virtual const WEMNode * getNodeAt(unsigned int index) const =0
Returns the node at the given index in face.
virtual const WEMEdge * getEdgeNotContaining(WEMNode *n) const =0
Returns the edge not containing given node.
Defines the mesh component: node.
Definition: WEMNode.h:33
This is the base class for the WEM elements nodes, edges, and faces.
Definition: WEMPrimitive.h:28