00001
00006 #ifndef CONFORMALMESHER_H
00007 #define CONFORMALMESHER_H
00008
00009 #include "util.h"
00010 #include "cell.h"
00011 #include <vector>
00012 #include "hash_classes.h"
00013 #include "hash_map.h"
00014 #include "hash_set.h"
00015
00016
00017 class BezierVertex;
00018 class BezierEdge;
00019 class BezierMesh;
00020 class BoundaryMesh;
00021
00032 class ConformalMesher {
00033 private:
00034
00035 BezierMesh *bezier;
00036 BoundaryMesh *bdry;
00037
00038 public:
00039 class Subspline;
00040 private:
00041
00042 std::list<Subspline*> subsplines;
00043 std::vector<Subspline*> spline_stack;
00044 hashers::hash_set<Subspline*, CastHash<Subspline*> > is_encroached;
00045 hashers::hash_set<Subspline*, CastHash<Subspline*> > in_stack;
00046 hashers::hash_map<BezierVertex*, std::vector<Subspline*> >
00047 incident_edges;
00048
00049 std::vector<Point2D> remove_points;
00050 std::vector<std::pair<BoundaryFace*,Point2D> > face_points;
00051
00052
00053 void create_bbox();
00054 void insert_d0_vertices();
00055 void create_subsplines();
00056 void conform();
00057 void reticulate_splines();
00058 void set_face_pointers();
00059 void excavate_holes();
00060
00061
00062 void link_edge(Subspline*);
00063 void unlink_edge(Subspline *s);
00064 bool segment_appears(Subspline*);
00065 bool angle_is_positive(Subspline*,BezierVertex*,BezierEdge*);
00066 BezierVertex *split_destroy_segment(Subspline*,
00067 std::vector<Subspline*>&);
00068 void collect_faces(Point2D, hashers::hash_set<BezierTriangle*>&);
00069 void set_face_pointer(BoundaryFace *face);
00070 void remove_hole(Point2D);
00071
00072 public:
00073 ConformalMesher(BezierMesh*, BoundaryMesh*);
00074 ~ConformalMesher();
00075
00076
00077 void add_face_point(BoundaryFace *f, Point2D p) {
00078 face_points.push_back(std::pair<BoundaryFace*,Point2D>(f,p));
00079 }
00080 void add_hole(Point2D p) {
00081 remove_points.push_back(p);
00082 }
00083
00087 void mesh();
00088 };
00089
00090 #endif