mirror of https://github.com/CGAL/cgal
Add cpp, cmd and data files for test suite
This commit is contained in:
parent
ea4e6066f9
commit
61de3aa5e6
|
|
@ -0,0 +1 @@
|
|||
17
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/** @file cones_exact.cpp
|
||||
* A test application that computes the cone boundaries exactly given the number of cones
|
||||
* and the initial direction.
|
||||
*
|
||||
* Authors: Weisheng Si and Quincy Tse, University of Western Sydney
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
|
||||
#include <CGAL/Compute_cone_boundaries_2.h>
|
||||
|
||||
// select the kernel type
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel_with_root_of Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Direction_2 Direction_2;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
if (argc < 2) {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long k = atol(argv[1]);
|
||||
if (k<2) {
|
||||
std::cout << "The number of cones should be larger than 1!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Direction_2 initial_direction;
|
||||
if (argc == 2)
|
||||
initial_direction = Direction_2(1, 0); // default initial_direction
|
||||
else if (argc == 4)
|
||||
initial_direction = Direction_2(atof(argv[2]), atof(argv[3]));
|
||||
else {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// construct the functor
|
||||
CGAL::Compute_cone_boundaries_2<Kernel> cones;
|
||||
// create the vector rays to store the results
|
||||
std::vector<Direction_2> rays(k);
|
||||
// compute the cone boundaries and store them in rays
|
||||
cones(k, initial_direction, rays.begin());
|
||||
|
||||
// display the computed rays, starting from the initial direction, ccw order
|
||||
for (int i=0; i<k; i++)
|
||||
std::cout << "Ray " << i << ": " << rays[i] << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
17
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/** @file cones_inexact.cpp
|
||||
* A test application that computes the cone boundaries inexactly given the number of cones
|
||||
* and the initial direction.
|
||||
*
|
||||
* Authors: Weisheng Si and Quincy Tse, University of Western Sydney
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Compute_cone_boundaries_2.h>
|
||||
|
||||
// select the kernel type
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Direction_2 Direction_2;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
if (argc < 2) {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long k = atol(argv[1]);
|
||||
if (k<2) {
|
||||
std::cout << "The number of cones should be larger than 1!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Direction_2 initial_direction;
|
||||
if (argc == 2)
|
||||
initial_direction = Direction_2(1, 0); // default initial_direction
|
||||
else if (argc == 4)
|
||||
initial_direction = Direction_2(atof(argv[2]), atof(argv[3]));
|
||||
else {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// construct the functor
|
||||
CGAL::Compute_cone_boundaries_2<Kernel> cones;
|
||||
// create the vector rays to store the results
|
||||
std::vector<Direction_2> rays(k);
|
||||
// compute the cone boundaries and store them in rays
|
||||
cones(k, initial_direction, rays.begin());
|
||||
|
||||
// display the computed rays, starting from the initial direction, ccw order
|
||||
for (int i=0; i<k; i++)
|
||||
std::cout << "Ray " << i << ": " << rays[i] << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
97.6188 489.679
|
||||
673.018 672.436
|
||||
67.6374 539.91
|
||||
40.0488 138.312
|
||||
110.286 659.128
|
||||
399.326 677.844
|
||||
585.28 614.301
|
||||
880.102 831.773
|
||||
752.166 840.363
|
||||
437.925 993.181
|
||||
120.746 215.884
|
||||
32.6144 584.674
|
||||
845.06 328.004
|
||||
656.569 774.867
|
||||
843.833 334.36
|
||||
368.169 941.452
|
||||
824.039 41.1866
|
||||
613.888 891.676
|
||||
581.096 653.936
|
||||
29.9877 691.382
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
0.000000 0.000000
|
||||
0.000000 1.000000
|
||||
0.000000 2.000000
|
||||
1.000000 0.000000
|
||||
1.000000 1.000000
|
||||
1.000000 2.000000
|
||||
2.000000 0.000000
|
||||
2.000000 1.000000
|
||||
2.000000 2.000000
|
||||
|
|
@ -0,0 +1 @@
|
|||
4 data/n20.cin
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/** @file theta_exact.cpp
|
||||
* A test application that constructs a Theta graph exactly with the vertex list
|
||||
* given in a file, and then generates the Gnuplot files for plotting the constructed Theta graph.
|
||||
*
|
||||
* Authors: Weisheng Si and Quincy Tse, University of Western Sydney
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
|
||||
#include <CGAL/Construct_theta_graph_2.h>
|
||||
#include <CGAL/gnuplot_output_2.h>
|
||||
|
||||
// select the kernel type
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel_with_root_of Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Direction_2 Direction_2;
|
||||
// define the graph type
|
||||
typedef boost::adjacency_list<boost::listS,
|
||||
boost::vecS,
|
||||
boost::directedS,
|
||||
Point_2
|
||||
> Graph;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
if (argc < 3) {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long k = atol(argv[1]);
|
||||
if (k<2) {
|
||||
std::cout << "The number of cones should be larger than 1!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// open the file containing the vertex list
|
||||
std::ifstream inf(argv[2]);
|
||||
if (!inf) {
|
||||
std::cout << "Cannot open file " << argv[2] << "!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Direction_2 initial_direction;
|
||||
if (argc == 3)
|
||||
initial_direction = Direction_2(1, 0); // default initial_direction
|
||||
else if (argc == 5)
|
||||
initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));
|
||||
else {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// iterators for reading the vertex list file
|
||||
std::istream_iterator<Point_2> input_begin( inf );
|
||||
std::istream_iterator<Point_2> input_end;
|
||||
|
||||
// initialize the functor
|
||||
CGAL::Construct_theta_graph_2<Kernel, Graph> theta(k, initial_direction);
|
||||
// create an adjacency_list object
|
||||
Graph g;
|
||||
// construct the theta graph on the vertex list
|
||||
theta(input_begin, input_end, g);
|
||||
|
||||
// obtain the number of vertices in the constructed graph
|
||||
unsigned int n = boost::num_vertices(g);
|
||||
// generate gnuplot files for plotting this graph
|
||||
std::string file_prefix = "t" + std::to_string(k) + "n" + std::to_string(n);
|
||||
CGAL::gnuplot_output_2(g, file_prefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
4 data/n9.cin
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/** @file theta_inexact.cpp
|
||||
*
|
||||
* A test application that constructs a Theta graph inexactly with the vertex list
|
||||
* given in a file, and then generates the Gnuplot files for plotting the constructed Theta graph.
|
||||
*
|
||||
* Authors: Weisheng Si and Quincy Tse, University of Western Sydney
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Construct_theta_graph_2.h>
|
||||
#include <CGAL/gnuplot_output_2.h>
|
||||
|
||||
// select the kernel type
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Direction_2 Direction_2;
|
||||
// define the graph type
|
||||
typedef boost::adjacency_list<boost::listS,
|
||||
boost::vecS,
|
||||
boost::directedS,
|
||||
Point_2
|
||||
> Graph;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
if (argc < 3) {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long k = atol(argv[1]);
|
||||
if (k<2) {
|
||||
std::cout << "The number of cones should be larger than 1!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// open the file containing the vertex list
|
||||
std::ifstream inf(argv[2]);
|
||||
if (!inf) {
|
||||
std::cout << "Cannot open file " << argv[2] << "!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Direction_2 initial_direction;
|
||||
if (argc == 3)
|
||||
initial_direction = Direction_2(1, 0); // default initial_direction
|
||||
else if (argc == 5)
|
||||
initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));
|
||||
else {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// iterators for reading the vertex list file
|
||||
std::istream_iterator<Point_2> input_begin( inf );
|
||||
std::istream_iterator<Point_2> input_end;
|
||||
|
||||
// initialize the functor
|
||||
CGAL::Construct_theta_graph_2<Kernel, Graph> theta(k, initial_direction);
|
||||
// create an adjacency_list object
|
||||
Graph g;
|
||||
// construct the theta graph on the vertex list
|
||||
theta(input_begin, input_end, g);
|
||||
|
||||
// obtain the number of vertices in the constructed graph
|
||||
unsigned int n = boost::num_vertices(g);
|
||||
// generate gnuplot files for plotting this graph
|
||||
std::string file_prefix = "t" + std::to_string(k) + "n" + std::to_string(n);
|
||||
CGAL::gnuplot_output_2(g, file_prefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
4 data/n20.cin
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/** @file yao_exact.cpp
|
||||
*
|
||||
* A test application that constructs a Yao graph exactly with the vertex list given
|
||||
* in a file, and then generates the Gnuplot files to plot the constructed Yao graph.
|
||||
*
|
||||
* Authors: Weisheng Si, Quincy Tse, Western Sydney University
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_root_of.h>
|
||||
#include <CGAL/Construct_yao_graph_2.h>
|
||||
#include <CGAL/gnuplot_output_2.h>
|
||||
|
||||
// select the kernel type
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel_with_root_of Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Direction_2 Direction_2;
|
||||
typedef boost::adjacency_list<boost::setS,
|
||||
boost::vecS,
|
||||
boost::undirectedS,
|
||||
Point_2
|
||||
> Graph;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
if (argc < 3) {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long k = atol(argv[1]);
|
||||
if (k<2) {
|
||||
std::cout << "The number of cones should be larger than 1!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// open the file containing the vertex list
|
||||
std::ifstream inf(argv[2]);
|
||||
if (!inf) {
|
||||
std::cout << "Cannot open file " << argv[2] << "!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Direction_2 initial_direction;
|
||||
if (argc == 3)
|
||||
initial_direction = Direction_2(1, 0); // default initial_direction
|
||||
else if (argc == 5)
|
||||
initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));
|
||||
else {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// iterators for reading the vertex list file
|
||||
std::istream_iterator<Point_2> input_begin( inf );
|
||||
std::istream_iterator<Point_2> input_end;
|
||||
|
||||
// initialize the functor
|
||||
CGAL::Construct_yao_graph_2<Kernel, Graph> yao(k, initial_direction);
|
||||
// create an adjacency_list object
|
||||
Graph g;
|
||||
// construct the yao graph on the vertex list
|
||||
yao(input_begin, input_end, g);
|
||||
|
||||
// obtain the number of vertices in the constructed graph
|
||||
unsigned int n = boost::num_vertices(g);
|
||||
|
||||
// generate gnuplot files for plotting this graph
|
||||
std::string fileprefix = "y" + std::to_string(k) + "n" + std::to_string(n);
|
||||
CGAL::gnuplot_output_2(g, fileprefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
4 data/n9.cin
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/** @file yao_inexact.cpp
|
||||
*
|
||||
* A test application that constructs a Yao graph inexactly with the vertex list given
|
||||
* in a file, and then generates the Gnuplot files to plot the constructed Yao graph.
|
||||
*
|
||||
* Authors: Weisheng Si, Quincy Tse, Western Sydney University
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Construct_yao_graph_2.h>
|
||||
#include <CGAL/gnuplot_output_2.h>
|
||||
|
||||
// select the kernel type
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Direction_2 Direction_2;
|
||||
typedef boost::adjacency_list<boost::setS,
|
||||
boost::vecS,
|
||||
boost::undirectedS,
|
||||
Point_2
|
||||
> Graph;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
if (argc < 3) {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned long k = atol(argv[1]);
|
||||
if (k<2) {
|
||||
std::cout << "The number of cones should be larger than 1!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// open the file containing the vertex list
|
||||
std::ifstream inf(argv[2]);
|
||||
if (!inf) {
|
||||
std::cout << "Cannot open file " << argv[2] << "!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Direction_2 initial_direction;
|
||||
if (argc == 3)
|
||||
initial_direction = Direction_2(1, 0); // default initial_direction
|
||||
else if (argc == 5)
|
||||
initial_direction = Direction_2(atof(argv[3]), atof(argv[4]));
|
||||
else {
|
||||
std::cout << "Usage: " << argv[0] << " <no. of cones> <input filename> [<direction-x> <direction-y>]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// iterators for reading the vertex list file
|
||||
std::istream_iterator<Point_2> input_begin( inf );
|
||||
std::istream_iterator<Point_2> input_end;
|
||||
|
||||
// initialize the functor
|
||||
CGAL::Construct_yao_graph_2<Kernel, Graph> yao(k, initial_direction);
|
||||
// create an adjacency_list object
|
||||
Graph g;
|
||||
// construct the yao graph on the vertex list
|
||||
yao(input_begin, input_end, g);
|
||||
|
||||
// obtain the number of vertices in the constructed graph
|
||||
unsigned int n = boost::num_vertices(g);
|
||||
|
||||
// generate gnuplot files for plotting this graph
|
||||
std::string fileprefix = "y" + std::to_string(k) + "n" + std::to_string(n);
|
||||
CGAL::gnuplot_output_2(g, fileprefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue