Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ISEdge.H

Go to the documentation of this file.
00001 
00010 #ifndef ISEDGE_H
00011 #define ISEDGE_H
00012 
00013 // Gluebase includes
00014 #define OUTSIDE_GLUE_CORE
00015 #include <mlib/points.H>
00016 
00017 
00018 class ISVertex;
00019 class ISFace;
00020 class ISMesh;
00021 
00022 class ISEdge
00023 {
00024  public:
00025   ISEdge(ISVertex *u, ISVertex *v);
00026   virtual ~ISEdge() {};
00027 
00028   ISVertex* vertex1() const { return _v1; }
00029   ISVertex* vertex2() const { return _v2; }
00030 
00031   ISFace* face1() const { return _f1; }
00032   ISFace* face2() const { return _f2; }
00033 
00034   // if v is a vertex of this edge, return the other vertex
00035   ISVertex* otherVertex(ISVertex *v) const {
00036     return (v==_v1)?_v2:(v==_v2)?_v1:NULL;
00037   }
00038 
00039   // if f is a face adjacent to this edge, return the other face
00040   ISFace *otherFace(ISFace *f) const {
00041     return (f==_f1)?_f2:(f==_f2)?_f1:NULL;
00042   }
00043 
00044   double length();
00045   Wvec vec();
00046 
00047   int isBorder() { return (nfaces() == 1); }
00048 
00049   // building / redefining adjacent faces
00050   int addFace(ISFace *face) {
00051     if (_f1 && _f2) {
00052       cerr << "ISEdge Error: Attempt to add 3rd face!" << endl;
00053       return 0;
00054     }
00055     else if (_f1) 
00056       _f2 = face;
00057     else
00058       _f1 = face;
00059     return 1;
00060   }
00061 
00062   int removeFace(ISFace *face) {
00063     if (face == _f1)
00064       _f1 = NULL;
00065     else if (face == _f2)
00066       _f2 = NULL;
00067     else {
00068       cerr << "ISEdge Error: Attempt to remove unknown face!" << endl;
00069       return 0;
00070     }
00071     return 1;
00072   }
00073 
00074   void setMesh(ISMesh *m);
00075 
00076   int nfaces() {
00077     int ret = 0;
00078     if (_f1) ret++;
00079     if (_f2) ret++;
00080     return ret;
00081   }
00082 
00083   int contains(ISVertex* v) const { return (v==_v1 || v==_v2); }
00084 
00085  protected:
00086   ISVertex *_v1;
00087   ISVertex *_v2;
00088   ISFace *_f1;
00089   ISFace *_f2;
00090 
00091   ISMesh *_mesh;  // the mesh that this ISEdge belongs to
00092 
00093 };
00094 
00095 
00096 #endif
00097 
00098 
00099 
00100 
00101 
00102 

Generated on Mon Sep 15 16:27:56 2003 for inspace by doxygen1.2.18