mirror of https://github.com/CGAL/cgal
* In order for the examples to run sucessfully without any input arguments (which were required previously), the snap_rounding_data.cpp will run for the default input data file i.e. data/snap_rounding_data. In case of data file as input arguments, the user specified data file will be chosen
This commit is contained in:
parent
a403913539
commit
b08dd99dcc
|
|
@ -0,0 +1,5 @@
|
||||||
|
4
|
||||||
|
0 0 10 10
|
||||||
|
0 10 10 0
|
||||||
|
3 0 3 10
|
||||||
|
7 0 7 10
|
||||||
|
|
@ -20,17 +20,17 @@
|
||||||
|
|
||||||
|
|
||||||
/* Usage
|
/* Usage
|
||||||
*
|
*
|
||||||
* This example converts arbitrary-precision arrangment into fixed-precision using Snap Rounding and by using INPUT DATA FROM A USER SPECIFIED FILE.
|
* This example converts arbitrary-precision arrangment into fixed-precision using Snap Rounding and by using INPUT DATA FROM A USER SPECIFIED FILE.
|
||||||
* <Argument 1> (Mandatory) path to the input file containing the arrangment information.
|
* <Argument 1> (Mandatory) path to the input file containing the arrangment information.
|
||||||
* <Argument 2> (Optional) path to the output file where the results of snap rounding will be stored.
|
* <Argument 2> (Optional) path to the output file where the results of snap rounding will be stored.
|
||||||
* Not providing this argument will print the result on standard output.
|
* Not providing this argument will print the result on standard output.
|
||||||
*
|
*
|
||||||
* Input file format
|
* Input file format
|
||||||
* Line # 1: Number of line-segments present in the file.
|
* Line # 1: Number of line-segments present in the file.
|
||||||
* Line # 2 to N+1: segment_start_point_x <space> segment_start_point_y <space> segment_end_point_x <space> segment_end_point_y
|
* Line # 2 to N+1: segment_start_point_x <space> segment_start_point_y <space> segment_end_point_x <space> segment_end_point_y
|
||||||
*
|
*
|
||||||
* Each line should contain information about just one segment.
|
* Each line should contain information about just one segment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Cartesian.h>
|
||||||
|
|
@ -51,9 +51,10 @@ typedef std::list<Polyline_2> Polyline_list_2;
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if(argc > 3 || argc < 2)
|
//if(argc > 3 || argc < 2)
|
||||||
|
if(argc > 3)
|
||||||
{
|
{
|
||||||
std::cout<< "Incorrect input. <Arg 1> path to the INPUT file. <Arg 2> (optional) path to the OUTPUT file" << std::endl;
|
std::cout<< "Incorrect input. <Arg 1> path to the INPUT file. <Arg 2> (optional) path to the OUTPUT file. No arguments to choose the default data file" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +64,10 @@ int main(int argc, char* argv[])
|
||||||
std::ifstream my_read_file;
|
std::ifstream my_read_file;
|
||||||
std::ofstream my_write_file;
|
std::ofstream my_write_file;
|
||||||
|
|
||||||
my_read_file.open(argv[1]);
|
if(argc > 1)
|
||||||
|
my_read_file.open(argv[1]);
|
||||||
|
else
|
||||||
|
my_read_file.open("data/snap_rounding_data");
|
||||||
|
|
||||||
if(!my_read_file.is_open())
|
if(!my_read_file.is_open())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue