mirror of https://github.com/CGAL/cgal
Don't typedef to Polygon, as it conflicts with a function defined in wingdi.h
See https://stackoverflow.com/questions/4315399/error-c2143-syntax-error-missing-before/4315475#4315475
This commit is contained in:
parent
423ce309f4
commit
09666e34bc
|
|
@ -33,12 +33,12 @@ int main(int argc, char* argv[])
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Approximate the offset polygon.
|
// Approximate the offset polygon.
|
||||||
std::list<Polygon> inset_polygons;
|
std::list<Polygon_2> inset_polygons;
|
||||||
boost::timer timer;
|
boost::timer timer;
|
||||||
approximated_inset_2(P, 1, 0.00001, std::back_inserter(inset_polygons));
|
approximated_inset_2(P, 1, 0.00001, std::back_inserter(inset_polygons));
|
||||||
double secs = timer.elapsed();
|
double secs = timer.elapsed();
|
||||||
|
|
||||||
std::list<Polygon>::iterator it;
|
std::list<Polygon_2>::iterator it;
|
||||||
std::cout << "The inset comprises " << inset_polygons.size()
|
std::cout << "The inset comprises " << inset_polygons.size()
|
||||||
<< " polygon(s)." << std::endl;
|
<< " polygon(s)." << std::endl;
|
||||||
for (it = inset_polygons.begin(); it != inset_polygons.end(); ++it)
|
for (it = inset_polygons.begin(); it != inset_polygons.end(); ++it)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// Approximate the offset polygon with radius 5 and error bound 0.00001.
|
// Approximate the offset polygon with radius 5 and error bound 0.00001.
|
||||||
boost::timer timer;
|
boost::timer timer;
|
||||||
Polygon_with_holes offset = CGAL::approximated_offset_2(P, 5, 0.00001);
|
Polygon_with_holes_2 offset = CGAL::approximated_offset_2(P, 5, 0.00001);
|
||||||
double secs = timer.elapsed();
|
double secs = timer.elapsed();
|
||||||
|
|
||||||
std::cout << "The offset polygon has " << offset.outer_boundary().size()
|
std::cout << "The offset polygon has " << offset.outer_boundary().size()
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||||
typedef CGAL::Gps_circle_segment_traits_2<Kernel> Traits;
|
typedef CGAL::Gps_circle_segment_traits_2<Kernel> Traits;
|
||||||
|
|
||||||
typedef CGAL::General_polygon_set_2<Traits> Polygon_set;
|
typedef CGAL::General_polygon_set_2<Traits> Polygon_set_2;
|
||||||
typedef Traits::Polygon_2 Polygon;
|
typedef Traits::Polygon_2 Polygon_2;
|
||||||
typedef Traits::Polygon_with_holes_2 Polygon_with_holes;
|
typedef Traits::Polygon_with_holes_2 Polygon_with_holes_2;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
#include <CGAL/Boolean_set_operations_2.h>
|
#include <CGAL/Boolean_set_operations_2.h>
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||||
typedef Kernel::Point_2 Point;
|
typedef Kernel::Point_2 Point_2;
|
||||||
typedef CGAL::Polygon_2<Kernel> Polygon;
|
typedef CGAL::Polygon_2<Kernel> Polygon_2;
|
||||||
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes;
|
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
|
||||||
typedef std::list<Polygon_with_holes> Pgn_with_holes_container;
|
typedef std::list<Polygon_with_holes_2> Pgn_with_holes_2_container;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,19 @@
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// Construct the triangle.
|
// Construct the triangle.
|
||||||
Polygon P;
|
Polygon_2 P;
|
||||||
P.push_back(Point(-1, -1)); P.push_back(Point(1, -1));
|
P.push_back(Point_2(-1, -1)); P.push_back(Point_2(1, -1));
|
||||||
P.push_back(Point(0, 1));
|
P.push_back(Point_2(0, 1));
|
||||||
std::cout << "P = " << P << std::endl;
|
std::cout << "P = " << P << std::endl;
|
||||||
|
|
||||||
// Construct the square.
|
// Construct the square.
|
||||||
Polygon Q;
|
Polygon_2 Q;
|
||||||
Q.push_back(Point(3, -1)); Q.push_back(Point(5, -1));
|
Q.push_back(Point_2(3, -1)); Q.push_back(Point_2(5, -1));
|
||||||
Q.push_back(Point(5, 1)); Q.push_back(Point(3, 1));
|
Q.push_back(Point_2(5, 1)); Q.push_back(Point_2(3, 1));
|
||||||
std::cout << "Q = " << Q << std::endl;
|
std::cout << "Q = " << Q << std::endl;
|
||||||
|
|
||||||
// Compute the Minkowski sum.
|
// Compute the Minkowski sum.
|
||||||
Polygon_with_holes sum = CGAL::minkowski_sum_2(P, Q);
|
Polygon_with_holes_2 sum = CGAL::minkowski_sum_2(P, Q);
|
||||||
CGAL_assertion(sum.number_of_holes() == 0);
|
CGAL_assertion(sum.number_of_holes() == 0);
|
||||||
std::cout << "P (+) Q = " << sum.outer_boundary() << std::endl;
|
std::cout << "P (+) Q = " << sum.outer_boundary() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ int main(int argc, char* argv[])
|
||||||
std::cerr << "Failed to open the input file." << std::endl;
|
std::cerr << "Failed to open the input file." << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
Polygon P, Q;
|
Polygon_2 P, Q;
|
||||||
in_file >> P >> Q;
|
in_file >> P >> Q;
|
||||||
in_file.close();
|
in_file.close();
|
||||||
|
|
||||||
// Compute and print the Minkowski sum.
|
// Compute and print the Minkowski sum.
|
||||||
Polygon_with_holes sum = CGAL::minkowski_sum_2(P, Q);
|
Polygon_with_holes_2 sum = CGAL::minkowski_sum_2(P, Q);
|
||||||
std::cout << "P (+) Q = ";
|
std::cout << "P (+) Q = ";
|
||||||
print_polygon_with_holes(sum);
|
print_polygon_with_holes(sum);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue