Print out first input iterator value at multiple points in the code

This commit is contained in:
Jackson Campolattaro 2020-08-07 16:37:19 -04:00
parent 7f57f18a55
commit 7b7a4e2b6a
2 changed files with 32 additions and 29 deletions

View File

@ -299,6 +299,8 @@ public:
m_input_iterator_first, m_input_iterator_beyond);
m_valid_iterators = true;
std::cout << *(m_input_iterator_first + 0) << std::endl;
}
/*!
@ -562,6 +564,8 @@ public:
static_cast<unsigned int>(m_num_available_points));
while (m_shape_index[first_sample] != -1);
std::cout << *(m_input_iterator_first + 0) << std::endl;
done =
drawSamplesFromCellContainingPoint(m_global_octree,
get(m_point_pmap,

View File

@ -8,7 +8,7 @@
#include <CGAL/property_map.h>
#include <CGAL/number_utils.h>
template <class K>
template<class K>
bool test_cone_parameters() {
// Determined by fair dice roll, guaranteed to be random
@ -18,25 +18,25 @@ bool test_cone_parameters() {
const int NB_ROUNDS = 10;
const int NB_POINTS = 1000;
typedef typename K::FT FT;
typedef CGAL::Point_with_normal_3<K> Pwn;
typedef CGAL::Point_3<K> Point;
typedef CGAL::Vector_3<K> Vector;
typedef std::vector<Pwn> Pwn_vector;
typedef CGAL::Identity_property_map<Pwn> Point_map;
typedef CGAL::Normal_of_point_with_normal_map<K> Normal_map;
typedef typename K::FT FT;
typedef CGAL::Point_with_normal_3<K> Pwn;
typedef CGAL::Point_3<K> Point;
typedef CGAL::Vector_3<K> Vector;
typedef std::vector<Pwn> Pwn_vector;
typedef CGAL::Identity_property_map<Pwn> Point_map;
typedef CGAL::Normal_of_point_with_normal_map<K> Normal_map;
typedef CGAL::Shape_detection::Efficient_RANSAC_traits<K, Pwn_vector, Point_map, Normal_map> Traits;
typedef CGAL::Shape_detection::Efficient_RANSAC<Traits> Efficient_ransac;
typedef CGAL::Shape_detection::Cone<Traits> Cone;
typedef CGAL::Shape_detection::Efficient_RANSAC<Traits> Efficient_ransac;
typedef CGAL::Shape_detection::Cone<Traits> Cone;
std::size_t success = 0;
for (int i = 0 ; i < NB_ROUNDS ; i++) {
for (int i = 0; i < NB_ROUNDS; i++) {
Pwn_vector points;
// Generate random points on random cone.
// Generate random points on random cone.
Vector axis;
Point apex;
FT angle = 0;
@ -44,11 +44,11 @@ bool test_cone_parameters() {
CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10);
sample_random_cone(NB_POINTS, apex, axis, angle, mid,
std::back_inserter(points));
std::back_inserter(points));
std::cout<< apex << std::endl;
std::cout << std::endl;
// Add outliers in second half of rounds.
// Add outliers in second half of rounds.
if (i >= NB_ROUNDS / 2)
for (std::size_t j = 0; j < NB_POINTS / 2; j++)
points.push_back(random_pwn_in<K>(bbox));
@ -64,7 +64,7 @@ bool test_cone_parameters() {
// the extracted primitives are to be tested.
typename Efficient_ransac::Parameters parameters;
parameters.probability = 0.05f;
parameters.min_points = NB_POINTS/10;
parameters.min_points = NB_POINTS / 10;
parameters.epsilon = 0.002f;
parameters.cluster_epsilon = 1.0f;
parameters.normal_threshold = 0.9f;
@ -76,7 +76,7 @@ bool test_cone_parameters() {
typename Efficient_ransac::Shape_range shapes = ransac.shapes();
// Check: unique shape detected.
// Check: unique shape detected.
if (shapes.size() != 1)
continue;
@ -88,13 +88,13 @@ bool test_cone_parameters() {
// Check radius and alignment with axis.
if (CGAL::abs(angle - cone->angle()) > (FT) 0.02
|| CGAL::abs(CGAL::abs(axis * cone->axis()) - (FT) 1.0) > (FT) 0.02)
|| CGAL::abs(CGAL::abs(axis * cone->axis()) - (FT) 1.0) > (FT) 0.02)
continue;
// Check apex.
Point pos = cone->apex();
FT apex_pos_sqlen = traits.compute_squared_length_3_object()(
traits.construct_vector_3_object()(apex, pos));
traits.construct_vector_3_object()(apex, pos));
if (apex_pos_sqlen > FT(0.0004))
continue;
@ -106,8 +106,7 @@ bool test_cone_parameters() {
if (success >= NB_ROUNDS * 0.8) {
std::cout << " succeeded" << std::endl;
return true;
}
else {
} else {
std::cout << " failed" << std::endl;
return false;
}
@ -119,14 +118,14 @@ int main() {
std::cout << "test_cone_parameters<CGAL::Simple_cartesian<float>> ";
if (!test_cone_parameters<CGAL::Simple_cartesian<float> >())
success = false;
std::cout << "test_cone_parameters<CGAL::Simple_cartesian<double>> ";
if (!test_cone_parameters<CGAL::Simple_cartesian<double> >())
success = false;
std::cout << "test_cone_parameters<CGAL::Exact_predicates_inexact_constructions_kernel> ";
if (!test_cone_parameters<CGAL::Exact_predicates_inexact_constructions_kernel>())
success = false;
//
// std::cout << "test_cone_parameters<CGAL::Simple_cartesian<double>> ";
// if (!test_cone_parameters<CGAL::Simple_cartesian<double> >())
// success = false;
//
// std::cout << "test_cone_parameters<CGAL::Exact_predicates_inexact_constructions_kernel> ";
// if (!test_cone_parameters<CGAL::Exact_predicates_inexact_constructions_kernel>())
// success = false;
return (success) ? EXIT_SUCCESS : EXIT_FAILURE;
}