I am not using STLPort stuff,as it is giving a lots of problems to me.I have commented or modified function which use STLPort.I have totally commented all serial functions also.Could this be the reason of not getting correct results.
I don't know where is your problem, since It seems to work with your data.
This is my code::
{
CMatrix m1;
CPolygon poly1;
poly1.Vertices.push_back(CVector(0,8,0));
poly1.Vertices.push_back(CVector(0,0,0));
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));
list<CPolygon> convexPolygons;
nlinfo("%d", (uint)poly1.toConvexPolygons(convexPolygons,m1));
nlinfo("");
for(list<CPolygon>::iterator i = convexPolygons.begin() ; i != convexPolygons.end(); ++i)
{
vector<CVector> t1 = i->Vertices;
for(int j = 0;j<t1.size();++j)
nlinfo("%f,%f,%f", t1[j].x, t1[j].y, t1[j].z);
nlinfo("");
}
}
And this is my result:
R:\code\test\test_3dyoyo\main.cpp(1551) : INF 1860: 1
R:\code\test\test_3dyoyo\main.cpp(1553) : INF 1860:
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 4.000000,4.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 4.000000,8.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 0.000000,8.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 0.000000,0.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1561) : INF 1860:
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 8.000000,4.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 4.000000,4.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 0.000000,0.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 12.000000,0.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1561) : INF 1860:
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860:
12.000000,0.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 12.000000,8.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 8.000000,8.000000,0.000000
R:\code\test\test_3dyoyo\main.cpp(1560) : INF 1860: 8.000000,4.000000,0.000000
which sounds good to me.
Lionel.
----- Original Message -----
Sent: Saturday, December 13, 2003 6:06 AM
Subject: Re: [Nel] How to use NLMISC::CPolygon::toConvexPolygons function
Hi
I have tried making last point != first point also but its not giving results.Input is --
0,8,0
0,0,0
12,0,0
12,8,0
8,8,0
8,4,0
4,4,0
4,8,0
Polygon is like --
_____ ________
| | | | (for input last point != first point)
| | | |
| |_____| |
| |
|__________________|
Output is a list of 3 plygons--
4,4,0
4,8,0
0,8,0
0,0,0
12,8,0
8,8,0
8,4,0
12,0,0
12,8,0
8,4,0
The function -- Poly1.toConvexPolygons(convexPolygons,m1) is also returning 0(false).Please help.
Raman Gupta
_______________________________________________
Nel mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/nel-all