Subject: CGAL users discussion list
List archive
- From: Efraim Fogel <>
- To:
- Subject: Re: [cgal-discuss] "unite" operation in MinKowski_2
- Date: Thu, 12 May 2011 19:35:41 +0300
You need to use exact-predicate and exact-construction kernel.
When you attach code, attach it in a way that it can be compiled and executed, and perhaps even read by a human being.
Yue Biek wrote:
My OS is win7(32bit) and environment is VS2008,When I used the MinKowski_2 in CGAL_3.8, I found the Union operation of two Boundarys is something wrong.
the function are usd in Minkowski_sum_decomp_2.h
*The exact line is :*
sum_holes = unite(boundary_segments.begin(), boundary_segments.end(),sum_bound, sum_holes);
My target is to morph between two non-convex but simple polygons.
At first,when I morph between a triangle and a rectangle,the "unite" operation is right.and the morph process is right.
However,when the input are two non-convex polygons(PandQ.dat),though the MinKowski sums of the two polygons can be calcuated, the "unite" operation are something wrong. when the input are two non convex polygons, the "unite" operation are right the in the first time,but in the second time ,it fails.
Part of source code are here,Polygon P and Polygon Q are defined before hand,and they are all non-convex and simple(PandQ.dat).
glClear(GL_COLOR_BUFFER_BIT);
float delt=0.11;
while(true)
{
for(float t=0.1;t<=0.9;t+=delt)
{
glClear(GL_COLOR_BUFFER_BIT);
Polygon s_temp;
Polygon t_temp;
for(size_t i=0;i!=P.size();i++)
{
double temp_x=P[i].x()*(1-t);
double temp_y=P[i].y()*(1-t);
Point temp_p(temp_x,temp_y);
s_temp.push_back(temp_p);
}
for(size_t i=0;i!=Q.size();i++)
{
double temp_x=Q[i].x()*t;
double temp_y=Q[i].y()*t;
Point temp_p(temp_x,temp_y);
t_temp.push_back(temp_p);
}
Polygon_with_holes sum=minkowski_sum_2(s_temp,t_temp,ssab_decomp);
std::cout << "P = "; print_polygon (s_temp);
std::cout << "Q = "; print_polygon (t_temp);
std::cout << "P (+) Q = ";print_polygon(sum.outer_boundary());
if(!sum.is_unbounded())
{
glBegin(GL_LINE_LOOP);
for(Polygon::iterator cur=sum.outer_boundary().vertices_begin();cur!=sum.outer_boundary().vertices_end();cur++)
{
glVertex2f(cur->x(),cur->y());
}
glEnd();
glFlush();
}
else
{
for (Polygon_with_holes::Hole_iterator iter=sum.holes_begin();iter!=sum.holes_end();++iter)
{
Polygon::iterator piter=iter->vertices_begin();
glBegin(GL_LINE_LOOP);
for(;piter!=iter->vertices_end();piter++)
{
double temp_x=piter->x();
double temp_y=piter->y();
glVertex2f(temp_x,temp_y);
}
glEnd();
}
}
sum.clear();
s_temp.clear();
t_temp.clear();
if(s_temp.is_empty())
{
cout<<"empty "<<endl;
}
if(t>1.0||t<0.1)
{
delt=-delt;
}
}
}
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
- [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/12/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Efraim Fogel, 05/12/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/15/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Sebastien Loriot (GeometryFactory), 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Bernd Gaertner, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Sebastien Loriot (GeometryFactory), 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Marc Glisse, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Bernd Gaertner, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Sebastien Loriot (GeometryFactory), 05/16/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Yue Biek, 05/15/2011
- Re: [cgal-discuss] "unite" operation in MinKowski_2, Efraim Fogel, 05/12/2011
Archive powered by MHonArc 2.6.16.