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: Raman Gupta
Subject: Re: [Nel] How to use NLMISC::CPolygon::toConvexPolygons function
Date: Fri, 12 Dec 2003 04:13:06 -0800 (PST)

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
reply via email to

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