mirror of https://github.com/CGAL/cgal
Do not expose Indexed_triangle_set in the API (todo: move to internal)
This commit is contained in:
parent
a80289fc3d
commit
c9f80d694f
|
|
@ -3,28 +3,31 @@
|
||||||
#include <CGAL/convex_hull_3.h>
|
#include <CGAL/convex_hull_3.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
typedef K::Point_3 Point_3;
|
typedef K::Point_3 Point_3;
|
||||||
typedef CGAL::Indexed_triangle_set<Point_3> Surface_mesh;
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
std::ifstream in( (argc>1)? argv[1] : "data/cube.xyz");
|
std::ifstream in( (argc>1)? argv[1] : "data/cube.xyz");
|
||||||
std::vector<Point_3> points;
|
std::vector<Point_3> points;
|
||||||
|
|
||||||
|
std::vector<Point_3> vertices;
|
||||||
|
std::vector<std::array<int,3> > faces;
|
||||||
|
|
||||||
Point_3 p;
|
Point_3 p;
|
||||||
while(in >> p){
|
while(in >> p){
|
||||||
points.push_back(p);
|
points.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface_mesh sm;
|
|
||||||
CGAL::convex_hull_3(points.begin(), points.end(), sm);
|
|
||||||
|
|
||||||
std::cout << sm << std::endl;
|
CGAL::convex_hull_3(points.begin(), points.end(), vertices, faces);
|
||||||
//std::cout << "The convex hull contains " << num_vertices(sm) << " vertices" << std::endl;
|
|
||||||
|
std::cout << vertices.size() << " " << faces.size() << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,13 @@ namespace CGAL {
|
||||||
template <typename P>
|
template <typename P>
|
||||||
struct Indexed_triangle_set
|
struct Indexed_triangle_set
|
||||||
{
|
{
|
||||||
std::vector<P> vertices;
|
std::vector<P>& vertices;
|
||||||
std::vector<std::array<int,3> > faces;
|
std::vector<std::array<int,3> >& faces;
|
||||||
|
|
||||||
|
Indexed_triangle_set(std::vector<P>& vertices,
|
||||||
|
std::vector<std::array<int,3> >& faces)
|
||||||
|
: vertices(vertices), faces(faces)
|
||||||
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1085,6 +1085,19 @@ void convex_hull_3(const VertexListGraph& g,
|
||||||
convex_hull_3(g,pm,CGAL::parameters::all_default());
|
convex_hull_3(g,pm,CGAL::parameters::all_default());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class InputIterator, class P>
|
||||||
|
void convex_hull_3(InputIterator first, InputIterator beyond,
|
||||||
|
std::vector<P>& vertices,
|
||||||
|
std::vector<std::array<int,3> >& faces,
|
||||||
|
typename std::enable_if<CGAL::is_iterator<InputIterator>::value>::type* = 0)
|
||||||
|
{
|
||||||
|
typedef typename std::iterator_traits<InputIterator>::value_type Point_3;
|
||||||
|
typedef typename Kernel_traits<Point_3>::type Traits;
|
||||||
|
|
||||||
|
Indexed_triangle_set<Point_3> its(vertices,faces);
|
||||||
|
convex_hull_3(first, beyond, its, Traits());
|
||||||
|
}
|
||||||
|
|
||||||
template <class InputRange, class OutputIterator, class Traits>
|
template <class InputRange, class OutputIterator, class Traits>
|
||||||
OutputIterator
|
OutputIterator
|
||||||
extreme_points_3(const InputRange& range,
|
extreme_points_3(const InputRange& range,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue