MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
WEMPolygon.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
19
22{
23public:
29 ~WEMPolygon() override;
32
34 void computeNormal() override;
36 inline unsigned int getNumNodes() const override
37 {
38 return _numNodes;
39 }
41 virtual inline void setNumNodes(unsigned int numNodes)
42 {
43 _numNodes = numNodes;
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<WEMPolygon*>(this)->getNodeAt(index);
56 }
59 inline void setNode(unsigned int index, WEMNode* node) override
60 {
61 _nodes[index] = node;
63 }
67 bool contains(WEMNode* node) const override;
69 virtual inline void addNode(WEMNode* node)
70 {
71 _nodes[_numNodes++] = node;
73 }
75 Vector3 getNodePositionAt(unsigned int index) const override
76 {
77 return _nodes[index]->getPosition();
78 }
79
81 int getIndex(WEMEdge* edge) const override;
83 inline WEMEdge* getEdgeAt(unsigned int index) override
84 {
85 return _edges[index];
86 }
88 inline const WEMEdge* getEdgeAt(unsigned int index) const override
89 {
90 return const_cast<WEMPolygon*>(this)->getEdgeAt(index);
91 }
93 inline void setEdge(unsigned int index, WEMEdge* edge) override
94 {
95 _edges[index] = edge;
96 }
100 bool contains(WEMEdge* edge) const override;
102 void removeEdges() override;
103
105 Vector3 getCentroid() const override;
106 void getCentroid(Vector3& centroid) const override;
108 double getPerimeter() const override;
110 double getArea() const override;
113 {
114 return nullptr;
115 }
117 const WEMNode* getOther(WEMNode*, WEMNode*) const override
118 {
119 return nullptr;
120 }
123 {
124 return nullptr;
125 }
127 const WEMEdge* getOther(WEMEdge*, WEMEdge*) const override
128 {
129 return nullptr;
130 }
133 {
134 return nullptr;
135 }
137 const WEMEdge* getEdgeNotContaining(WEMNode*) const override
138 {
139 return nullptr;
140 }
147 double getQuality() const override;
149 int isConcave() const override;
152 void mirror() override;
153
154private:
156 WEMNode* _nodes[WEM_MAX_NUM_NODES];
158 unsigned int _numNodes;
160 WEMEdge* _edges[WEM_MAX_NUM_NODES];
161};
162
const unsigned int WEM_MAX_NUM_NODES
Maximum number of nodes for polygons.
#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: polygon.
Definition WEMPolygon.h:22
Vector3 getNodePositionAt(unsigned int index) const override
Returns the world position of a node at the given index.
Definition WEMPolygon.h:75
void removeEdges() override
Removes all edge pointers 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 WEMPolygon.h:117
virtual void setNumNodes(unsigned int numNodes)
Sets the number of nodes.
Definition WEMPolygon.h:41
~WEMPolygon() override
Standard destructor.
double getQuality() const override
Calculates the quality of this face.
int getIndex(WEMEdge *edge) const override
Returns the index of the given edge.
WEMEdge * getEdgeNotContaining(WEMNode *) override
Returns the edge not containing given node.
Definition WEMPolygon.h:132
void computeNormal() override
Computes the normal.
WEMEdge * getOther(WEMEdge *, WEMEdge *) override
Returns the edge incident to this face that is not given as a parameter.
Definition WEMPolygon.h:122
void clone(WEMPolygon *polygon)
Clones given triangle.
WEMPolygon()
Standard constructor.
void replace(WEMEdge *orig, WEMEdge *replacement) override
Replaces the given orig node by the given replace edge.
const WEMEdge * getEdgeAt(unsigned int index) const override
Returns the edge at the given index in this face.
Definition WEMPolygon.h:88
const WEMEdge * getEdgeNotContaining(WEMNode *) const override
Returns the edge not containing given node.
Definition WEMPolygon.h:137
WEMNode * getNodeAt(unsigned int index) override
Returns the node at the given index in the face.
Definition WEMPolygon.h:48
const WEMNode * getNodeAt(unsigned int index) const override
Returns the node at the given index in the face.
Definition WEMPolygon.h:53
WEMPolygon(const WEMPolygon &p)
Standard copy constructor.
double getPerimeter() const override
Calculates the perimeter of this face.
void getCentroid(Vector3 &centroid) const override
virtual void addNode(WEMNode *node)
Adds the given node (dynamic).
Definition WEMPolygon.h:69
WEMEdge * getEdgeAt(unsigned int index) override
Returns the edge at the given index in this face.
Definition WEMPolygon.h:83
unsigned int getNumNodes() const override
Returns the number of nodes.
Definition WEMPolygon.h:36
Vector3 getCentroid() const override
Returns the geometric centroid of this face.
int getIndex(WEMNode *node) const override
Returns the index of the given node.
bool contains(WEMEdge *edge) const override
Returns whether this face contains the given edge.
const WEMEdge * getOther(WEMEdge *, WEMEdge *) const override
Returns the edge incident to this face that is not given as a parameter.
Definition WEMPolygon.h:127
int isConcave() const override
Checks whether this face is concave and returns the number of concavities.
void mirror() override
Mirrors this face.
void replace(WEMNode *orig, WEMNode *replacement) override
Replaces the given orig node by the given replace node.
bool contains(WEMNode *node) const override
Returns whether this face contains the given node.
double getArea() const override
Calculates the area of this face.
void setEdge(unsigned int index, WEMEdge *edge) override
Sets the given edge to the given index in this face.
Definition WEMPolygon.h:93
void setNode(unsigned int index, WEMNode *node) override
Sets the given node to the given index in face.
Definition WEMPolygon.h:59
WEMNode * getOther(WEMNode *, WEMNode *) override
Returns the node incident to this face that is not given as a parameter.
Definition WEMPolygon.h:112
Target mlrange_cast(Source arg)
Generic version of checked ML casts.