nel-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nel] How to use NLMISC::CPolygon::toConvexPolygons function


From: lionel berenguier
Subject: Re: [Nel] How to use NLMISC::CPolygon::toConvexPolygons function
Date: Fri, 12 Dec 2003 14:07:29 +0100

Your problem is that you MUST NOT not close your polygon with the first vertex (12,0,0). Define your poly as
 
12,0,0
12,8,0
8,8,0
8,4,0
4,4,0
4,8,0
0,8,0
0,0,0
 
(Trianle==3 vertices, not 4)
 
Lionel
----- Original Message -----
Sent: Friday, December 12, 2003 1:13 PM
Subject: Re: [Nel] How to use NLMISC::CPolygon::toConvexPolygons function

Hi
My concave polygon is
12,0,0
12,8,0
8,8,0
8,4,0
4,4,0
4,8,0
0,8,0
0,0,0
12,0,0
 
and the  result in list<CPolygon> convexPolygons , i.e list of convex polygons into which original polygon is broken , that i am getting is --
12,8,0
8,8,0
8,4,0 
 
4,4,0
4,8,0
0,8,0
0,0,0
which are not suitable. Please kindly tell how to get proper results.This is what i am doing :--
 
void main()
{

CMatrix m1;

CPolygon poly1;

poly1.Vertices.push_back(CVector(12,0,0));

poly1.Vertices.push_back(CVector(12,8,0));

poly1.Vertices.push_back(CVector(8,8,0));

poly1.Vertices.push_back(CVector(8,4,0));

poly1.Vertices.push_back(CVector(4,4,0));

poly1.Vertices.push_back(CVector(4,8,0));

poly1.Vertices.push_back(CVector(0,8,0));

poly1.Vertices.push_back(CVector(0,0,0));

poly1.Vertices.push_back(CVector(12,0,0));

list<CPolygon> convexPolygons;

poly1.toConvexPolygons(convexPolygons,m1)<<endl;

for(list<CPolygon>::iterator i = convexPolygons.begin() ; i != convexPolygons.end(); ++i){

vector<CVector> t1 = i->Vertices;

for(int j = 0;j<t1.size();++j)

           cout<<t1[j].x<<','<<t1[j].y<<','<<t1[j].z<<endl;

cout<<endl;

}

}




Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing


_______________________________________________
Nel mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/nel-all

reply via email to

[Prev in Thread] Current Thread [Next in Thread]