Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Arrangement to file not working

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Arrangement to file not working


Chronological Thread 
  • From: Mateus Bellomo <>
  • To:
  • Subject: Re: [cgal-discuss] Arrangement to file not working
  • Date: Fri, 4 Dec 2015 10:37:49 -0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:2KRWZxXnoaFwaSLQZRclbcoUH9LV8LGtZVwlr6E/grcLSJyIuqrYZh2Ft8tkgFKBZ4jH8fUM07OQ6PC+HzRYqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh770o8WbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/NGSrjwKqQkUaRDXnNhKHEw/MSttB/ZTALJ6GFbSXQTihMPAg7L61bxUZ719yf7reFgwzLJAcqjRr89XXGu7rxgVQTzoCYBLT8wtm/N2eJqi6cOhRu9qgFki6TZZIWSMf02KqbUYd4HXmBMWsJWUitpDYa1bo9JBO0Ea7UL57LhrkcD+EPtTTKnA/nin2dF

I'm not sure about that: the kernel is the CGAL::Cartesian<Number_type> ?

I'm sending the .cpp and CMakeLists attached.

Thank you

2015-12-04 5:33 GMT-02:00 Sebastien Loriot (GeometryFactory) <>:
What kernel are you using?
Please provide a complete example we can compile and run.

Sebastien.


On 12/04/2015 03:40 AM, Mateus Bellomo wrote:
Hello

I'm trying to use the I/O functions to write and read an arrangement to
a file. The problem is that when I try to read the arrangement from the
file the program get stucked. I'm using a very simple program to test
and I already checked the file generated by write and it is not empty.
My .cpp code:

   Arrangement_2 arr1,arr2;
   Point_2 p1 (1 , 3 ) , p2 (3 , 5 ) ;
   XSegment_2 s1 (p1 , p2 ) ;

   Arrangement_2::Halfedge_handle e1 = arr1.insert_in_face_interior( s1
,arr1.unbounded_face( ) ) ;
   Vertex_handle v1 = e1->source();

   ofstream out_file("arr_ex_io.dat");
   out_file << arr1;
   out_file.close();


   ifstream in_file("arr_ex_io.dat");
   in_file >> arr2;
   in_file.close();


Anyone had the same problem? Thanks in advance


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.

project( a.out )


cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}"
VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ")
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )

if ( COMMAND cmake_policy )

cmake_policy( SET CMP0003 NEW )

endif()

# CGAL and its components
find_package( CGAL QUIET COMPONENTS )

if ( NOT CGAL_FOUND )

message(STATUS "This project requires the CGAL library, and will not be
compiled.")
return()

endif()

# include helper file
include( ${CGAL_USE_FILE} )


# Boost and its components
find_package( Boost REQUIRED )

if ( NOT Boost_FOUND )

message(STATUS "This project requires the Boost library, and will not be
compiled.")

return()

endif()

# include for local directory

# include for local package


# Creating entries for target: a.out
# ############################

add_executable( a.out generateRandom.cpp )

add_to_cached_list( CGAL_EXECUTABLE_TARGETS a.out )

# Link the executable to CGAL and third-party libraries
target_link_libraries(a.out ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )

#include <CGAL/Cartesian.h>
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_polyline_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_extended_dcel.h>
#include <bits/stdc++.h>

#include <CGAL/basic.h>
#include <CGAL/IO/Arr_iostream.h>

#include "arr_print.h"

#define EPS 1e-3
#define pb push_back

using namespace std;

typedef CGAL::Quotient<CGAL::MP_Float>                  Number_type;
typedef CGAL::Cartesian<Number_type>                    Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel>              Segment_traits_2;
typedef CGAL::Arr_polyline_traits_2<Segment_traits_2>   Traits_2;
typedef Traits_2::Point_2                               Point_2;
typedef Traits_2::Curve_2                               Polyline_2;

typedef CGAL::Arrangement_2<Traits_2>             Arrangement_2;


typedef Segment_traits_2::X_monotone_curve_2            XSegment_2;
typedef Arrangement_2::Vertex_handle                 Vertexh;


Arrangement_2 arr;

int main (){

  Arrangement_2 arr1,arr2;
  Point_2 p1 (1,3), p2(2,4);
  XSegment_2 s1 (p1,p2);

  Arrangement_2::Halfedge_handle e1 = arr1.insert_in_face_interior( s1 , arr1.unbounded_face( ) ) ;
  Vertexh v1 = e1->source();

  
  ofstream out_file("arr_ex_io.dat");
  out_file << arr1;
  out_file.close();


  ifstream in_file("arr_ex_io.dat");
  if(in_file.is_open()){
    cout << "open" << endl;
    in_file >> arr2;
    in_file.close();
  } else{
    cout << "not open" << endl;
  }

  return 0;
}



Archive powered by MHonArc 2.6.18.

Top of Page