solid.h

Go to the documentation of this file.
00001 /**
00002  *\file         solid.h
00003  *
00004  *\brief
00005  *              
00006  *
00007  *\author       Xianming Chen\n
00008  *              Computer Science Department\n
00009  *              University of Utah
00010  *
00011  *\date         14 Aug 2006\n
00012  *              Copyright (c) 2006, University of Utah
00013  */
00014 
00015 
00016 #ifndef _SOLID_H
00017 #define _SOLID_H
00018 
00019 #include "node_fwd_dcl.h"
00020 #include <utility>
00021 #include <iosfwd>
00022 
00023 
00024 namespace euler
00025 {
00026   class face_t;
00027   class loop_t;
00028   class edge_t;
00029   class vertex_t;
00030   class point_t;
00031   typedef short id_t;
00032 
00033   class solid_t
00034   {
00035       vertex_t *vfirst, *vlast;   // head and last vertices.
00036   public:
00037       static solid_t *solid;
00038       static bool assert_consistent_B_rep();
00039       id_t id;
00040       face_t *f;
00041       solid_t *pre, *nxt;
00042 
00043   public:
00044       solid_t() : vfirst(0), vlast(0), id(cur_id++), f(0), pre(0), nxt(solid) { if(solid) solid->pre = this; solid = this; }
00045       ~solid_t();
00046 
00047 
00048       static solid_t* disk(point_t const& cntr=point_t(), float r=1.0f, int segs=8); //!<actually a lamina (of two faces touch tightly to each other)
00049       static solid_t* block(point_t const& ur=point_t(1.0f, 1.0f, 1.0f));            //!<make a block with lower left corner at origin, and upper right as given
00050       void rsweep_wire(loop_t* l, int resolution = 8);                               //!<rotational sweep a wire (translational sweep only affects one surface, and is defined in euler::face_t).
00051       
00052       void tsweep_face(face_t* f, vector_t const& disp = vector_t(0.f, 0.f, 1.f) );
00053       void rsweep_face(face_t* f, float theta1=0, float theta2= 2*pi, int resolution = 10);
00054 
00055       static solid_t* mvfs(point_t const& p);
00056       edge_t* mev(edge_t* e1, edge_t* e2, point_t const& p);//!<subdivide edge cycle (at p0=p1==p2) into p0p+[e2, e1) at p0 (change in place), and pp0+[e1, e2) at p (as cycle at new vertex).
00057       void kev(edge_t* e);                                  //!<inverse of mev: edge cycle (at tail of e) is merged to that at head of e.
00058 
00059       loop_t *mef(edge_t* e1, edge_t* e2);                  //!<subdivide edge loop (of l1==l2) into v1v2+[e2, e1) (change in place), and v2v1+[e1,e2) (as new edge loop of new face)
00060       loop_t *mef(edge_t* e)                                { return mef(e, e); }     //!< same as mef(e, e).
00061       void kef(edge_t* e);                                  //!<inverse of mef: face is merged to that of opposite half edge.
00062 
00063       void kfmrh(face_t* f1, face_t* f2);
00064       void kfsmr(face_t* f1, face_t* f2) { kfmrh(f1, f2); }
00065 
00066       void kffmh(face_t* f1, face_t* f2);
00067       
00068       void print_off_file(std::ostream& os) const;
00069       
00070 
00071       solid_t& operator+=(vector_t const& v);
00072       
00073   private:
00074       vertex_t* new_vertex(point_t const&p);  // append to vertex list.
00075       face_t* new_face();
00076       std::pair<edge_t*, edge_t*> 
00077       add_edge_pair(vertex_t* v1, edge_t* nxt1,
00078                     vertex_t* v2, edge_t* nxt2);
00079       
00080       void del_vertex(vertex_t* v);
00081       void del_face(face_t*);
00082       void del_edge_pair(edge_t* e);
00083     
00084       void add_face_to(face_t* f1, face_t *f2);    // add loops of f1 after the outer (first) loop of f2, delete f1. 
00085 
00086       friend class loop_t;
00087       void _kev(edge_t* e);
00088       edge_t* mev(edge_t* e1, edge_t* e2, vertex_t* v);
00089       
00090   private:
00091       static id_t cur_id;
00092   };
00093 
00094 }//end namespace euler
00095 
00096 
00097 #endif

Generated on Wed Aug 30 16:27:58 2006 for euler by  doxygen 1.4.6