MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLWEM/WEMBase/WEMPolygon.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00011 #ifndef __WEMPolygon_H
00012 #define __WEMPolygon_H
00013 
00014 #include "WEMFace.h"
00015 #include "WEMNode.h"
00016 
00017 ML_START_NAMESPACE
00018 
00020 class MLWEM_EXPORT WEMPolygon : public WEMFace
00021 {
00022 
00023 public:
00024 
00026   WEMPolygon();
00028   WEMPolygon(const WEMPolygon& p);
00030   virtual ~WEMPolygon();
00032   void clone(WEMPolygon* polygon);
00033 
00035   virtual void computeNormal();
00037   virtual inline unsigned int getNumNodes()   const               { return _numNodes; }
00039   virtual inline void setNumNodes(unsigned int numNodes)          { _numNodes = numNodes; }
00041   virtual int getIndex(WEMNode* node) const;
00043   virtual inline WEMNode* getNodeAt(unsigned int index)           { return _nodes[index]; }
00045   virtual inline const WEMNode* getNodeAt(unsigned int index) const  { return const_cast<WEMPolygon*>(this)->getNodeAt(index); }
00048   virtual inline void setNode(unsigned int index, WEMNode* node)  { _nodes[index] = node; }
00050   virtual void replace(WEMNode* orig, WEMNode* replacement);
00052   virtual bool contains(WEMNode* node) const;
00054   virtual inline void addNode(WEMNode* node)                      { _nodes[_numNodes ++] = node; }
00056   virtual Vector3 getNodePositionAt(unsigned int index) const    { return _nodes[index]->getPosition(); }
00057 
00059   virtual int getIndex(WEMEdge* edge) const;
00061   virtual inline WEMEdge* getEdgeAt(unsigned int index)           { return _edges[index]; }
00063   virtual inline const WEMEdge* getEdgeAt(unsigned int index) const  { return const_cast<WEMPolygon*>(this)->getEdgeAt(index); }
00065   virtual inline void setEdge(unsigned int index, WEMEdge* edge)  { _edges[index] = edge;}
00067   virtual void replace(WEMEdge* orig, WEMEdge* replacement);
00069   virtual bool contains(WEMEdge* edge) const;
00070 
00072   virtual Vector3 getCentroid() const;
00074   virtual double getPerimeter() const;
00076   virtual double getArea() const;
00078   virtual WEMNode* getOther(WEMNode* , WEMNode* )             { return NULL; }
00080   virtual const WEMNode* getOther(WEMNode* , WEMNode* ) const { return NULL; }
00082   virtual WEMEdge* getOther(WEMEdge* , WEMEdge* )             { return NULL; }
00084   virtual const WEMEdge* getOther(WEMEdge* , WEMEdge* ) const { return NULL; }
00086   virtual WEMEdge* getEdgeNotContaining(WEMNode* )            { return NULL; }
00088   virtual const WEMEdge* getEdgeNotContaining(WEMNode* ) const{ return NULL; }
00095   virtual double getQuality() const;
00097   virtual int isConcave() const;
00100   virtual void mirror();
00101 
00102 private:
00103 
00105   WEMNode* _nodes[WEM_MAX_NUM_NODES];
00107   unsigned int _numNodes;
00109   WEMEdge* _edges[WEM_MAX_NUM_NODES];
00110 };
00111 
00112 
00113 
00114 ML_END_NAMESPACE
00115 
00116 #endif // __WEMPolygon_H