This commit is contained in:
Efi Fogel 2009-07-11 14:53:19 +00:00
parent 2b9277120e
commit 6bea9c6d0a
4 changed files with 25 additions and 22 deletions

View File

@ -36,14 +36,15 @@ int main (int argc, char *argv[])
// <x_2> <y_2> // point #2.
// : : : :
// <x_n> <y_n> // point #n.
unsigned int n, k;
int px, py;
std::vector<Point_2> points;
std::list<X_monotone_curve_2> dual_lines;
unsigned int n;
in_file >> n;
points.resize (n);
for (k = 0; k < n; k++) {
points.resize(n);
unsigned int k;
for (k = 0; k < n; ++k) {
int px, py;
in_file >> px >> py;
points[k] = Point_2 (px, py);

View File

@ -21,7 +21,7 @@ int main (int argc, char *argv[])
{
// Get the name of the input file from the command line, or use the default
// points.dat file if no command-line parameters are given.
const char *filename = (argc > 1) ? argv[1] : "coll_points.dat";
const char * filename = (argc > 1) ? argv[1] : "coll_points.dat";
// Open the input file.
std::ifstream in_file (filename);
@ -32,22 +32,23 @@ int main (int argc, char *argv[])
}
// Read the points from the file, and consturct their dual lines.
unsigned int n;
int px, py;
std::vector<Point_2> points;
Line_2 dual_line;
std::list<X_monotone_curve_2> dual_lines;
unsigned int k;
unsigned int n;
in_file >> n;
points.resize (n);
for (k = 0; k < n; k++) {
unsigned int k;
for (k = 0; k < n; ++k) {
int px, py;
in_file >> px >> py;
points[k] = Point_2 (px, py);
// The line dual to the point (p_x, p_y) is y = p_x*x - p_y,
// or: p_x*x - y - p_y = 0:
dual_line = Line_2 (Number_type(px), Number_type(-1), Number_type(-py));
Line_2 dual_line = Line_2(Number_type(px),
Number_type(-1),
Number_type(-py));
// Generate the x-monotone curve based on the line and the point index.
dual_lines.push_back (X_monotone_curve_2 (dual_line, k));

View File

@ -20,11 +20,11 @@ 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 (int argc, char **argv)
int main (int argc, char *argv[])
{
// Get the name of the input file from the command line, or use the default
// fan_grids.dat file if no command-line parameters are given.
const char *filename = (argc > 1) ? argv[1] : "fan_grids.dat";
const char * filename = (argc > 1) ? argv[1] : "fan_grids.dat";
// Open the input file.
std::ifstream in_file (filename);
@ -41,13 +41,14 @@ int main (int argc, char **argv)
// <sx_2> <sy_2> <tx_2> <ty_2> // source and target of segment #2.
// : : : :
// <sx_n> <sy_n> <tx_n> <ty_n> // source and target of segment #n.
int n;
std::list<Segment_2> segments;
int sx, sy, tx, ty;
int i;
std::list<Segment_2> segments;
unsigned int n;
in_file >> n;
for (i = 0; i < n; i++) {
unsigned int i;
for (i = 0; i < n; ++i) {
int sx, sy, tx, ty;
in_file >> sx >> sy >> tx >> ty;
segments.push_back (Segment_2 (Point_2 (Number_type(sx), Number_type(sy)),
Point_2 (Number_type(tx), Number_type(ty))));

View File

@ -20,7 +20,7 @@ int main (int argc, char *argv[])
{
// Get the name of the input file from the command line, or use the default
// Europe.dat file if no command-line parameters are given.
const char *filename = (argc > 1) ? argv[1] : "Europe.dat";
const char * filename = (argc > 1) ? argv[1] : "Europe.dat";
// Open the input file.
std::ifstream in_file (filename);
@ -38,13 +38,13 @@ int main (int argc, char *argv[])
// <sx_2> <sy_2> <tx_2> <ty_2> // source and target of segment #2.
// : : : :
// <sx_n> <sy_n> <tx_n> <ty_n> // source and target of segment #n.
int n;
std::list<Segment_2> segments;
double sx, sy, tx, ty;
int i;
unsigned int n;
in_file >> n;
for (i = 0; i < n; i++) {
unsigned int i;
for (i = 0; i < n; ++i) {
double sx, sy, tx, ty;
in_file >> sx >> sy >> tx >> ty;
segments.push_back (Segment_2 (Point_2 (Number_type(sx), Number_type(sy)),
Point_2 (Number_type(tx), Number_type(ty))));