Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] CGAL assertion error
- Date: Wed, 08 Jun 2011 18:15:56 +0200
Same here, the outer boundary should be oriented counterclockwise
Sebastien.
CGALFan wrote:
Hi!
Im struggeling with this problem many days now and i couldn't find a
solution: I coded an application to compute the offset polygons of a given
polygon. It worked with my initial test polygon, but when i tried another
one the program failed.
I tested now the Show_offset_polygon.cpp from the examples and it also
didn't work with my polygon and also not the sample_4.dat.
The code is:
#include<vector>
#include<iterator>
#include<iostream>
#include<iomanip>
#include<string>
#include <fstream>
#include<boost/shared_ptr.hpp>
#include<CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include<CGAL/Polygon_with_holes_2.h>
#include<CGAL/create_offset_polygons_from_polygon_with_holes_2.h>
#include "dump_to_eps.h"
typedef CGAL::Exact_predicates_inexact_constructions_kernel K ;
typedef K::Point_2 Point ;
typedef CGAL::Polygon_2<K> Polygon ;
typedef CGAL::Polygon_with_holes_2<K> Polygon_with_holes ;
typedef boost::shared_ptr<Polygon_with_holes> Polygon_with_holes_ptr ;
typedef std::vector<Polygon_with_holes_ptr> Polygon_with_holes_ptr_vector ;
int main( int argc, char* argv[] )
{
Polygon_with_holes input ;
if ( argc > 0 )
{
std::string name = "polygon.dat"; //argv[1] ;
std::cout << "Input file: " << name << std::endl ;
std::ifstream is(name.c_str()) ;
if ( is )
{
is >> input ;
double lOffset = 0.25 ;
if ( argc > 2 )
lOffset = std::atof(argv[2]);
std::cout << "Offsetting at: " << lOffset << std::endl ;
Polygon_with_holes_ptr_vector offset_polygons =
CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2(lOffset,input);
std::string eps_name ;
if ( argc > 3 )
eps_name = argv[3];
else eps_name = name + ".offset.eps" ;
std::ofstream eps(eps_name.c_str()) ;
if ( eps ) {
std::cerr << "Result: " << eps_name << std::endl ;
dump_to_eps(input,offset_polygons,eps);
}
else
{
std::cerr << "Could not open result file: " << eps_name << std::endl
;
} } else
{
std::cerr << "Could not open input file: " << name << std::endl ;
} }
else
{
std::cerr << "Computes the interior offset of a polygon with holes and
draws the result in an EPS file." << std::endl << std::endl << "Usage: show_offset_polygon <input_file> [offset_distance]
[output_eps_file]" << std::endl
<< std::endl << " intput_file Text file describing the input polygon
with holes." << std::endl
<< " (See inputfile_format.txt for details)" <<
std::endl
<< " offset_distance [default=0.25]." << std::endl << " output_file [default='innput_file.offset.eps']"
<< std::endl ; }
return 0;
}
My polygon.dat is:
6
714.279947091038 700.8634379411073
928.4204862107923 634.3685299163473
1036.226377703022 541.314748318798
1063.559817470496 471.3282081692817
756.8882581986625 329.5089199763363
658.0658590822038 508.0303788777358
0
The error is:
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: lParent
File: /usr/local/include/CGAL/arrange_offset_polygons_2.h
Please help me!
Nice greets
Gernot
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/CGAL-assertion-error-tp3555293p3555293.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- Re: [cgal-discuss] CGAL assertion error, Sebastien Loriot (GeometryFactory), 06/08/2011
Archive powered by MHonArc 2.6.16.