Merge branch 'cdt_fix' into 'master'

Cdt fix



See merge request !40
This commit is contained in:
Jan Möbius
2015-12-16 10:07:29 +01:00
2 changed files with 22 additions and 23 deletions

View File

@@ -135,7 +135,7 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
edgeData_.resize(n); edgeData_.resize(n);
next_cache_.resize(6*n); next_cache_.resize(6*n);
} }
next_cache_count_ = 0; int next_cache_count = 0;
// don't allow degenerated faces // don't allow degenerated faces
assert (n > 2); assert (n > 2);
@@ -208,9 +208,9 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
assert(inner_next.is_valid()); assert(inner_next.is_valid());
// relink // relink
next_cache_[next_cache_count_++] = std::make_pair(boundary_prev, patch_start); next_cache_[next_cache_count++] = std::make_pair(boundary_prev, patch_start);
next_cache_[next_cache_count_++] = std::make_pair(patch_end, boundary_next); next_cache_[next_cache_count++] = std::make_pair(patch_end, boundary_next);
next_cache_[next_cache_count_++] = std::make_pair(inner_prev, inner_next); next_cache_[next_cache_count++] = std::make_pair(inner_prev, inner_next);
} }
} }
} }
@@ -252,14 +252,14 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
case 1: // prev is new, next is old case 1: // prev is new, next is old
boundary_prev = prev_halfedge_handle(inner_next); boundary_prev = prev_halfedge_handle(inner_next);
assert(boundary_prev.is_valid()); assert(boundary_prev.is_valid());
next_cache_[next_cache_count_++] = std::make_pair(boundary_prev, outer_next); next_cache_[next_cache_count++] = std::make_pair(boundary_prev, outer_next);
set_halfedge_handle(vh, outer_next); set_halfedge_handle(vh, outer_next);
break; break;
case 2: // next is new, prev is old case 2: // next is new, prev is old
boundary_next = next_halfedge_handle(inner_prev); boundary_next = next_halfedge_handle(inner_prev);
assert(boundary_next.is_valid()); assert(boundary_next.is_valid());
next_cache_[next_cache_count_++] = std::make_pair(outer_prev, boundary_next); next_cache_[next_cache_count++] = std::make_pair(outer_prev, boundary_next);
set_halfedge_handle(vh, boundary_next); set_halfedge_handle(vh, boundary_next);
break; break;
@@ -267,7 +267,7 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
if (!halfedge_handle(vh).is_valid()) if (!halfedge_handle(vh).is_valid())
{ {
set_halfedge_handle(vh, outer_next); set_halfedge_handle(vh, outer_next);
next_cache_[next_cache_count_++] = std::make_pair(outer_prev, outer_next); next_cache_[next_cache_count++] = std::make_pair(outer_prev, outer_next);
} }
else else
{ {
@@ -275,14 +275,14 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
boundary_prev = prev_halfedge_handle(boundary_next); boundary_prev = prev_halfedge_handle(boundary_next);
assert(boundary_prev.is_valid()); assert(boundary_prev.is_valid());
assert(boundary_next.is_valid()); assert(boundary_next.is_valid());
next_cache_[next_cache_count_++] = std::make_pair(boundary_prev, outer_next); next_cache_[next_cache_count++] = std::make_pair(boundary_prev, outer_next);
next_cache_[next_cache_count_++] = std::make_pair(outer_prev, boundary_next); next_cache_[next_cache_count++] = std::make_pair(outer_prev, boundary_next);
} }
break; break;
} }
// set inner link // set inner link
next_cache_[next_cache_count_++] = std::make_pair(inner_prev, inner_next); next_cache_[next_cache_count++] = std::make_pair(inner_prev, inner_next);
} }
else edgeData_[ii].needs_adjust = (halfedge_handle(vh) == inner_next); else edgeData_[ii].needs_adjust = (halfedge_handle(vh) == inner_next);
@@ -292,7 +292,7 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
} }
// process next halfedge cache // process next halfedge cache
for (i = 0; i < next_cache_count_; ++i) for (i = 0; i < next_cache_count; ++i)
set_next_halfedge_handle(next_cache_[i].first, next_cache_[i].second); set_next_halfedge_handle(next_cache_[i].first, next_cache_[i].second);

View File

