mirror of https://github.com/CGAL/cgal
Fix compilation with GCC
This commit is contained in:
parent
f139720b8d
commit
1f16a606d9
|
|
@ -305,7 +305,7 @@ void filter_by_distance(
|
|||
|
||||
template <typename K>
|
||||
void save_scene(const std::string &fn, const std::vector<CGAL::Point_with_normal_3<K> > &pts) {
|
||||
std::ofstream plyFile(fn);
|
||||
std::ofstream plyFile(fn.c_str());
|
||||
|
||||
plyFile << "ply" << std::endl;
|
||||
plyFile << "format ascii 1.0" << std::endl;
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ bool test_cone_connected_component() {
|
|||
CGAL::Vector_3<K> n = random_normal<K>();
|
||||
n = CGAL::cross_product(axis, n);
|
||||
n = n * (FT) 1.0 / (CGAL::sqrt(n.squared_length()));
|
||||
K::FT a = n * axis;
|
||||
FT a = n * axis;
|
||||
CGAL::Plane_3<K> pl(apex, n);
|
||||
|
||||
FT spacing = angle;
|
||||
|
||||
filter_by_distance(pl, spacing * (K::FT) 0.5, points);
|
||||
filter_by_distance(pl, spacing * FT(0.5), points);
|
||||
|
||||
|
||||
Efficient_ransac ransac;
|
||||
|
|
@ -73,9 +73,9 @@ bool test_cone_connected_component() {
|
|||
// a single shape and a lower cluster_epsilon for the second half
|
||||
// to get two separated shapes.
|
||||
if (i < NB_ROUNDS/2)
|
||||
parameters.cluster_epsilon = spacing * (K::FT) 1.5;
|
||||
parameters.cluster_epsilon = spacing * FT(1.5);
|
||||
else
|
||||
parameters.cluster_epsilon = spacing * (K::FT) 0.8;
|
||||
parameters.cluster_epsilon = spacing * FT(0.8);
|
||||
|
||||
if (!ransac.detect(parameters)) {
|
||||
std::cout << " aborted" << std::endl;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ bool test_cylinder_connected_component() {
|
|||
|
||||
// generate random points on random cylinder
|
||||
CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10);
|
||||
typename FT radius = (FT) 1.0;
|
||||
FT radius = FT(1.0);
|
||||
Vector axis = random_normal<K>();
|
||||
Point center = random_point_in<K>(bbox);
|
||||
|
||||
|
|
@ -50,13 +50,13 @@ bool test_cylinder_connected_component() {
|
|||
|
||||
save_scene("cylinder_pre.ply", points);
|
||||
|
||||
filter_by_distance(pl, spacing * (K::FT) 0.5, points);
|
||||
filter_by_distance(pl, spacing * FT(0.5), points);
|
||||
|
||||
save_scene("cylinder_post.ply", points);
|
||||
|
||||
Efficient_ransac ransac;
|
||||
|
||||
ransac.add_shape_factory<Cylinder>();
|
||||
ransac.template add_shape_factory<Cylinder>();
|
||||
|
||||
ransac.set_input(points);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ bool test_scene() {
|
|||
|
||||
typename Efficient_ransac::Shape_range shapes = ransac.shapes();
|
||||
|
||||
Efficient_ransac::Shape_range::iterator it = shapes.begin();
|
||||
typename Efficient_ransac::Shape_range::iterator it = shapes.begin();
|
||||
|
||||
// Iterate through all shapes and access each point.
|
||||
while (it != shapes.end()) {
|
||||
boost::shared_ptr<Efficient_ransac::Shape> shape = *it;
|
||||
boost::shared_ptr<typename Efficient_ransac::Shape> shape = *it;
|
||||
|
||||
// Sums distances of points to detected shapes.
|
||||
FT sum_distances = 0;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ bool test_sphere_connected_component() {
|
|||
const int NB_ROUNDS = 10;
|
||||
const int NB_POINTS = 2000;
|
||||
|
||||
typedef K::FT FT;
|
||||
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_pmap<K> Normal_map;
|
||||
|
|
@ -33,7 +32,7 @@ bool test_sphere_connected_component() {
|
|||
Pwn_vector points;
|
||||
|
||||
// generate random points on random sphere
|
||||
typename FT radius = 1.0;
|
||||
FT radius = 1.0;
|
||||
Point center;
|
||||
CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10);
|
||||
|
||||
|
|
@ -43,9 +42,9 @@ bool test_sphere_connected_component() {
|
|||
CGAL::Vector_3<K> n = random_normal<K>();
|
||||
CGAL::Plane_3<K> pl(center, n);
|
||||
|
||||
FT spacing = radius / K::FT(4);
|
||||
FT spacing = radius / FT(4);
|
||||
|
||||
filter_by_distance(pl, spacing * (K::FT) 0.5, points);
|
||||
filter_by_distance(pl, spacing * FT(0.5), points);
|
||||
|
||||
Efficient_ransac ransac;
|
||||
|
||||
|
|
@ -65,9 +64,9 @@ bool test_sphere_connected_component() {
|
|||
// a single shape and a lower cluster_epsilon for the second half
|
||||
// to get two separated shapes.
|
||||
if (i < NB_ROUNDS/2)
|
||||
parameters.cluster_epsilon = spacing * (K::FT) 1.5;
|
||||
parameters.cluster_epsilon = spacing * FT(1.5);
|
||||
else
|
||||
parameters.cluster_epsilon = spacing * (K::FT) 0.9;
|
||||
parameters.cluster_epsilon = spacing * FT(0.9);
|
||||
|
||||
if (!ransac.detect(parameters)) {
|
||||
std::cout << " aborted" << std::endl;
|
||||
|
|
|
|||
|
|
@ -49,10 +49,11 @@ bool test_torus_connected_component() {
|
|||
|
||||
FT spacing = (FT) 1;
|
||||
|
||||
filter_by_distance(pl, spacing * (K::FT) 0.5, points);
|
||||
filter_by_distance(pl, spacing * FT(0.5), points);
|
||||
|
||||
Efficient_ransac ransac;
|
||||
|
||||
|
||||
ransac.template add_shape_factory<Torus>();
|
||||
|
||||
ransac.set_input(points);
|
||||
|
|
|
|||
Loading…
Reference in New Issue