mirror of https://github.com/CGAL/cgal
fix benchmarks/examples/tests to new metrics
This commit is contained in:
parent
480a254889
commit
1918e86be2
|
|
@ -11,18 +11,12 @@
|
|||
#include <CGAL/Timer.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Kernel::FT FT;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Polyhedron_3::Facet_handle Facet_handle;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > FacetAreaMap;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, Vector_3> > FacetNormalMap;
|
||||
|
||||
typedef CGAL::PlaneProxy<Polyhedron_3> PlaneProxy;
|
||||
typedef CGAL::L21Metric<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21ProxyFitting;
|
||||
typedef CGAL::L21Metric<Polyhedron_3> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3> L21ProxyFitting;
|
||||
typedef CGAL::VSA_approximation<Polyhedron_3, PlaneProxy, L21Metric, L21ProxyFitting> VSAL21;
|
||||
|
||||
typedef CGAL::Timer Timer;
|
||||
|
|
@ -46,25 +40,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
std::cerr << "#triangles " << mesh.size_of_facets() << std::endl;
|
||||
|
||||
std::map<Facet_handle, Vector_3> facet_normals;
|
||||
std::map<Facet_handle, FT> facet_areas;
|
||||
for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin();
|
||||
fitr != mesh.facets_end(); ++fitr) {
|
||||
Polyhedron_3::Halfedge_handle he = fitr->halfedge();
|
||||
const Point_3 &p0 = he->opposite()->vertex()->point();
|
||||
const Point_3 &p1 = he->vertex()->point();
|
||||
const Point_3 &p2 = he->next()->vertex()->point();
|
||||
|
||||
Vector_3 normal = CGAL::unit_normal(p0, p1, p2);
|
||||
facet_normals.insert(std::pair<Facet_handle, Vector_3>(fitr, normal));
|
||||
FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2))));
|
||||
facet_areas.insert(std::pair<Facet_handle, FT>(fitr, area));
|
||||
}
|
||||
FacetNormalMap normal_pmap(facet_normals);
|
||||
FacetAreaMap area_pmap(facet_areas);
|
||||
|
||||
L21Metric l21_metric(normal_pmap, area_pmap);
|
||||
L21ProxyFitting l21_fitting(normal_pmap, area_pmap);
|
||||
L21Metric l21_metric(mesh);
|
||||
L21ProxyFitting l21_fitting(mesh);
|
||||
|
||||
// algorithm instance
|
||||
VSAL21 vsa_l21(l21_metric, l21_fitting);
|
||||
|
|
|
|||
|
|
@ -12,17 +12,10 @@
|
|||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Kernel::FT FT;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Polyhedron_3::Facet_handle Facet_handle;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > FacetAreaMap;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, Vector_3> > FacetNormalMap;
|
||||
|
||||
typedef CGAL::PlaneProxy<Polyhedron_3> PlaneProxy;
|
||||
typedef CGAL::L21Metric<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21ProxyFitting;
|
||||
typedef CGAL::L21Metric<Polyhedron_3> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3> L21ProxyFitting;
|
||||
typedef CGAL::VSA_approximation<Polyhedron_3, PlaneProxy, L21Metric, L21ProxyFitting> VSAL21;
|
||||
|
||||
typedef CGAL::Timer Timer;
|
||||
|
|
@ -48,25 +41,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
std::cerr << "#triangles " << mesh.size_of_facets() << std::endl;
|
||||
|
||||
std::map<Facet_handle, Vector_3> facet_normals;
|
||||
std::map<Facet_handle, FT> facet_areas;
|
||||
for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin();
|
||||
fitr != mesh.facets_end(); ++fitr) {
|
||||
Polyhedron_3::Halfedge_handle he = fitr->halfedge();
|
||||
const Point_3 &p0 = he->opposite()->vertex()->point();
|
||||
const Point_3 &p1 = he->vertex()->point();
|
||||
const Point_3 &p2 = he->next()->vertex()->point();
|
||||
|
||||
Vector_3 normal = CGAL::unit_normal(p0, p1, p2);
|
||||
facet_normals.insert(std::pair<Facet_handle, Vector_3>(fitr, normal));
|
||||
FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2))));
|
||||
facet_areas.insert(std::pair<Facet_handle, FT>(fitr, area));
|
||||
}
|
||||
FacetNormalMap normal_pmap(facet_normals);
|
||||
FacetAreaMap area_pmap(facet_areas);
|
||||
|
||||
L21Metric l21_metric(normal_pmap, area_pmap);
|
||||
L21ProxyFitting l21_fitting(normal_pmap, area_pmap);
|
||||
L21Metric l21_metric(mesh);
|
||||
L21ProxyFitting l21_fitting(mesh);
|
||||
|
||||
// algorithm instance
|
||||
VSAL21 vsa_l21(l21_metric, l21_fitting);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,11 @@
|
|||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Kernel::FT FT;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Polyhedron_3::Facet_handle Facet_handle;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > FacetAreaMap;
|
||||
|
||||
typedef CGAL::PlaneProxy<Polyhedron_3> PlaneProxy;
|
||||
typedef CGAL::L2Metric<Polyhedron_3, FacetAreaMap> L2Metric;
|
||||
typedef CGAL::L2Metric<Polyhedron_3> L2Metric;
|
||||
typedef CGAL::L2ProxyFitting<Polyhedron_3> L2ProxyFitting;
|
||||
typedef CGAL::VSA_approximation<Polyhedron_3, PlaneProxy, L2Metric, L2ProxyFitting> VSA;
|
||||
|
||||
|
|
@ -35,20 +32,6 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// facet area map
|
||||
std::map<Facet_handle, FT> facet_areas;
|
||||
for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin();
|
||||
fitr != mesh.facets_end(); ++fitr) {
|
||||
Polyhedron_3::Halfedge_handle he = fitr->halfedge();
|
||||
const Point_3 &p0 = he->opposite()->vertex()->point();
|
||||
const Point_3 &p1 = he->vertex()->point();
|
||||
const Point_3 &p2 = he->next()->vertex()->point();
|
||||
|
||||
FT farea(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2))));
|
||||
facet_areas.insert(std::pair<Facet_handle, FT>(fitr, farea));
|
||||
}
|
||||
FacetAreaMap area_pmap(facet_areas);
|
||||
|
||||
const std::size_t num_proxies = std::atoi(argv[3]);
|
||||
const std::size_t num_iterations = std::atoi(argv[4]);
|
||||
std::vector<int> tris;
|
||||
|
|
@ -57,7 +40,7 @@ int main(int argc, char *argv[])
|
|||
if (init < 0 || init > 2)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
L2Metric metric(mesh, area_pmap);
|
||||
L2Metric metric(mesh);
|
||||
L2ProxyFitting proxy_fitting(mesh);
|
||||
|
||||
// create VSA L2 metric approximation algorithm instance
|
||||
|
|
|
|||
|
|
@ -10,16 +10,15 @@
|
|||
#include <CGAL/VSA_approximation.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Kernel::FT FT;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Polyhedron_3::Facet_handle Facet_handle;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > FacetAreaMap;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, std::size_t> > FacetProxyMap;
|
||||
|
||||
typedef CGAL::PlaneProxy<Polyhedron_3> PlaneProxy;
|
||||
typedef CGAL::L2Metric<Polyhedron_3, FacetAreaMap> L2Metric;
|
||||
typedef CGAL::L2Metric<Polyhedron_3> L2Metric;
|
||||
typedef CGAL::L2ProxyFitting<Polyhedron_3> L2ProxyFitting;
|
||||
typedef CGAL::VSA_approximation<Polyhedron_3, PlaneProxy, L2Metric, L2ProxyFitting> VSA;
|
||||
|
||||
|
|
@ -37,24 +36,13 @@ int main()
|
|||
}
|
||||
|
||||
// facet area map
|
||||
std::map<Facet_handle, FT> facet_areas;
|
||||
std::map<Facet_handle, std::size_t> facet_index;
|
||||
for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin();
|
||||
fitr != mesh.facets_end(); ++fitr) {
|
||||
Polyhedron_3::Halfedge_handle he = fitr->halfedge();
|
||||
const Point_3 &p0 = he->opposite()->vertex()->point();
|
||||
const Point_3 &p1 = he->vertex()->point();
|
||||
const Point_3 &p2 = he->next()->vertex()->point();
|
||||
|
||||
FT farea(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2))));
|
||||
facet_areas.insert(std::pair<Facet_handle, FT>(fitr, farea));
|
||||
|
||||
fitr != mesh.facets_end(); ++fitr)
|
||||
facet_index.insert(std::pair<Facet_handle, std::size_t>(fitr, 0));
|
||||
}
|
||||
FacetAreaMap area_pmap(facet_areas);
|
||||
FacetProxyMap proxy_pmap(facet_index);
|
||||
|
||||
L2Metric metric(mesh, area_pmap);
|
||||
L2Metric metric(mesh);
|
||||
L2ProxyFitting proxy_fitting(mesh);
|
||||
|
||||
// create VSA L2 metric approximation algorithm instance
|
||||
|
|
|
|||
|
|
@ -10,18 +10,13 @@
|
|||
#include <CGAL/VSA_approximation.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Kernel::FT FT;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Polyhedron_3::Facet_handle Facet_handle;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > FacetAreaMap;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, Vector_3> > FacetNormalMap;
|
||||
|
||||
typedef CGAL::PlaneProxy<Polyhedron_3> PlaneProxy;
|
||||
typedef CGAL::L21Metric<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21ProxyFitting;
|
||||
typedef CGAL::L21Metric<Polyhedron_3> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3> L21ProxyFitting;
|
||||
typedef CGAL::VSA_approximation<Polyhedron_3, PlaneProxy, L21Metric, L21ProxyFitting> VSAL21;
|
||||
|
||||
bool test_shape(const char *file_name, const std::size_t target_num_proxies)
|
||||
|
|
@ -33,25 +28,8 @@ bool test_shape(const char *file_name, const std::size_t target_num_proxies)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::map<Facet_handle, Vector_3> facet_normals;
|
||||
std::map<Facet_handle, FT> facet_areas;
|
||||
for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin();
|
||||
fitr != mesh.facets_end(); ++fitr) {
|
||||
Polyhedron_3::Halfedge_handle he = fitr->halfedge();
|
||||
const Point_3 &p0 = he->opposite()->vertex()->point();
|
||||
const Point_3 &p1 = he->vertex()->point();
|
||||
const Point_3 &p2 = he->next()->vertex()->point();
|
||||
|
||||
Vector_3 normal = CGAL::unit_normal(p0, p1, p2);
|
||||
facet_normals.insert(std::pair<Facet_handle, Vector_3>(fitr, normal));
|
||||
FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2))));
|
||||
facet_areas.insert(std::pair<Facet_handle, FT>(fitr, area));
|
||||
}
|
||||
FacetNormalMap normal_pmap(facet_normals);
|
||||
FacetAreaMap area_pmap(facet_areas);
|
||||
|
||||
L21Metric l21_metric(normal_pmap, area_pmap);
|
||||
L21ProxyFitting l21_fitting(normal_pmap, area_pmap);
|
||||
L21Metric l21_metric(mesh);
|
||||
L21ProxyFitting l21_fitting(mesh);
|
||||
|
||||
// algorithm instance
|
||||
VSAL21 vsa_l21(l21_metric, l21_fitting);
|
||||
|
|
|
|||
|
|
@ -10,18 +10,12 @@
|
|||
#include <CGAL/VSA_approximation.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Kernel::FT FT;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
|
||||
typedef Polyhedron_3::Facet_handle Facet_handle;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, FT> > FacetAreaMap;
|
||||
typedef boost::associative_property_map<std::map<Facet_handle, Vector_3> > FacetNormalMap;
|
||||
|
||||
typedef CGAL::PlaneProxy<Polyhedron_3> PlaneProxy;
|
||||
typedef CGAL::L21Metric<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3, FacetNormalMap, FacetAreaMap> L21ProxyFitting;
|
||||
typedef CGAL::L21Metric<Polyhedron_3> L21Metric;
|
||||
typedef CGAL::L21ProxyFitting<Polyhedron_3> L21ProxyFitting;
|
||||
typedef CGAL::VSA_approximation<Polyhedron_3, PlaneProxy, L21Metric, L21ProxyFitting> VSAL21;
|
||||
|
||||
bool check_strict_ordering(const std::vector<FT> &error)
|
||||
|
|
@ -50,25 +44,8 @@ int main()
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::map<Facet_handle, Vector_3> facet_normals;
|
||||
std::map<Facet_handle, FT> facet_areas;
|
||||
for (Polyhedron_3::Facet_iterator fitr = mesh.facets_begin();
|
||||
fitr != mesh.facets_end(); ++fitr) {
|
||||
Polyhedron_3::Halfedge_handle he = fitr->halfedge();
|
||||
const Point_3 &p0 = he->opposite()->vertex()->point();
|
||||
const Point_3 &p1 = he->vertex()->point();
|
||||
const Point_3 &p2 = he->next()->vertex()->point();
|
||||
|
||||
Vector_3 normal = CGAL::unit_normal(p0, p1, p2);
|
||||
facet_normals.insert(std::pair<Facet_handle, Vector_3>(fitr, normal));
|
||||
FT area(std::sqrt(CGAL::to_double(CGAL::squared_area(p0, p1, p2))));
|
||||
facet_areas.insert(std::pair<Facet_handle, FT>(fitr, area));
|
||||
}
|
||||
FacetNormalMap normal_pmap(facet_normals);
|
||||
FacetAreaMap area_pmap(facet_areas);
|
||||
|
||||
L21Metric l21_metric(normal_pmap, area_pmap);
|
||||
L21ProxyFitting l21_fitting(normal_pmap, area_pmap);
|
||||
L21Metric l21_metric(mesh);
|
||||
L21ProxyFitting l21_fitting(mesh);
|
||||
|
||||
// algorithm instance
|
||||
VSAL21 vsa_l21(l21_metric, l21_fitting);
|
||||
|
|
|
|||
Loading…
Reference in New Issue