00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00035
00036
00037
00038
00039
00040
00041 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
00042 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
00043
00044
00045
00046
00047
00048
00049 #include <OpenMesh/Core/Mesh/Traits.hh>
00050 #include <OpenMesh/Core/Attributes/Attributes.hh>
00051
00052
00053
00054
00055 namespace OpenMesh {
00056 namespace Subdivider {
00057 namespace Uniform {
00058
00059
00060
00061
00062
00066 struct CompositeTraits : public OpenMesh::DefaultTraits
00067 {
00068 FaceAttributes( OpenMesh::Attributes::Normal );
00069
00070 VertexAttributes( OpenMesh::Attributes::Normal );
00071
00072 HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
00073
00074 FaceTraits
00075 {
00076 private:
00077 typedef typename Refs::HalfedgeHandle HalfedgeHandle;
00078 typedef typename Refs::Scalar Scalar;
00079 typedef typename Refs::Point Point;
00080 HalfedgeHandle red_halfedge_handle_;
00081 unsigned int generation_;
00082 bool red_;
00083 Scalar quality_;
00084 Point midpoint_;
00085 Point position_;
00086
00087 public:
00088 const unsigned int& generation() { return generation_; }
00089 void set_generation(const unsigned int& _g) { generation_ = _g; }
00090 void inc_generation() { ++generation_; }
00091 void set_red() { red_ = 1; }
00092 void set_green() {red_ = 0; }
00093 bool is_red() { return red_; }
00094 bool is_green() { return !red_; }
00095 void set_red_halfedge_handle(HalfedgeHandle& _heh)
00096 { red_halfedge_handle_ = _heh; }
00097 HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; }
00098 void set_quality(Scalar& _q) { quality_ = _q; }
00099 Scalar& quality() { return quality_; }
00100 const Point& midpoint() const { return midpoint_; }
00101 void set_midpoint(const Point& _p) { midpoint_ = _p; }
00102 const Point& position() const { return position_; }
00103 void set_position(const Point& _p) { position_ = _p; }
00104 };
00105
00106 EdgeTraits
00107 {
00108 private:
00109 typedef typename Refs::Point Point;
00110 typedef typename Refs::Scalar Scalar;
00111 Point midpoint_;
00112 Scalar length_;
00113 Point position_;
00114 public:
00115 const Point& midpoint() const { return midpoint_; }
00116 void set_midpoint(const Point& _vh) { midpoint_ = _vh; }
00117 const Scalar& length() const { return length_; }
00118 void set_length(const Scalar& _s) { length_ = _s; }
00119 const Point& position() const { return position_; }
00120 void set_position(const Point& _p) { position_ = _p; }
00121 };
00122
00123 VertexTraits
00124 {
00125 private:
00126 typedef typename Refs::Point Point;
00127 Point new_pos_;
00128 Point orig_pos_;
00129 Point position_;
00130 unsigned int generation_;
00131 public:
00132 const Point& new_pos() const { return new_pos_; }
00133 void set_new_pos(const Point& _p) { new_pos_ = _p; }
00134 const unsigned int& generation() const { return generation_; }
00135 void set_generation(const unsigned int& _i) { generation_ = _i; }
00136 const Point& orig_pos() const { return orig_pos_; }
00137 void set_orig_pos(const Point& _p) { orig_pos_ = _p; }
00138 const Point& position() const { return position_; }
00139 void set_position(const Point& _p) { position_ = _p; }
00140 };
00141 };
00142
00143
00144 }
00145 }
00146 }
00147
00148 #endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH defined
00149
00150