MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
WEMQuad.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 "WEMFace.h"
16#include "WEMNode.h"
17#include "WEMEdge.h"
18
20
22
25{
26public:
30 WEMQuad(const WEMQuad& q);
32 ~WEMQuad() override;
35
36 void reset();
37
39 void computeNormal() override;
41 inline unsigned int getNumNodes() const override
42 {
43 return 4;
44 }
46 int getIndex(WEMNode* node) const override;
48 inline WEMNode* getNodeAt(unsigned int index) override
49 {
50 return _nodes[index];
51 }
53 inline const WEMNode* getNodeAt(unsigned int index) const override
54 {
55 return const_cast<WEMQuad*>(this)->getNodeAt(index);
56 }
58 inline void setNode(unsigned int index, WEMNode* node) override
59 {
60 _nodes[index] = node;
62 }
65 {
66 _nodes[0] = node1;
67 _nodes[1] = node2;
68 _nodes[2] = node3;
69 _nodes[3] = node4;
71 }
75 bool contains(WEMNode* node) const override;
77 Vector3 getNodePositionAt(unsigned int index) const override
78 {
79 return _nodes[index]->getPosition();
80 }
81
83 int getIndex(WEMEdge* edge) const override;
85 inline WEMEdge* getEdgeAt(unsigned int index) override
86 {
87 return _edges[index];
88 }
90 inline const WEMEdge* getEdgeAt(unsigned int index) const override
91 {
92 return const_cast<WEMQuad*>(this)->getEdgeAt(index);
93 }
95 inline void setEdge(unsigned int index, WEMEdge* edge) override
96 {
97 _edges[index] = edge;
98 }
101 {
102 _edges[0] = edge1;
103 _edges[1] = edge2;
104 _edges[2] = edge3;
105 _edges[3] = edge4;
107 }
111 bool contains(WEMEdge* edge) const override;
113 void removeEdges() override;
114
116 Vector3 getCentroid() const override;
117 void getCentroid(Vector3& centroid) const override;
119 double getPerimeter() const override;
121 double getArea() const override;
123 inline WEMNode* getOther(WEMNode*, WEMNode*) override
124 {
125 return nullptr;
126 }
128 inline const WEMNode* getOther(WEMNode*, WEMNode*) const override
129 {
130 return nullptr;
131 }
133 inline WEMEdge* getOther(WEMEdge*, WEMEdge*) override
134 {
135 return nullptr;
136 }
138 inline const WEMEdge* getOther(WEMEdge*, WEMEdge*) const override
139 {
140 return nullptr;
141 }
144 {
145 return nullptr;
146 }
148 inline const WEMEdge* getEdgeNotContaining(WEMNode*) const override
149 {
150 return nullptr;
151 }
158 double getQuality() const override;
161 int isConcave() const override;
163 void mirror() override;
164
165private:
166 void resetQuad();
167
169 WEMNode* _nodes[4];
171 WEMEdge* _edges[4];
172};
173
#define MLWEM_EXPORT
Definition MLWEMSystem.h:18
Defines the mesh component: edge.
Definition WEMEdge.h:30
Defines the mesh component: face.
Definition WEMFace.h:30
void invalidateBoundingBox()
Definition WEMFace.h:119
virtual WEMNode * getNodeAt(unsigned int index)=0
Returns the node at the given index in face.
virtual WEMEdge * getEdgeAt(unsigned int)
Returns the edge at the given index in face.
Definition WEMFace.h:85
Defines the mesh component: node.
Definition WEMNode.h:33
Defines the mesh component: quad.
Definition WEMQuad.h:25
WEMQuad(const WEMQuad &q)
Standard copy constructor.
bool contains(WEMEdge *edge) const override
Returns whether this face contains the given edge.
bool contains(WEMNode *node) const override
Returns whether this face contains the given node.
void replace(WEMEdge *orig, WEMEdge *replacement) override
Replaces the given orig edge by the given replace edge.
void mirror() override
Mirrors this face. Note that edge information gets corrupted! Use WEM::buildEdgeConnectivity afterwar...
WEMNode * getNodeAt(unsigned int index) override
Returns the node at the given index in this face.
Definition WEMQuad.h:48
void removeEdges() override
Removes all edge pointers of this face.
WEMEdge * getEdgeNotContaining(WEMNode *) override
Returns the edge not containing given node.
Definition WEMQuad.h:143
Vector3 getCentroid() const override
Returns the geometric centroid of this face.
const WEMNode * getOther(WEMNode *, WEMNode *) const override
Returns the node incident to this face that is not given as a parameter.
Definition WEMQuad.h:128
WEMEdge * getOther(WEMEdge *, WEMEdge *) override
Returns the edge incident to this face that is not given as a parameter.
Definition WEMQuad.h:133
virtual void setNodes(WEMNode *node1, WEMNode *node2, WEMNode *node3, WEMNode *node4)
Sets the given nodes.
Definition WEMQuad.h:64
WEMNode * getOther(WEMNode *, WEMNode *) override
Returns the node incident to this face that is not given as a parameter.
Definition WEMQuad.h:123
const WEMEdge * getEdgeNotContaining(WEMNode *) const override
Returns the edge not containing given node.
Definition WEMQuad.h:148
void computeNormal() override
Computes the normal.
WEMEdge * getEdgeAt(unsigned int index) override
Returns the node at the given index in this face.
Definition WEMQuad.h:85
void setNode(unsigned int index, WEMNode *node) override
Sets the given node to the given index in this face.
Definition WEMQuad.h:58
int getIndex(WEMNode *node) const override
Returns the index of the given node.
int getIndex(WEMEdge *edge) const override
Returns the index of the given node.
void setEdge(unsigned int index, WEMEdge *edge) override
Sets the given edge to the given index in this face.
Definition WEMQuad.h:95
const WEMEdge * getOther(WEMEdge *, WEMEdge *) const override
Returns the edge incident to this face that is not given as a parameter.
Definition WEMQuad.h:138
double getPerimeter() const override
Calculates the perimeter of this face.
WEMQuad()
Standard constructor.
double getQuality() const override
Calculates the quality of face.
void replace(WEMNode *orig, WEMNode *replacement) override
Replaces the given orig node by the given replace node.
void reset()
void getCentroid(Vector3 &centroid) const override
Vector3 getNodePositionAt(unsigned int index) const override
Returns the position of a node at the given index.
Definition WEMQuad.h:77
unsigned int getNumNodes() const override
Returns the number of nodes.
Definition WEMQuad.h:41
~WEMQuad() override
Standard destructor.
const WEMNode * getNodeAt(unsigned int index) const override
Returns the node at the given index in this face.
Definition WEMQuad.h:53
const WEMEdge * getEdgeAt(unsigned int index) const override
Returns the node at the given index in this face.
Definition WEMQuad.h:90
double getArea() const override
Calculates the area of this face.
int isConcave() const override
Checks whether this face a concave polygon.
void clone(WEMQuad *quad)
Clones the given quad.
virtual void setEdges(WEMEdge *edge1, WEMEdge *edge2, WEMEdge *edge3, WEMEdge *edge4)
Sets the given edges.
Definition WEMQuad.h:100
Target mlrange_cast(Source arg)
Generic version of checked ML casts.