Subject: CGAL users discussion list
List archive
- From: Shriramana Sharma <>
- To:
- Subject: [cgal-discuss] Help with understanding boolops on Bezier polygons
- Date: Tue, 6 Nov 2012 13:26:00 +0530
Hello. I'm new to CGAL. I'm thinking of using CGAL for doing boolops
on glyph outlines which are polygons outlined by Bezier curves.
Thankfully, there is a help section directly devoted to this:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Boolean_set_operations_2/Chapter_main.html#Subsection_19.4.3
However I'm not an expert programmer and this generic programming
stuff is somewhat intimidating. Basically I think I'll be writing some
simple wrapper to the exact CGAL functionality I require in my
project. As this is my initial post (regarding actual programming) I
have quite a number of questions. My sincere thanks in advance for
your kindness and patience in reading and replying!
My questions:
1. HANDLING OF SELF-INTERSECTIONS
a. I'd like some clarification whether the boolops code works on
self-intersecting polygons or not. The post:
http://cgal-discuss.949826.n4.nabble.com/self-intersecting-beziers-and-arrangement-algorithms-td1576662.html
seems to indicate that they are handled properly. Therein, EfiF says:
"I have a feeling that self intersections are handled correctly after
all as opposed to the statement in the manual. I'll try to
investigate." but I do not see any update in that thread after that,
and the manual still says that the polygon being simple is a condition
for the boolop code to work.
b. Just a clarification of the above: if the answer to the above is
yes, then it means that self-intersecting polygons are simplified by
the boolop algorithm and the output will no longer contain
self-intersections, right?
c. This would further mean that if I perform a union on a single
self-intersecting polygon it would produce a simple or relatively
simple polygon that is graphically equal to the input polygon, right?
2.
Compiling CGAL-4.1/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp
which is the example of boolops on font glyphs takes 24 seconds on my
Lenovo Z570 laptop (i5-2410M @ 2.3 GHz running with hyperthreading on,
3 GB RAM, 640 GB HDD) running Kubuntu Precise 64-bit with 1 GB RAM
free.
I suspect most of the time is taken up by the numerous template
instantiations in CGAL. Is it possible for me to do some pre-compiled
headers trick or something to reduce this compile time?
3.
I was wondering about the content of char_g.dat related to the boolops
example: especially whether those curves are really degree 6 -- and I
wrote the attached (GPLed) Python program (using PyQt) to help me
visualize the glyph formed by the data. (I removed the /100000000 from
char_g.dat for my programming convenience.) Surely the original font
glyph doesn't contain 6th degree curves -- is this then just to
demonstrate that such higher-degree curves are also handled?
4.
I tried to use the pretty print utilities with the glyph intersection
example, and just added (apart from the #include "print_utils.h") the
following lines before the "Intersection took x seconds" line:
int i = 1 ;
for (rit = R.begin(); rit != R.end(); ++rit)
{
std::cout << "Polygon #" << i << ":" << std::endl;
print_polygon_with_holes ( *rit ) ;
++i;
}
but I'm getting an error:
/home/samjnaa/bn/cpp-cgal/boolean-test.cpp: In function ‘int main(int,
char**)’:
/home/samjnaa/bn/cpp-cgal/boolean-test.cpp:168:37: error: no matching
function for call to ‘print_polygon_with_holes(const
CGAL::General_polygon_with_holes_2<CGAL::General_polygon_2<CGAL::Arr_Bezier_curve_traits_2<CGAL::Cartesian<CORE::BigRat>,
CGAL::Cartesian<CORE::Expr>, CGAL::CORE_algebraic_number_traits> >
>&)’
/home/samjnaa/bn/cpp-cgal/boolean-test.cpp:168:37: note: candidate is:
/home/samjnaa/bn/cpp-cgal/print_utils.h:27:6: note: template<class
Kernel, class Container> void print_polygon_with_holes(const
CGAL::Polygon_with_holes_2<Kernel_, Container_>&)
make[2]: *** [CMakeFiles/boolean-test.dir/boolean-test.cpp.o] Error 1
make[1]: *** [CMakeFiles/boolean-test.dir/all] Error 2
make: *** [all] Error 2
I'm not sure what I'm doing wrong. I'm using GCC 4.6.3 which comes
with my Kubuntu Precise 64-bit OS. Can you please help me solve the
above problem?
Thanking you very much once again for your kindness and patience,
--
Shriramana Sharma
Attachment:
n-degree-bezier-display.zip
Description: Zip archive
- [cgal-discuss] Help with understanding boolops on Bezier polygons, Shriramana Sharma, 11/06/2012
- [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Shriramana Sharma, 11/06/2012
- Re: [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Philipp Moeller, 11/06/2012
- Re: Re: [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Laurent Rineau (CGAL/GeometryFactory), 11/06/2012
- Re: [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Philipp Moeller, 11/06/2012
- Re: Re: [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Laurent Rineau (CGAL/GeometryFactory), 11/06/2012
- Re: [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Philipp Moeller, 11/06/2012
- Re: [cgal-discuss] Help with understanding boolops on Bezier polygons, Efi Fogel, 11/06/2012
- Re: [cgal-discuss] Help with understanding boolops on Bezier polygons, Shriramana Sharma, 11/07/2012
- Re: [cgal-discuss] Help with understanding boolops on Bezier polygons, Ophir Setter, 11/07/2012
- Re: [cgal-discuss] Help with understanding boolops on Bezier polygons, Shriramana Sharma, 11/07/2012
- [cgal-discuss] Re: Help with understanding boolops on Bezier polygons, Shriramana Sharma, 11/06/2012
Archive powered by MHonArc 2.6.18.