@@ -1185,66 +1185,66 @@ public:
class CirculatorRange { class CirculatorRange {
public: public:
CirculatorRange( CirculatorRange(
CONTAINER_TYPE &container, const CONTAINER_TYPE &container,
CENTER_ENTITY_TYPE center) : CENTER_ENTITY_TYPE center) :
container_(container), center_(center) {} container_(container), center_(center) {}
ITER_TYPE begin() { return (container_.*begin_fn)(center_); } ITER_TYPE begin() { return (container_.*begin_fn)(center_); }
ITER_TYPE end() { return (container_.*end_fn)(center_); } ITER_TYPE end() { return (container_.*end_fn)(center_); }
private: private:
CONTAINER_TYPE &container_; const CONTAINER_TYPE &container_;
CENTER_ENTITY_TYPE center_; CENTER_ENTITY_TYPE center_;
}; };
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstVertexVertexCWIter, ConstVertexVertexCWIter,
VertexHandle, VertexHandle,
&PolyConnectivity::cvv_cwbegin, &PolyConnectivity::cvv_cwbegin,
&PolyConnectivity::cvv_cwend> ConstVertexVertexRange; &PolyConnectivity::cvv_cwend> ConstVertexVertexRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstVertexIHalfedgeIter, ConstVertexIHalfedgeIter,
VertexHandle, VertexHandle,
&PolyConnectivity::cvih_begin, &PolyConnectivity::cvih_begin,
&PolyConnectivity::cvih_end> ConstVertexIHalfedgeRange; &PolyConnectivity::cvih_end> ConstVertexIHalfedgeRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstVertexOHalfedgeIter, VertexHandle, ConstVertexOHalfedgeIter, VertexHandle,
&PolyConnectivity::cvoh_begin, &PolyConnectivity::cvoh_begin,
&PolyConnectivity::cvoh_end> ConstVertexOHalfedgeRange; &PolyConnectivity::cvoh_end> ConstVertexOHalfedgeRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstVertexEdgeIter, ConstVertexEdgeIter,
VertexHandle, VertexHandle,
&PolyConnectivity::cve_begin, &PolyConnectivity::cve_begin,
&PolyConnectivity::cve_end> ConstVertexEdgeRange; &PolyConnectivity::cve_end> ConstVertexEdgeRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstVertexFaceIter, ConstVertexFaceIter,
VertexHandle, VertexHandle,
&PolyConnectivity::cvf_begin, &PolyConnectivity::cvf_begin,
&PolyConnectivity::cvf_end> ConstVertexFaceRange; &PolyConnectivity::cvf_end> ConstVertexFaceRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstFaceVertexIter, ConstFaceVertexIter,
FaceHandle, FaceHandle,
&PolyConnectivity::cfv_begin, &PolyConnectivity::cfv_begin,
&PolyConnectivity::cfv_end> ConstFaceVertexRange; &PolyConnectivity::cfv_end> ConstFaceVertexRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstFaceHalfedgeIter, ConstFaceHalfedgeIter,
FaceHandle, FaceHandle,
&PolyConnectivity::cfh_begin, &PolyConnectivity::cfh_begin,
&PolyConnectivity::cfh_end> ConstFaceHalfedgeRange; &PolyConnectivity::cfh_end> ConstFaceHalfedgeRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstFaceEdgeIter, ConstFaceEdgeIter,
FaceHandle, FaceHandle,
&PolyConnectivity::cfe_begin, &PolyConnectivity::cfe_begin,
&PolyConnectivity::cfe_end> ConstFaceEdgeRange; &PolyConnectivity::cfe_end> ConstFaceEdgeRange;
typedef CirculatorRange< typedef CirculatorRange<
const PolyConnectivity, PolyConnectivity,
ConstFaceFaceIter, ConstFaceFaceIter,
FaceHandle, FaceHandle,
&PolyConnectivity::cff_begin, &PolyConnectivity::cff_begin,
@@ -1577,7 +1577,6 @@ private: // Working storage for add_face()
}; };
std::vector<AddFaceEdgeInfo> edgeData_; // std::vector<AddFaceEdgeInfo> edgeData_; //
std::vector<std::pair<HalfedgeHandle, HalfedgeHandle> > next_cache_; // cache for set_next_halfedge and vertex' set_halfedge std::vector<std::pair<HalfedgeHandle, HalfedgeHandle> > next_cache_; // cache for set_next_halfedge and vertex' set_halfedge
uint next_cache_count_;
}; };