Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

bfilters.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * bfilters.H
00003  **********************************************************************/
00004 #ifndef BFILTERS_H_HAS_BEEN_INCLUDED
00005 #define BFILTERS_H_HAS_BEEN_INCLUDED
00006 
00007 #include "bmesh.H"
00008 #include "mesh_global.H"
00009 
00010 /*****************************************************************
00011  * FoldVertFilter:
00012  *
00013  *   Tell whether a Bvert is a "fold vertex" WRT a given edge
00014  *   filter... i.e., the vertex has degree 2 WRT that filter
00015  *   and both edges lie on the same side of the vertex normal
00016  *   when all are projected to screen space.
00017  *****************************************************************/
00018 inline bool
00019 is_fold(CWpt& a, mlib::CWpt& p, mlib::CWpt& b, mlib::CWvec& n)
00020 {
00021    // Returns true if the sequence of points a, p, b
00022    // projected to image space lies all on one side of the
00023    // image space line defined by the middle point p and the
00024    // given vector n.
00025 
00026    VEXEL nv = mlib::VEXEL(p, n).perpend();
00027    return XOR((VEXEL(a, p-a) * nv) < 0, (mlib::VEXEL(b, b-p) * nv) < 0);
00028 }
00029 
00030 class FoldVertFilter: public BvertFilter {
00031  public:
00032    FoldVertFilter(CSimplexFilter& f) : _edge_filter(f) {}
00033 
00034    //******** SOLE JOB ********
00035    virtual bool accept(CBsimplex* s) const;
00036 
00037  protected:
00038    CSimplexFilter& _edge_filter;
00039 };
00040 
00041 
00042 /*****************************************************************
00043  * VertDegreeFilter:
00044  *
00045  *   Accept a vertex with a given degree WRT a given edge filter
00046  *****************************************************************/
00047 class VertDegreeFilter: public BvertFilter {
00048  public:
00049    // by default checks the ordinary degree (counts edges):
00050    VertDegreeFilter(int n, CSimplexFilter& f = BedgeFilter()) :
00051       _n(n), _edge_filter(f) {}
00052 
00053    //******** SOLE JOB ********
00054    virtual bool accept(CBsimplex* s) const;
00055 
00056  protected:
00057    int                  _n;                     // required degree
00058    CSimplexFilter&      _edge_filter;
00059 };
00060 
00061 /*******************************************************
00062  * CornerTypeVertFilter:
00063  *
00064  *  Accepts a vertex whose "degree" WRT a given edge
00065  *  filter is 3 or more.
00066  *
00067  *******************************************************/
00068 class CornerTypeVertFilter: public SimplexFilter {
00069  public:
00070    CornerTypeVertFilter(CSimplexFilter& f = BedgeFilter()) : _edge_filter(f) {}
00071 
00072    //******** SOLE JOB ********
00073    virtual bool accept(CBsimplex* s) const {
00074       if (!is_vert(s))
00075          return false;
00076       return ((Bvert*)s)->degree(_edge_filter) > 2;
00077    }
00078 
00079  protected:
00080    CSimplexFilter& _edge_filter;
00081 };
00082 
00083 /*****************************************************************
00084  * VertFaceDegreeFilter:
00085  *
00086  *   Accept a vertex with a given FACE degree WRT a given face filter
00087  *****************************************************************/
00088 class VertFaceDegreeFilter: public SimplexFilter {
00089  public:
00090    VertFaceDegreeFilter(int n = 0, CSimplexFilter& f = BfaceFilter()) :
00091       _n(n), _face_filter(f) {}
00092 
00093    //******** SOLE JOB ********
00094    virtual bool accept(CBsimplex* s) const {
00095       if (!is_vert(s))
00096          return false;
00097       return (((Bvert*)s)->face_degree(_face_filter) == _n);
00098    }
00099 
00100  protected:
00101    int                  _n;             // required degree
00102    CSimplexFilter&      _face_filter;
00103 };
00104 
00105 #endif  // BFILTERS_H_HAS_BEEN_INCLUDED
00106 
00107 /* end of file bfilters.H */

Generated on Mon Sep 18 11:39:28 2006 for jot by  doxygen 1.4.4