00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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;
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);
00049 static solid_t* block(point_t const& ur=point_t(1.0f, 1.0f, 1.0f));
00050 void rsweep_wire(loop_t* l, int resolution = 8);
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);
00057 void kev(edge_t* e);
00058
00059 loop_t *mef(edge_t* e1, edge_t* e2);
00060 loop_t *mef(edge_t* e) { return mef(e, e); }
00061 void kef(edge_t* e);
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);
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);
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 }
00095
00096
00097 #endif