MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLWEM/WEMBase/WEMEdge.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00011 #ifndef __WEMEdge_H
00012 #define __WEMEdge_H
00013 
00014 #include "WEMPrimitive.h"
00015 
00016 ML_START_NAMESPACE
00017 
00018 class WEMFace;
00019 class WEMNode;
00020 class WEMTriangle;
00021 class WEMQuad;
00022 
00024 class MLWEM_EXPORT WEMEdge : public WEMPrimitive 
00025 {
00026 
00027 public:
00029   WEMEdge();
00030 
00032   WEMEdge(const WEMEdge& e);
00033 
00035   virtual ~WEMEdge();
00036 
00038   void clone(WEMEdge* e);
00039 
00041   inline WEMNode* getHead()           { return _head; }
00043   inline const WEMNode* getHead() const { return const_cast<WEMEdge*>(this)->getHead(); }
00045   inline void setHead(WEMNode* head)  { _head = head; }
00047   inline WEMNode* getTail()           { return _tail; }
00049   inline const WEMNode* getTail() const { return const_cast<WEMEdge*>(this)->getTail(); }
00051   inline void setTail(WEMNode* tail)  { _tail = tail; }
00053   inline WEMFace* getLFace()          { return _lFace; }
00055   inline const WEMFace* getLFace() const { return const_cast<WEMEdge*>(this)->getLFace(); }
00057   inline void setLFace(WEMFace* lFace){ _lFace = lFace; }
00059   inline WEMFace* getRFace()          { return _rFace; }
00061   inline const WEMFace* getRFace() const { return const_cast<WEMEdge*>(this)->getRFace(); }
00063   inline void setRFace(WEMFace* rFace){ _rFace = rFace; }
00065   inline WEMTriangle* getLTriangle()  { return (_lFace) ? reinterpret_cast<WEMTriangle*>(_lFace) : NULL; }
00067   inline const WEMTriangle* getLTriangle() const { return const_cast<WEMEdge*>(this)->getLTriangle(); }
00069   inline WEMTriangle* getRTriangle()  { return (_rFace) ? reinterpret_cast<WEMTriangle*>(_rFace) : NULL; }
00071   inline const WEMTriangle* getRTriangle() const { return const_cast<WEMEdge*>(this)->getRTriangle(); }
00072 
00074   WEMTriangle* getOther(WEMTriangle *triangle);
00076   inline const WEMTriangle* getOther(WEMTriangle *triangle) const { return const_cast<WEMEdge*>(this)->getOther(triangle); }
00077 
00079   inline WEMEdge* getLPred()          { return _lPred;  }
00081   inline const WEMEdge* getLPred() const { return const_cast<WEMEdge*>(this)->getLPred(); }
00083   inline void setLPred(WEMEdge* lPred){ _lPred = lPred; } 
00085   inline WEMEdge* getLSucc()          { return _lSucc;  }
00087   inline const WEMEdge* getLSucc() const { return const_cast<WEMEdge*>(this)->getLSucc(); }
00089   inline void setLSucc(WEMEdge* lSucc){ _lSucc = lSucc; } 
00091   inline WEMEdge* getRPred()          { return _rPred;  }
00093   inline const WEMEdge* getRPred() const { return const_cast<WEMEdge*>(this)->getRPred(); }
00095   inline void setRPred(WEMEdge* rPred){ _rPred = rPred; } 
00097   inline WEMEdge* getRSucc()          { return _rSucc;  }
00099   inline const WEMEdge* getRSucc() const { return const_cast<WEMEdge*>(this)->getRSucc(); }
00101   inline void setRSucc(WEMEdge* rSucc){ _rSucc = rSucc; } 
00102 
00104   double getLength() const;
00106   bool contains(WEMNode* node) const;
00108   WEMNode* getOther(WEMNode *node);
00110   inline const WEMNode* getOther(WEMNode *node) const { return const_cast<WEMEdge*>(this)->getOther(node); }
00112   WEMFace* getOther(WEMFace *face);
00114   inline const WEMFace* getOther(WEMFace *face) const { return const_cast<WEMEdge*>(this)->getOther(face); }
00117   inline bool isBoundary() const { return ((_lFace == NULL) || (_rFace == NULL)); }
00118 
00120   void replace(WEMEdge* orig, WEMEdge* replacement);
00122   void replace(WEMNode* orig, WEMNode* replacement);
00124   void replace(WEMFace* orig, WEMFace* replacement);   
00125 
00129   double getDihedralAngle() const;
00130 
00133   double getDotAngle() const;
00134 
00135 private:
00136 
00138   WEMNode* _head;
00140   WEMNode* _tail;
00142   WEMFace* _lFace;
00144   WEMFace* _rFace;
00146   WEMEdge* _lPred;
00148   WEMEdge* _lSucc;
00150   WEMEdge* _rPred;
00152   WEMEdge* _rSucc;
00153 };
00154 
00155 
00156 ML_END_NAMESPACE
00157 
00158 #endif // __WEMEDGE_H_