00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 template <class PrimType>
00022 INLINE MesherEdge<PrimType>::
00023 MesherEdge(const Vertex *a, const Vertex *b) : _a(a), _b(b) {
00024 _opposite = NULL;
00025 }
00026
00027 template <class PrimType>
00028 INLINE MesherEdge<PrimType>::
00029 MesherEdge(const MesherEdge ©) :
00030 _a(copy._a),
00031 _b(copy._b),
00032 _strips(copy._strips),
00033 _opposite(copy._opposite)
00034 {
00035 }
00036
00037 template <class PrimType>
00038 INLINE bool MesherEdge<PrimType>::
00039 contains_vertex(const Vertex *v) const {
00040 return (_a==v || _b==v);
00041 }
00042
00043
00044 template <class PrimType>
00045 INLINE bool MesherEdge<PrimType>::
00046 matches(const MesherEdge &other) const {
00047 return (_a == other._a && _b == other._b) ||
00048 (_b == other._a && _a == other._b);
00049 }
00050
00051 template <class PrimType>
00052 INLINE MesherEdge<PrimType> *MesherEdge<PrimType>::
00053 common_ptr() {
00054 return min(this, _opposite);
00055 }
00056
00057 template <class PrimType>
00058 INLINE bool MesherEdge<PrimType>::
00059 operator == (const MesherEdge &other) const {
00060 return _a == other._a && _b == other._b;
00061 }
00062
00063 template <class PrimType>
00064 INLINE bool MesherEdge<PrimType>::
00065 operator != (const MesherEdge &other) const {
00066 return !operator == (other);
00067 }
00068
00069 template <class PrimType>
00070 INLINE bool MesherEdge<PrimType>::
00071 operator < (const MesherEdge &other) const {
00072 return _a < other._a || (_a == other._a && _b < other._b);
00073 }
00074
00075 template <class PrimType>
00076 INLINE float MesherEdge<PrimType>::
00077 compute_length(const BuilderBucket &bucket) const {
00078 LVector3f v = ((const Vertexf &)_a->get_coord_value(bucket) -
00079 (const Vertexf &)_b->get_coord_value(bucket));
00080 return length(v);
00081 }
00082
00083 template <class PrimType>
00084 INLINE Vertexf MesherEdge<PrimType>::
00085 compute_box(const BuilderBucket &bucket) const {
00086 LVector3f v = ((const Vertexf &)_a->get_coord_value(bucket) -
00087 (const Vertexf &)_b->get_coord_value(bucket));
00088 return Vertexf(fabs(v[0]), fabs(v[1]), fabs(v[2]));
00089 }
00090
00091
00092
00093
00094
00095
00096
00097 template <class PrimType>
00098 void MesherEdge<PrimType>::
00099 remove(Strip *strip) {
00100 strip->_edges.remove(this);
00101 strip->_edges.remove(_opposite);
00102
00103 _strips.remove(strip);
00104 _opposite->_strips.remove(strip);
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114 template <class PrimType>
00115 void MesherEdge<PrimType>::
00116 change_strip(Strip *from, Strip *to) {
00117 TYPENAME Strips::iterator si;
00118
00119 for (si = _strips.begin(); si != _strips.end(); ++si) {
00120 if (*si == from) {
00121 *si = to;
00122 }
00123 }
00124
00125 for (si = _opposite->_strips.begin();
00126 si != _opposite->_strips.end();
00127 ++si) {
00128 if (*si == from) {
00129 *si = to;
00130 }
00131 }
00132 }
00133
00134
00135
00136
00137
00138
00139 template <class PrimType>
00140 ostream &MesherEdge<PrimType>::
00141 output(ostream &out) const {
00142 out << "Edge [" << *_a << " to " << *_b << "], "
00143 << _strips.size() << " strips:";
00144
00145 TYPENAME Strips::const_iterator si;
00146 for (si = _strips.begin(); si != _strips.end(); ++si) {
00147 out << " " << (*si)->_index;
00148 }
00149
00150 if (_opposite!=NULL) {
00151 out << " opposite "
00152 << _opposite->_strips.size() << " strips:";
00153
00154 for (si = _opposite->_strips.begin();
00155 si != _opposite->_strips.end();
00156 ++si) {
00157 out << " " << (*si)->_index;
00158 }
00159 }
00160
00161 return out;
00162 }