Skip to Content.
Sympa Menu

cgal-discuss - no unbounded face in arrangement read from file

Subject: CGAL users discussion list

List archive

no unbounded face in arrangement read from file


Chronological Thread 
  • From: Kiên Kiêu <>
  • To: liste de diffusion cgal-discuss <>
  • Subject: no unbounded face in arrangement read from file
  • Date: Wed, 30 Jan 2008 09:15:21 +0100 (CET)


Hi,

it seems as if there is a problem when reading an arrangement from a file. In the program below, I create a very simple arrangement of segments (code taken from the CGAL documentation) with 2 faces (1 unbounded). Then the arrangement is saved into a file and another one is read from it. In the arrangement read from the file, there are two faces, but both are considered as bounded.

If this is really a bug, is there a way to fix it?

I am using CGAL 3.3.1 on a Linux PC.

////////////////////////////////////////////////////////

/**********************************************************
* *
* TEST PROGRAM THAT SHOWS THAT THERE IS NO *
* UNBOUNDED FACE IN AN ARRANGEMENT READ FROM *
* FILE *
**********************************************************/

// Author: Kien Kieu
// Tested in January 2008 on CGAL 3.3.1

#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/IO/Arr_iostream.h>

typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;

int main()
{
Arrangement_2 arr;
Segment_2 cv[3];
Point_2 p1 (0, 0), p2 (0, 4), p3 (4, 0);

cv[0] = Segment_2 (p1, p2);
cv[1] = Segment_2 (p2, p3);
cv[2] = Segment_2 (p3, p1);
CGAL::insert_curves (arr, &cv[0], &cv[3]);

std::cout << "Number of faces: " << arr.number_of_faces();
std::cout << " (" << arr.number_of_unbounded_faces() << " unbounded)" <<
std::endl;

std::cout << "Saving arrangement to file test_unbounded_face.txt" <<
std::endl;

std::ofstream output("test_unbounded_face.txt");
output << arr;
output.close();

std::cout << "Reading arrangement from file test_unbounded_face.txt" <<
std::endl;

std::ifstream input("test_unbounded_face.txt");
Arrangement_2 read_arr;
input >> read_arr;
input.close();

std::cout << "Number of faces: " << read_arr.number_of_faces();
std::cout << " (" << read_arr.number_of_unbounded_faces() << " unbounded)"
<< std::endl;

return (0);
}

///////////////////////////////////////////////////////

Ouput:

Number of faces: 2 (1 unbounded)
Saving arrangement to file test_unbounded_face.txt
Reading arrangement from file test_unbounded_face.txt
Number of faces: 2 (0 unbounded)

--
Kiên Kiêu tel : + 33 (0)1 34 65 28 16
Unité MIA, INRA fax : + 33 (0)1 34 65 22 17
Domaine de Vilvert email:

F-78352 Jouy-en-Josas Cedex url : http://www.inra.fr/miaj/



  • no unbounded face in arrangement read from file, Kiên Kiêu, 01/30/2008

Archive powered by MHonArc 2.6.16.

Top of Page