Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] 2D Minkowski Sum - A bug in the convolution method of the 4.0 library

Subject: CGAL users discussion list

List archive

[cgal-discuss] 2D Minkowski Sum - A bug in the convolution method of the 4.0 library


Chronological Thread 
  • From: Tiago Silveira <>
  • To: cgal-discuss <>
  • Subject: [cgal-discuss] 2D Minkowski Sum - A bug in the convolution method of the 4.0 library
  • Date: Tue, 24 Apr 2012 08:14:37 -0300

Hi,
the Minkowski Sum method (convolution), presents a segmentation fault for the following instance (provided by the following code). There are other instances that also generate this error. I'm using version 4.0 of the library. I ran the example using the library 3.5.1 and this problem did not occur. How could I solve this problem?
Tiago.


#include <CGAL/Gmpq.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>

#include <CGAL/minkowski_sum_2.h>

typedef CGAL::Gmpq Number_type;
typedef CGAL::Cartesian<Number_type> k;
typedef k::Point_2 Point_2;
typedef CGAL::Polygon_2<k> Polygon_2;
typedef CGAL::Polygon_with_holes_2<k> Polygon_with_holes_2;

int main() {
    Polygon_2 polA, polB;
    polA.push_back(Point_2(0, 0)); 
    polA.push_back(Point_2(5, 0));
    polA.push_back(Point_2(6, 2));
    polA.push_back(Point_2(6, 3));
    polA.push_back(Point_2(3, 3));
    polA.push_back(Point_2(3, 6));
    polA.push_back(Point_2(8, 6));
    polA.push_back(Point_2(8, 11));
    polA.push_back(Point_2(0, 11));

    polB.push_back(Point_2(0, 0));
    polB.push_back(Point_2(0, -5));
    polB.push_back(Point_2(2, -6));
    polB.push_back(Point_2(3, -6));
    polB.push_back(Point_2(3, -3));
    polB.push_back(Point_2(6, -3));
    polB.push_back(Point_2(6, -8));
    polB.push_back(Point_2(11, -8));
    polB.push_back(Point_2(11, 0));

    std::cout << "A is ";
    polA.is_counterclockwise_oriented() ? "" : "NOT ";
    std::cout << "counterclockwise oriented and ";
    polA.is_simple()? "" : "NOT ";
    std::cout << "simple!" << std::endl;

    std::cout << "B is ";
    polB.is_counterclockwise_oriented() ? "" : "NOT ";
    std::cout << "counterclockwise oriented and ";
    polB.is_simple()? "" : "NOT ";
    std::cout << "simple!" << std::endl;

    std::cout << "\nMinkowski Sum of two polygons:" << std::endl;

    Polygon_with_holes_2 NFP = CGAL::minkowski_sum_2(polA,polB);

    std::cout << NFP << std::endl;

    return 1;
}







Archive powered by MHonArc 2.6.16.

Top of Page