Subject: CGAL users discussion list
List archive
- From: "陈剑锋" <>
- To:
- Subject: Re: Re: [cgal-discuss] Debug version is o k ,but Release version is bad,Why?
- Date: Tue, 3 Jul 2007 14:31:23 +0800 (CST)
Just this code .
I modify the code segment.
When Debug version , it run ok.
But Release version ,it run bad. The Result is not right.Why?
///////////////////////////////////////////////////
/*! \file simple_join_intersect.cpp
* Computing the union and the intersection of two simple polygons.
*/
#include "bso_rational_nt.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <list>
// instead of
//typedef CGAL::Cartesian<Number_type> Kernel;
// workaround for VC++
struct Kernel : public CGAL::Cartesian<Number_type> {};
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
typedef std::list<Polygon_with_holes_2> Pwh_list_2;
#include "print_utils.h"
int main ()
{
// Construct the two input polygons.
Polygon_2 P;
//P.push_back (Point_2 (0, 0));
//P.push_back (Point_2 (5, 0));
//P.push_back (Point_2 (3.5, 1.5));
//P.push_back (Point_2 (2.5, 0.5));
//P.push_back (Point_2 (1.5, 1.5));
P.push_back (Point_2 (0, 0));
P.push_back (Point_2 (10, 0));
P.push_back (Point_2 (10,10));
P.push_back (Point_2 (0, 10));
//P.reverse_orientation();
std::cout << "P = "; print_polygon (P);
Polygon_2 Q;
//Q.push_back (Point_2 (0, 2));
//Q.push_back (Point_2 (1.5, 0.5));
//Q.push_back (Point_2 (2.5, 1.5));
//Q.push_back (Point_2 (3.5, 0.5));
//Q.push_back (Point_2 (5, 2));
Q.push_back (Point_2 (1,1));
Q.push_back (Point_2 (1,5));
Q.push_back (Point_2 (5,5));
Q.push_back (Point_2 (5,1));
std::cout << "Q = "; print_polygon (Q);
//// Compute the union of P and Q.
//Polygon_with_holes_2 unionR;
//if (CGAL::join(P, Q, unionR))
//{
// std::cout << "The union: ";
// print_polygon_with_holes (unionR);
//}
//else
// std::cout << "P and Q are disjoint and their union is trivial."
// << std::endl;
//std::cout << std::endl;
// Compute the intersection of P and Q.
Pwh_list_2 intR;
Pwh_list_2::const_iterator it;
try
{
CGAL::difference(P, Q, std::back_inserter(intR));//intersection
}
catch (...)
{
Q.reverse_orientation();
CGAL::difference(P, Q, std::back_inserter(intR));//intersection
}
std::cout << "The intersection:" << std::endl;
for (it = intR.begin(); it != intR.end(); ++it)
{
std::cout << "--> ";
print_polygon_with_holes (*it);
}
return 0;
}
===============================================
快来和我一起享受TOM免费邮箱吧! 看看除了1.5G,还有什么? ![]() ![]() 明星金曲免费送(http://mm.tom.com/ivr/):周杰伦 林俊杰 庞龙 张惠妹 劲爆歌曲尽情点(http://mm.tom.com/ivr/):霍元甲 吉祥三宝 人质 曹操 炫酷彩铃免费送(http://mm.tom.com/cailing/):周杰伦帮你接电话 麻烦女朋友 七里香 小城故事 =============================================== |
- Re: Re: [cgal-discuss] Debug version is o k ,but Release version is bad,Why?, 陈剑锋, 07/03/2007
- <Possible follow-up(s)>
- Re: Re: [cgal-discuss] Debug version is o k ,but Release version is bad,Why?, 陈剑锋, 07/03/2007
- Re: Re: [cgal-discuss] Debug version is o k ,but Release version is bad,Why?, 陈剑锋, 07/03/2007
Archive powered by MHonArc 2.6.16.