change indexed triangle type to unsigned

This commit is contained in:
Lingjie Zhu 2017-10-31 16:29:43 +08:00
parent 704fab2ef1
commit 8ddf98ff93
4 changed files with 12 additions and 12 deletions

View File

@ -22,7 +22,7 @@ int main()
// output data // output data
Polyhedron output; Polyhedron output;
std::vector<int> triangles; std::vector<std::size_t> triangles;
std::vector<Kernel::Point_3> anchors; std::vector<Kernel::Point_3> anchors;
// free function interface with named parameters, seperated with dots // free function interface with named parameters, seperated with dots

View File

@ -175,12 +175,12 @@ private:
// Triangle polyhedron builder. // Triangle polyhedron builder.
template <typename HDS> template <typename HDS>
class TrianglePolyhedronBuilder : public CGAL::Modifier_base<HDS> { class TrianglePolyhedronBuilder : public CGAL::Modifier_base<HDS> {
public:
const std::vector<Point_3> &vtxs; const std::vector<Point_3> &vtxs;
const std::vector<int> &tris; const std::vector<std::size_t> &tris;
public:
bool is_manifold; bool is_manifold;
TrianglePolyhedronBuilder(const std::vector<Point_3> &_vtxs, TrianglePolyhedronBuilder(const std::vector<Point_3> &_vtxs,
const std::vector<int> &_tris) const std::vector<std::size_t> &_tris)
: vtxs(_vtxs), tris(_tris), is_manifold(true) {} : vtxs(_vtxs), tris(_tris), is_manifold(true) {}
void operator()(HDS &hds) { void operator()(HDS &hds) {
@ -190,7 +190,7 @@ private:
builder.begin_surface(vtxs.size(), tris.size() / 3); builder.begin_surface(vtxs.size(), tris.size() / 3);
BOOST_FOREACH(const Point_3 &v, vtxs) BOOST_FOREACH(const Point_3 &v, vtxs)
builder.add_vertex(Point(v)); builder.add_vertex(Point(v));
for (std::vector<int>::const_iterator itr = tris.begin(); itr != tris.end(); itr += 3) { for (std::vector<std::size_t>::const_iterator itr = tris.begin(); itr != tris.end(); itr += 3) {
if (builder.test_facet(itr, itr + 3)) { if (builder.test_facet(itr, itr + 3)) {
builder.begin_facet(); builder.begin_facet();
builder.add_vertex_to_facet(*itr); builder.add_vertex_to_facet(*itr);
@ -240,7 +240,7 @@ private:
// All borders cycles. // All borders cycles.
std::vector<Border> borders; std::vector<Border> borders;
// The indexed triangle approximation. // The indexed triangle approximation.
std::vector<int> tris; std::vector<std::size_t> tris;
//member functions //member functions
public: public:
@ -884,7 +884,7 @@ public:
*/ */
template <typename OutputIterator> template <typename OutputIterator>
void get_indexed_triangles(OutputIterator out_itr) const { void get_indexed_triangles(OutputIterator out_itr) const {
BOOST_FOREACH(const int &i, tris) BOOST_FOREACH(const std::size_t &i, tris)
*out_itr++ = i; *out_itr++ = i;
} }
@ -1489,9 +1489,9 @@ private:
int j = global_vtag_map[to_sgv_map[target(he, *m_pmesh)]]; int j = global_vtag_map[to_sgv_map[target(he, *m_pmesh)]];
int k = global_vtag_map[to_sgv_map[target(next(he, *m_pmesh), *m_pmesh)]]; int k = global_vtag_map[to_sgv_map[target(next(he, *m_pmesh), *m_pmesh)]];
if (i != j && i != k && j != k) { if (i != j && i != k && j != k) {
tris.push_back(i); tris.push_back(static_cast<std::size_t>(i));
tris.push_back(j); tris.push_back(static_cast<std::size_t>(j));
tris.push_back(k); tris.push_back(static_cast<std::size_t>(k));
} }
} }
} }

View File

@ -112,7 +112,7 @@ int main()
std::vector<Polyhedron::Vertex_handle> anchor_vtx; std::vector<Polyhedron::Vertex_handle> anchor_vtx;
l2_approx.get_anchor_vertices(std::back_inserter(anchor_vtx)); l2_approx.get_anchor_vertices(std::back_inserter(anchor_vtx));
std::vector<int> tris; std::vector<std::size_t> tris;
l2_approx.get_indexed_triangles(std::back_inserter(tris)); l2_approx.get_indexed_triangles(std::back_inserter(tris));
std::vector<std::vector<std::size_t> > boundary; std::vector<std::vector<std::size_t> > boundary;

View File

@ -23,7 +23,7 @@ int main()
} }
Polyhedron out_mesh; Polyhedron out_mesh;
std::vector<int> tris; std::vector<std::size_t> tris;
std::vector<Kernel::Point_3> anchor_pos; std::vector<Kernel::Point_3> anchor_pos;
std::list<Polyhedron::Vertex_handle> anchor_vtx; std::list<Polyhedron::Vertex_handle> anchor_vtx;
std::vector<CGAL::PlaneProxy<Kernel> > proxies; std::vector<CGAL::PlaneProxy<Kernel> > proxies;