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

ledge_strip.H

Go to the documentation of this file.
00001 
00002 /**********************************************************************
00003  * ledge_strip.H:
00004  **********************************************************************/
00005 #ifndef LEDGE_STRIP_H_IS_INCLUDED
00006 #define LEDGE_STRIP_H_IS_INCLUDED
00007 
00008 #include "edge_strip.H"         // base class
00009 #include "lface.H"              // subdivision faces, edges, verts
00010 
00011 /**********************************************************************
00012  * LedgeStrip:
00013  *
00014  *      Edge strip class for LMESHs (subdivision meshes).
00015  *
00016  *      An edge strip in the control mesh corresponds to an
00017  *      edge strip with twice as many edges in the next-level
00018  *      subdivision mesh.
00019  **********************************************************************/
00020 #define CLedgeStrip const LedgeStrip
00021 class LedgeStrip : public EdgeStrip {
00022  public:
00023    //******** MANAGERS ********
00024 
00025    // Create an empty strip:
00026    LedgeStrip() : _substrip(0) {}
00027 
00028    // Given a list of edges to search, build a strip of
00029    // edges that satisfy a given property.
00030    LedgeStrip(CBedge_list& list, CBedgeFilter& filter) :
00031       EdgeStrip(list, filter),
00032       _substrip(0) {}
00033 
00034    virtual ~LedgeStrip() { delete_substrip(); }
00035 
00036    void clear_subdivision(int level);
00037 
00038    // Assignment operator:
00039    virtual EdgeStrip& operator=(CEdgeStrip& strip) {
00040       delete_substrip();
00041       return EdgeStrip::operator=(strip);
00042    }
00043 
00044    //******** ACCESSORS ********
00045 
00046    LMESH* lmesh()               const   { return (LMESH*)mesh(); }
00047 
00048    int    cur_level()           const;  // level of "current" mesh in hierarchy
00049    int    rel_cur_level()       const;  // cur level relative to this mesh
00050 
00051    //******** BedgeStrip VIRTUAL METHODS ********
00052 
00053    virtual void reset() { delete_substrip(); EdgeStrip::reset(); }
00054 
00055    virtual void draw(StripCB* cb) { draw(rel_cur_level(), cb); }
00056 
00057    // Returns the child strip at the current subdivision level:
00058    virtual CEdgeStrip* cur_strip() const { return get_strip(rel_cur_level()); }
00059 
00060    // Returns the child strip at the given subdivision level,
00061    // relative to this strip. E.g., returns _substrip when k == 1.
00062    virtual CEdgeStrip* sub_strip(int k) const { return get_strip(k); }
00063 
00064  protected:
00065    //******** MEMBER DATA ********
00066    LedgeStrip*  _substrip;  // corresponding finer-level edge strip
00067 
00068    //******** MANAGING SUBSTRIP ********
00069 
00070    // Returns the child strip at the given subdivision level,
00071    // relative to this strip. E.g., returns _substrip when k == 1.
00072    const LedgeStrip* get_strip (int level) const { 
00073       if (level<=0)
00074          return this; 
00075       else {
00076          ((LedgeStrip*)this)->generate_substrip();
00077          return _substrip->get_strip(level-1);
00078       }
00079    }
00080    void delete_substrip() { delete _substrip; _substrip = 0;}
00081    void generate_substrip();
00082 
00083    bool need_rebuild() const;
00084 
00085    //******** DRAWING (INTERNAL) ********
00086    void draw(int level, StripCB* cb);
00087 };
00088 
00089 #endif // LEDGE_STRIP_H_IS_INCLUDED
00090 
00091 /* end of file ledge_strip.H */

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