MeVisLab Toolbox Reference
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:
27
31 WEMQuad(const WEMQuad& q);
33 ~WEMQuad() override;
36
37 void reset();
38
40 void computeNormal() override;
42 inline unsigned int getNumNodes() const override { return 4; }
44 int getIndex(WEMNode* node) const override;
46 inline WEMNode* getNodeAt(unsigned int index) override { return _nodes[index]; }
48 inline const WEMNode* getNodeAt(unsigned int index) const override { return const_cast<WEMQuad*>(this)->getNodeAt(index); }
50 inline void setNode(unsigned int index, WEMNode* node) override { _nodes[index] = node; invalidateBoundingBox(); }
53 {
54 _nodes[0] = node1; _nodes[1] = node2; _nodes[2] = node3; _nodes[3] = node4;
56 }
60 bool contains(WEMNode* node) const override;
62 Vector3 getNodePositionAt(unsigned int index) const override { return _nodes[index]->getPosition(); }
63
65 int getIndex(WEMEdge* edge) const override;
67 inline WEMEdge* getEdgeAt(unsigned int index) override { return _edges[index]; }
69 inline const WEMEdge* getEdgeAt(unsigned int index) const override { return const_cast<WEMQuad*>(this)->getEdgeAt(index); }
71 inline void setEdge(unsigned int index, WEMEdge* edge) override { _edges[index] = edge; }
74 _edges[0] = edge1; _edges[1] = edge2; _edges[2] = edge3; _edges[3] = edge4;
76 }
80 bool contains(WEMEdge* edge) const override;
82 void removeEdges() override;
83
85 Vector3 getCentroid() const override;
86 void getCentroid(Vector3& centroid) const override;
88 double getPerimeter() const override;
90 double getArea() const override;
92 inline WEMNode* getOther(WEMNode* , WEMNode* ) override { return nullptr; }
94 inline const WEMNode* getOther(WEMNode* , WEMNode* ) const override { return nullptr; }
96 inline WEMEdge* getOther(WEMEdge* , WEMEdge* ) override { return nullptr; }
98 inline const WEMEdge* getOther(WEMEdge* , WEMEdge* ) const override { return nullptr; }
100 inline WEMEdge* getEdgeNotContaining(WEMNode* ) override { return nullptr; }
102 inline const WEMEdge* getEdgeNotContaining(WEMNode* ) const override { return nullptr; }
109 double getQuality() const override;
112 int isConcave() const override;
114 void mirror() override;
115
116private:
117 void resetQuad();
118
120 WEMNode* _nodes[4];
122 WEMEdge* _edges[4];
123};
124
#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:98
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:46
void removeEdges() override
Removes all edge pointers of this face.
WEMEdge * getEdgeNotContaining(WEMNode *) override
Returns the edge not containing given node.
Definition WEMQuad.h:100
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:94
WEMEdge * getOther(WEMEdge *, WEMEdge *) override
Returns the edge incident to this face that is not given as a parameter.
Definition WEMQuad.h:96
virtual void setNodes(WEMNode *node1, WEMNode *node2, WEMNode *node3, WEMNode *node4)
Sets the given nodes.
Definition WEMQuad.h:52
WEMNode * getOther(WEMNode *, WEMNode *) override
Returns the node incident to this face that is not given as a parameter.
Definition WEMQuad.h:92
const WEMEdge * getEdgeNotContaining(WEMNode *) const override
Returns the edge not containing given node.
Definition WEMQuad.h:102
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:67
void setNode(unsigned int index, WEMNode *node) override
Sets the given node to the given index in this face.
Definition WEMQuad.h:50
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:71
const WEMEdge * getOther(WEMEdge *, WEMEdge *) const override
Returns the edge incident to this face that is not given as a parameter.
Definition WEMQuad.h:98
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:62
unsigned int getNumNodes() const override
Returns the number of nodes.
Definition WEMQuad.h:42
~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:48
const WEMEdge * getEdgeAt(unsigned int index) const override
Returns the node at the given index in this face.
Definition WEMQuad.h:69
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:73
Target mlrange_cast(Source arg)
Generic version of checked ML casts.