MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
18
20
21class WEMFace;
22class WEMNode;
23class WEMTriangle;
24class WEMQuad;
25
27
30{
31public:
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()
51 {
52 return _head;
53 }
55 inline const WEMNode* getHead() const
56 {
57 return const_cast<WEMEdge*>(this)->getHead();
58 }
60 inline void setHead(WEMNode* head)
61 {
62 _head = head;
63 }
65 inline WEMNode* getTail()
66 {
67 return _tail;
68 }
70 inline const WEMNode* getTail() const
71 {
72 return const_cast<WEMEdge*>(this)->getTail();
73 }
75 inline void setTail(WEMNode* tail)
76 {
77 _tail = tail;
78 }
80 inline WEMFace* getLFace()
81 {
82 return _lFace;
83 }
85 inline const WEMFace* getLFace() const
86 {
87 return const_cast<WEMEdge*>(this)->getLFace();
88 }
90 inline void setLFace(WEMFace* lFace)
91 {
92 _lFace = lFace;
93 }
95 inline WEMFace* getRFace()
96 {
97 return _rFace;
98 }
100 inline const WEMFace* getRFace() const
101 {
102 return const_cast<WEMEdge*>(this)->getRFace();
103 }
105 inline void setRFace(WEMFace* rFace)
106 {
107 _rFace = rFace;
108 }
111 {
112 return (_lFace) ? reinterpret_cast<WEMTriangle*>(_lFace) : nullptr;
113 }
115 inline const WEMTriangle* getLTriangle() const
116 {
117 return const_cast<WEMEdge*>(this)->getLTriangle();
118 }
121 {
122 return (_rFace) ? reinterpret_cast<WEMTriangle*>(_rFace) : nullptr;
123 }
125 inline const WEMTriangle* getRTriangle() const
126 {
127 return const_cast<WEMEdge*>(this)->getRTriangle();
128 }
129
133 inline const WEMTriangle* getOther(WEMTriangle* triangle) const
134 {
135 return const_cast<WEMEdge*>(this)->getOther(triangle);
136 }
137
140 {
141 return _lPred;
142 }
144 inline const WEMEdge* getLPred() const
145 {
146 return const_cast<WEMEdge*>(this)->getLPred();
147 }
149 inline void setLPred(WEMEdge* lPred)
150 {
151 _lPred = lPred;
152 }
155 {
156 return _lSucc;
157 }
159 inline const WEMEdge* getLSucc() const
160 {
161 return const_cast<WEMEdge*>(this)->getLSucc();
162 }
164 inline void setLSucc(WEMEdge* lSucc)
165 {
166 _lSucc = lSucc;
167 }
170 {
171 return _rPred;
172 }
174 inline const WEMEdge* getRPred() const
175 {
176 return const_cast<WEMEdge*>(this)->getRPred();
177 }
179 inline void setRPred(WEMEdge* rPred)
180 {
181 _rPred = rPred;
182 }
185 {
186 return _rSucc;
187 }
189 inline const WEMEdge* getRSucc() const
190 {
191 return const_cast<WEMEdge*>(this)->getRSucc();
192 }
194 inline void setRSucc(WEMEdge* rSucc)
195 {
196 _rSucc = rSucc;
197 }
198
200 double getLength() const;
202 bool contains(WEMNode* node) const;
206 inline const WEMNode* getOther(WEMNode* node) const
207 {
208 return const_cast<WEMEdge*>(this)->getOther(node);
209 }
213 inline const WEMFace* getOther(WEMFace* face) const
214 {
215 return const_cast<WEMEdge*>(this)->getOther(face);
216 }
219 inline bool isBoundary() const
220 {
221 return ((_lFace == nullptr) || (_rFace == nullptr));
222 }
223
230
234 double getDihedralAngle() const;
235
238 double getDotAngle() const;
239
240private:
241 void resetEdge();
242
244 WEMNode* _head;
246 WEMNode* _tail;
248 WEMFace* _lFace;
250 WEMFace* _rFace;
252 WEMEdge* _lPred;
254 WEMEdge* _lSucc;
256 WEMEdge* _rPred;
258 WEMEdge* _rSucc;
259};
260
262
#define MLWEM_EXPORT
Definition MLWEMSystem.h:18
Defines the mesh component: edge.
Definition WEMEdge.h:30
~WEMEdge() override
Standard destructor.
const WEMNode * getTail() const
Returns tail node.
Definition WEMEdge.h:70
WEMFace * getLFace()
Returns left face.
Definition WEMEdge.h:80
WEMTriangle * getLTriangle()
Returns left face as triangle.
Definition WEMEdge.h:110
void setHead(WEMNode *head)
Sets head node.
Definition WEMEdge.h:60
void setRFace(WEMFace *rFace)
Sets right face.
Definition WEMEdge.h:105
void setTail(WEMNode *tail)
Sets tail node.
Definition WEMEdge.h:75
WEMEdge * getRSucc()
Returns rSucc.
Definition WEMEdge.h:184
bool contains(WEMNode *node) const
Returns whether this edges contains the given node.
const WEMFace * getOther(WEMFace *face) const
Returns other face.
Definition WEMEdge.h:213
const WEMTriangle * getLTriangle() const
Returns left face as triangle.
Definition WEMEdge.h:115
double getDihedralAngle() const
Computes and returns the edge's dihedral angle.
const WEMEdge * getLSucc() const
Returns lSucc.
Definition WEMEdge.h:159
const WEMEdge * getLPred() const
Returns lPred.
Definition WEMEdge.h:144
void setRPred(WEMEdge *rPred)
Sets rPred.
Definition WEMEdge.h:179
const WEMTriangle * getRTriangle() const
Returns right face as triangle.
Definition WEMEdge.h:125
void reset()
Resets the object to default constructed state.
WEMFace * getOther(WEMFace *face)
Returns other face.
WEMNode * getHead()
Returns head node.
Definition WEMEdge.h:50
double getDotAngle() const
Calculates angle between two incident faces.
WEMEdge(const WEMEdge &e)
Copy constructor.
const WEMNode * getOther(WEMNode *node) const
Returns other node.
Definition WEMEdge.h:206
WEMFace * getRFace()
Returns right face.
Definition WEMEdge.h:95
WEMEdge * getLSucc()
Returns lSucc.
Definition WEMEdge.h:154
void replace(WEMEdge *orig, WEMEdge *replacement)
Replaces the pointer orig by replacement to an edge.
void setLPred(WEMEdge *lPred)
Sets lPred.
Definition WEMEdge.h:149
void setRSucc(WEMEdge *rSucc)
Sets rSucc.
Definition WEMEdge.h:194
const WEMNode * getHead() const
Returns head node.
Definition WEMEdge.h:55
WEMTriangle * getOther(WEMTriangle *triangle)
Returns other face.
void setLSucc(WEMEdge *lSucc)
Sets lSucc.
Definition WEMEdge.h:164
WEMEdge * getRPred()
Returns rPred.
Definition WEMEdge.h:169
WEMNode * getOther(WEMNode *node)
Returns other node.
double getLength() const
Computes the length of edge.
WEMEdge()
Standard constructor.
void setLFace(WEMFace *lFace)
Sets left face.
Definition WEMEdge.h:90
void replace(WEMFace *orig, WEMFace *replacement)
Replaces the pointer orig by replacement to a face.
WEMNode * getTail()
Returns tail node.
Definition WEMEdge.h:65
const WEMEdge * getRSucc() const
Returns rSucc.
Definition WEMEdge.h:189
bool isBoundary() const
Returns whether this is edge is a boundary edge.
Definition WEMEdge.h:219
const WEMEdge * getRPred() const
Returns rPred.
Definition WEMEdge.h:174
WEMEdge * getLPred()
Returns lPred.
Definition WEMEdge.h:139
const WEMTriangle * getOther(WEMTriangle *triangle) const
Returns other face.
Definition WEMEdge.h:133
void clone(WEMEdge *e)
Clones given edge.
WEMEdge(WEMEdge &&e) noexcept
void replace(WEMNode *orig, WEMNode *replacement)
Replaces the pointer orig by replacement to a node.
WEMTriangle * getRTriangle()
Returns right face as triangle.
Definition WEMEdge.h:120
const WEMFace * getLFace() const
Returns left face.
Definition WEMEdge.h:85
WEMEdge & operator=(WEMEdge &&e) noexcept
const WEMFace * getRFace() const
Returns right face.
Definition WEMEdge.h:100
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.
Defines the mesh component: triangle.
Definition WEMTriangle.h:27
Target mlrange_cast(Source arg)
Generic version of checked ML casts.