00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TRIANGULATOR_H
00019 #define TRIANGULATOR_H
00020
00021 #include "compound.h"
00022 #include "sph.h"
00023
00024
00031 class Triangulator {
00032
00033 public:
00034
00035 private:
00036
00037 Compound triangles;
00038
00039 double d_max;
00040
00054 void recurse_or_add(SPH& sph,
00055 const Particle::vector_t& p1,
00056 const Particle::vector_t& p2,
00057 const Particle::vector_t& p3,
00058 const Particle::vector_t& p4,
00059 const double a,
00060 const double d_min);
00061
00065 void get_interpolation(SPH& sph,
00066 const Particle::vector_t& p0,
00067 const Particle::vector_t& p1,
00068 Particle::vector_t& p);
00069
00075 void consider_tetrahedron(SPH& sph,
00076 const Particle::vector_t& corner,
00077 const Particle::vector_t& p1,
00078 const Particle::vector_t& p2,
00079 const Particle::vector_t& p3,
00080 const Particle::vector_t& p4,
00081 int type,
00082 double d_max);
00083
00087 void turn_and_move(const Particle::vector_t& p,
00088 const double d_max,
00089 Particle::vector_t& q);
00090
00098 void consider_tetrahedron(SPH& sph,
00099 const Particle::vector_t& p1,
00100 const Particle::vector_t& p2,
00101 const Particle::vector_t& p3,
00102 const Particle::vector_t& p4);
00103
00109 void add_triangle_from_tetrahedron(SPH& sph,
00110 const Particle::vector_t& p1,
00111 const Particle::vector_t& p2,
00112 const Particle::vector_t& p3,
00113 const Particle::vector_t& p4);
00114
00123 void add_triangles_from_tetrahedron(SPH& sph,
00124 const Particle::vector_t& p1,
00125 const Particle::vector_t& p2,
00126 const Particle::vector_t& p3,
00127 const Particle::vector_t& p4);
00128
00129
00132 void add_triangle(SPH& sph,
00133 const Particle::vector_t& p1,
00134 const Particle::vector_t& p2,
00135 const Particle::vector_t& p3);
00136
00137
00141 bool is_right_handed(const Particle::vector_t& p1,
00142 const Particle::vector_t& p2,
00143 const Particle::vector_t& p3,
00144 const Particle::vector_t& p4) const;
00145
00148 void compute_normal(SPH& sph,
00149 const Particle::vector_t& p,
00150 Particle::vector_t& n);
00151
00152 public:
00153
00159 Triangulator(SPH& sph, const double d_min);
00160
00163 void reset();
00164
00169 bool next();
00170
00173 bool at_end() const;
00174
00177 const Geometry& get_triangle() const;
00178
00181 void to_xml(std::ostream& o);
00182
00183 };
00184
00185
00188 std::ostream& operator<<(std::ostream& o, Triangulator& triangulator);
00189
00190
00191 #endif // TRIANGULATOR_H