MeVisLab Toolbox Reference
WEMEdge.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 
17 ML_START_NAMESPACE
18 
20 
21 class WEMFace;
22 class WEMNode;
23 class WEMTriangle;
24 class WEMQuad;
25 
27 
30 {
31 public:
34 
36  WEMEdge(const WEMEdge& e);
37  WEMEdge(WEMEdge &&e) noexcept;
38  WEMEdge& operator=(WEMEdge &&e) noexcept;
39 
41  ~WEMEdge() override;
42 
44  void reset();
45 
47  void clone(WEMEdge* e);
48 
50  inline WEMNode* getHead() { return _head; }
52  inline const WEMNode* getHead() const { return const_cast<WEMEdge*>(this)->getHead(); }
54  inline void setHead(WEMNode* head) { _head = head; }
56  inline WEMNode* getTail() { return _tail; }
58  inline const WEMNode* getTail() const { return const_cast<WEMEdge*>(this)->getTail(); }
60  inline void setTail(WEMNode* tail) { _tail = tail; }
62  inline WEMFace* getLFace() { return _lFace; }
64  inline const WEMFace* getLFace() const { return const_cast<WEMEdge*>(this)->getLFace(); }
66  inline void setLFace(WEMFace* lFace){ _lFace = lFace; }
68  inline WEMFace* getRFace() { return _rFace; }
70  inline const WEMFace* getRFace() const { return const_cast<WEMEdge*>(this)->getRFace(); }
72  inline void setRFace(WEMFace* rFace){ _rFace = rFace; }
74  inline WEMTriangle* getLTriangle() { return (_lFace) ? reinterpret_cast<WEMTriangle*>(_lFace) : nullptr; }
76  inline const WEMTriangle* getLTriangle() const { return const_cast<WEMEdge*>(this)->getLTriangle(); }
78  inline WEMTriangle* getRTriangle() { return (_rFace) ? reinterpret_cast<WEMTriangle*>(_rFace) : nullptr; }
80  inline const WEMTriangle* getRTriangle() const { return const_cast<WEMEdge*>(this)->getRTriangle(); }
81 
85  inline const WEMTriangle* getOther(WEMTriangle *triangle) const { return const_cast<WEMEdge*>(this)->getOther(triangle); }
86 
88  inline WEMEdge* getLPred() { return _lPred; }
90  inline const WEMEdge* getLPred() const { return const_cast<WEMEdge*>(this)->getLPred(); }
92  inline void setLPred(WEMEdge* lPred){ _lPred = lPred; }
94  inline WEMEdge* getLSucc() { return _lSucc; }
96  inline const WEMEdge* getLSucc() const { return const_cast<WEMEdge*>(this)->getLSucc(); }
98  inline void setLSucc(WEMEdge* lSucc){ _lSucc = lSucc; }
100  inline WEMEdge* getRPred() { return _rPred; }
102  inline const WEMEdge* getRPred() const { return const_cast<WEMEdge*>(this)->getRPred(); }
104  inline void setRPred(WEMEdge* rPred){ _rPred = rPred; }
106  inline WEMEdge* getRSucc() { return _rSucc; }
108  inline const WEMEdge* getRSucc() const { return const_cast<WEMEdge*>(this)->getRSucc(); }
110  inline void setRSucc(WEMEdge* rSucc){ _rSucc = rSucc; }
111 
113  double getLength() const;
115  bool contains(WEMNode* node) const;
119  inline const WEMNode* getOther(WEMNode *node) const { return const_cast<WEMEdge*>(this)->getOther(node); }
123  inline const WEMFace* getOther(WEMFace *face) const { return const_cast<WEMEdge*>(this)->getOther(face); }
126  inline bool isBoundary() const { return ((_lFace == nullptr) || (_rFace == nullptr)); }
127 
129  void replace(WEMEdge* orig, WEMEdge* replacement);
131  void replace(WEMNode* orig, WEMNode* replacement);
133  void replace(WEMFace* orig, WEMFace* replacement);
134 
138  double getDihedralAngle() const;
139 
142  double getDotAngle() const;
143 
144 private:
145  void resetEdge();
146 
148  WEMNode* _head;
150  WEMNode* _tail;
152  WEMFace* _lFace;
154  WEMFace* _rFace;
156  WEMEdge* _lPred;
158  WEMEdge* _lSucc;
160  WEMEdge* _rPred;
162  WEMEdge* _rSucc;
163 };
164 
166 
167 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
Defines the mesh component: edge.
Definition: WEMEdge.h:30
~WEMEdge() override
Standard destructor.
WEMFace * getRFace()
Returns right face.
Definition: WEMEdge.h:68
WEMEdge * getLPred()
Returns lPred.
Definition: WEMEdge.h:88
void setHead(WEMNode *head)
Sets head node.
Definition: WEMEdge.h:54
void setRFace(WEMFace *rFace)
Sets right face.
Definition: WEMEdge.h:72
void setTail(WEMNode *tail)
Sets tail node.
Definition: WEMEdge.h:60
bool contains(WEMNode *node) const
Returns whether this edges contains the given node.
WEMEdge & operator=(WEMEdge &&e) noexcept
WEMTriangle * getLTriangle()
Returns left face as triangle.
Definition: WEMEdge.h:74
double getDihedralAngle() const
Computes and returns the edge's dihedral angle.
WEMEdge * getRSucc()
Returns rSucc.
Definition: WEMEdge.h:106
const WEMEdge * getRSucc() const
Returns rSucc.
Definition: WEMEdge.h:108
const WEMEdge * getLSucc() const
Returns lSucc.
Definition: WEMEdge.h:96
const WEMTriangle * getRTriangle() const
Returns right face as triangle.
Definition: WEMEdge.h:80
void setRPred(WEMEdge *rPred)
Sets rPred.
Definition: WEMEdge.h:104
void reset()
Resets the object to default constructed state.
const WEMFace * getLFace() const
Returns left face.
Definition: WEMEdge.h:64
double getDotAngle() const
Calculates angle between two incident faces.
WEMEdge(const WEMEdge &e)
Copy constructor.
const WEMNode * getHead() const
Returns head node.
Definition: WEMEdge.h:52
WEMEdge * getRPred()
Returns rPred.
Definition: WEMEdge.h:100
const WEMNode * getOther(WEMNode *node) const
Returns other node.
Definition: WEMEdge.h:119
const WEMFace * getRFace() const
Returns right face.
Definition: WEMEdge.h:70
WEMTriangle * getOther(WEMTriangle *triangle)
Returns other face.
void replace(WEMEdge *orig, WEMEdge *replacement)
Replaces the pointer orig by replacement to an edge.
void setLPred(WEMEdge *lPred)
Sets lPred.
Definition: WEMEdge.h:92
void setRSucc(WEMEdge *rSucc)
Sets rSucc.
Definition: WEMEdge.h:110
void setLSucc(WEMEdge *lSucc)
Sets lSucc.
Definition: WEMEdge.h:98
double getLength() const
Computes the length of edge.
const WEMTriangle * getLTriangle() const
Returns left face as triangle.
Definition: WEMEdge.h:76
WEMEdge()
Standard constructor.
WEMFace * getOther(WEMFace *face)
Returns other face.
WEMNode * getOther(WEMNode *node)
Returns other node.
WEMFace * getLFace()
Returns left face.
Definition: WEMEdge.h:62
const WEMFace * getOther(WEMFace *face) const
Returns other face.
Definition: WEMEdge.h:123
void setLFace(WEMFace *lFace)
Sets left face.
Definition: WEMEdge.h:66
const WEMEdge * getLPred() const
Returns lPred.
Definition: WEMEdge.h:90
const WEMEdge * getRPred() const
Returns rPred.
Definition: WEMEdge.h:102
void replace(WEMFace *orig, WEMFace *replacement)
Replaces the pointer orig by replacement to a face.
WEMTriangle * getRTriangle()
Returns right face as triangle.
Definition: WEMEdge.h:78
const WEMTriangle * getOther(WEMTriangle *triangle) const
Returns other face.
Definition: WEMEdge.h:85
bool isBoundary() const
Returns whether this is edge is a boundary edge.
Definition: WEMEdge.h:126
WEMNode * getHead()
Returns head node.
Definition: WEMEdge.h:50
const WEMNode * getTail() const
Returns tail node.
Definition: WEMEdge.h:58
void clone(WEMEdge *e)
Clones given edge.
WEMEdge(WEMEdge &&e) noexcept
WEMNode * getTail()
Returns tail node.
Definition: WEMEdge.h:56
void replace(WEMNode *orig, WEMNode *replacement)
Replaces the pointer orig by replacement to a node.
WEMEdge * getLSucc()
Returns lSucc.
Definition: WEMEdge.h:94
Defines the mesh component: face.
Definition: WEMFace.h:30
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
Defines the mesh component: triangle.
Definition: WEMTriangle.h:27