207 std::vector<FaceHandle> faces; faces.reserve(20);
210 const typename Mesh::Scalar sqr_tolerace = tolerance_*tolerance_;
211 typename Mesh::CFVIter fv_it;
219 for (vf_it=mesh_.vf_iter(_ci.
v0); vf_it.is_valid(); ++vf_it) {
222 if (fh != _ci.
fl && fh != _ci.
fr)
225 Points& pts = mesh_.property(points_, fh);
226 std::copy(pts.begin(), pts.end(), std::back_inserter(tmp_points_));
230 tmp_points_.push_back(_ci.
p0);
233 typename std::vector<FaceHandle>::iterator fh_it, fh_end(faces.end());
234 typename Points::const_iterator p_it, p_end(tmp_points_.end());
237 mesh_.set_point(_ci.
v0, _ci.
p1);
242 for (p_it=tmp_points_.begin(); ok && p_it!=p_end; ++p_it) {
245 for (fh_it=faces.begin(); !ok && fh_it!=fh_end; ++fh_it) {
246 fv_it=mesh_.cfv_iter(*fh_it);
247 const Point& p0 = mesh_.point(*fv_it);
248 const Point& p1 = mesh_.point(*(++fv_it));
249 const Point& p2 = mesh_.point(*(++fv_it));
251 if ( distPointTriangleSquared(*p_it, p0, p1, p2) <= sqr_tolerace)
257 mesh_.set_point(_ci.
v0, _ci.
p0);
259 return ( ok ?
static_cast<float>(Base::LEGAL_COLLAPSE) :
static_cast<float>(Base::ILLEGAL_COLLAPSE) );
285 std::vector<FaceHandle> faces;
294 for (vf_it=mesh_.vf_iter(_ci.
v1); vf_it.is_valid(); ++vf_it) {
298 Points& pts = mesh_.property(points_, fh);
299 std::copy(pts.begin(), pts.end(), std::back_inserter(tmp_points_));
302 if (faces.empty())
return;
306 if ((fh=_ci.
fl).is_valid()) {
307 Points& pts = mesh_.property(points_, fh);
308 std::copy(pts.begin(), pts.end(), std::back_inserter(tmp_points_));
311 if ((fh=_ci.
fr).is_valid()) {
312 Points& pts = mesh_.property(points_, fh);
313 std::copy(pts.begin(), pts.end(), std::back_inserter(tmp_points_));
318 tmp_points_.push_back(_ci.
p0);
322 typename std::vector<FaceHandle>::iterator fh_it, fh_end(faces.end());
323 typename Points::const_iterator p_it, p_end(tmp_points_.end());
327 typename Mesh::CFVIter fv_it;
329 for (p_it=tmp_points_.begin(); p_it!=p_end; ++p_it) {
332 for (fh_it=faces.begin(); fh_it!=fh_end; ++fh_it) {
333 fv_it=mesh_.cfv_iter(*fh_it);
334 const Point& p0 = mesh_.point(*fv_it);
335 const Point& p1 = mesh_.point(*(++fv_it));
336 const Point& p2 = mesh_.point(*(++fv_it));
338 e = distPointTriangleSquared(*p_it, p0, p1, p2);
346 mesh_.property(points_, fh).push_back(*p_it);
359 typename Mesh::CFVIter fv_it = mesh_.cfv_iter(_fh);
360 const Point& p0 = mesh_.point(fv_it);
361 const Point& p1 = mesh_.point(++fv_it);
362 const Point& p2 = mesh_.point(++fv_it);
364 const Points& points = mesh_.property(points_, _fh);
365 typename Points::const_iterator p_it = points.begin();
366 typename Points::const_iterator p_end = points.end();
370 Scalar emax = distPointTriangleSquared(_p, p0, p1, p2);
374 for (; p_it!=p_end; ++p_it) {
375 e = distPointTriangleSquared(*p_it, p0, p1, p2);