Subject: CGAL users discussion list
List archive
- From: skhiat <>
- To:
- Subject: [cgal-discuss] Many question about polygon_2 and polyhedron_3
- Date: Thu, 22 Jan 2009 14:13:13 +0100
Hello
I am a new user with CGAL I would like extrude many polygon_2 joined with
union
operation and extrude it in y axis. And with a Polyhedron_3 generated I would
like add intersection plan (y = k) on my Polyhedron_3.
I am here to ask you how I can do it ?
I tried to work on first part of my program : boolean operation with
polygon_2.
I was code function to do primitive polygon :
Polygon_2 doCircle(double R, unsigned short k)
{
Point_2 tmp_p;
Polygon_2 p;
double da = double(2.0*3.1415926535897932)/double(k);
for (unsigned int i = 0; i < k; i++)
{
tmp_p = Point_2(R*cos(double(i)*da), R*sin(double(i)*da));
p.push_back(tmp_p);
}
return p;
}
Polygon_2 doEllipse(double Rx, double Ry, unsigned short k)
{
Point_2 tmp_p;
Polygon_2 p;
double da = double(2.0*3.1415926535897932)/double(k);
for (unsigned int i = 0; i < k; i++)
{
tmp_p = Point_2(Rx*cos(double(i)*da), Ry*sin(double(i)*da));
p.push_back(tmp_p);
}
return p;
}
Polygon_2 doSquare(double cc)
{
Point_2 tmp_p;
Polygon_2 p;
double c = cc/2.0;
p.push_back(Point_2( c, c));
p.push_back(Point_2(-c, c));
p.push_back(Point_2(-c, -c));
p.push_back(Point_2( c, -c));
return p;
}
And to join my polygon I do :
Polygon_set_2 S;
Polygon_2 Circ = doCircle(6.0, 10);
Polygon_2 Squa = doSquare(10.0);
Polygon_2 Elli = doEllipse(1.0, 10.0, 48);
S.insert (Circ);
S.join (Squa);
S.join (Elli);
I don't know if my method is a good solution but I don't not how do otherwise.
And to draw it I do :
glBegin(GL_TRIANGLE_STRIP);
for (it_vrtx it = arr.vertices_begin(); it != arr.vertices_end(); it++)
glVertex3d(it->point().x(), it->point().y(), 0.0);
glEnd();
I have a Bad renderer because I can't get faces I try to se in
http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Partition_2/Chapter_main.html
but I not understand how I can do it.
And for my others part I don't know how I can do it like :
extrusion and cutting my polygon extruded.
Thank you for you future answer
PS : sorry for my bad english (I'm frensh speaker)
--
- [cgal-discuss] Many question about polygon_2 and polyhedron_3, skhiat, 01/22/2009
Archive powered by MHonArc 2.6.16.