MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
19
21
22class WEMNode;
23class WEMEdge;
24class WEMTrianglePatch;
25
27
30{
31public:
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
48
50 inline Vector3 getNormal() const
51 {
52 return _normal;
53 }
55 inline void setNormal(const Vector3& normal)
56 {
57 _normal = normal;
58 }
60 virtual void computeNormal() = 0;
61
63 virtual unsigned int getNumNodes() const = 0;
65 virtual int getIndex(WEMNode* node) const = 0;
67 virtual WEMNode* getNodeAt(unsigned int index) = 0;
69 virtual const WEMNode* getNodeAt(unsigned int index) const = 0;
71 virtual inline void setNode(unsigned int, WEMNode*)
72 {
73 invalidateBoundingBox();
74 }
76 virtual void replace(WEMNode* orig, WEMNode* replace) = 0;
78 virtual bool contains(WEMNode* node) const = 0;
80 virtual Vector3 getNodePositionAt(unsigned int index) const = 0;
81
83 virtual int getIndex(WEMEdge* edge) const = 0;
85 virtual inline WEMEdge* getEdgeAt(unsigned int)
86 {
87 return nullptr;
88 }
90 virtual inline const WEMEdge* getEdgeAt(unsigned int) const
91 {
92 return nullptr;
93 }
95 virtual inline void setEdge(unsigned int, WEMEdge*)
96 {
97 invalidateBoundingBox();
98 }
100 virtual void replace(WEMEdge* orig, WEMEdge* replace) = 0;
102 virtual bool contains(WEMEdge* edge) const = 0;
104 virtual void removeEdges() = 0;
105
107 virtual Vector3 getCentroid() const = 0;
108 virtual void getCentroid(Vector3& centroid) const = 0;
110 virtual double getPerimeter() const = 0;
112 virtual double getArea() const = 0;
116 {
117 return _isBoundingBoxValid;
118 }
120 {
121 _isBoundingBoxValid = false;
122 }
126 virtual const WEMNode* getOther(WEMNode* n1, WEMNode* n2) const = 0;
130 virtual const WEMEdge* getOther(WEMEdge* e1, WEMEdge* e2) const = 0;
134 virtual const WEMEdge* getEdgeNotContaining(WEMNode* n) const = 0;
135
142 virtual double getQuality() const = 0;
145 virtual int isConcave() const = 0;
148 virtual void mirror() = 0;
149
150protected:
153
156
159
160private:
161 void resetFace();
162};
163
165
#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:155
virtual Vector3 getCentroid() const =0
Returns the geometric centroid of a face.
virtual const WEMEdge * getEdgeNotContaining(WEMNode *n) const =0
Returns the edge not containing given node.
virtual WEMNode * getOther(WEMNode *n1, WEMNode *n2)=0
Returns the node incident to this face that is not given as a parameter.
bool _isBoundingBoxValid
Is the bounding box valid?
Definition WEMFace.h:158
virtual const WEMEdge * getEdgeAt(unsigned int) const
Returns the edge at the given index in face.
Definition WEMFace.h:90
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:119
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 void replace(WEMNode *orig, WEMNode *replace)=0
Replaces the given orig node by the given replace node.
bool isBoundingBoxValid() const
Definition WEMFace.h:115
virtual const WEMEdge * getOther(WEMEdge *e1, WEMEdge *e2) const =0
Returns the edge incident to this face that is not given as a parameter.
Vector3 getNormal() const
Returns the normal.
Definition WEMFace.h:50
Vector3 _normal
Normal.
Definition WEMFace.h:152
virtual void setNode(unsigned int, WEMNode *)
Sets the given node to the given index in face.
Definition WEMFace.h:71
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:55
void clone(WEMFace *face)
Clones given face.
virtual WEMEdge * getEdgeNotContaining(WEMNode *n)=0
Returns the edge not containing given node.
virtual WEMNode * getNodeAt(unsigned int index)=0
Returns the node at the given index in face.
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 double getPerimeter() const =0
Calculates the perimeter of face.
virtual WEMEdge * getEdgeAt(unsigned int)
Returns the edge at the given index in face.
Definition WEMFace.h:85
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:95
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.
WEMFace & operator=(WEMFace &&f) noexcept
virtual bool contains(WEMEdge *edge) const =0
Returns whether this face contains the given edge.
virtual void removeEdges()=0
Removes all edge pointers of this face.
virtual const WEMNode * getNodeAt(unsigned int index) const =0
Returns the node at the given index in face.
Defines the mesh component: node.
Definition WEMNode.h:33
This is the base class for the WEM elements nodes, edges, and faces.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.