|
From: | lionel berenguier |
Subject: | Re: [Nel] How to use NLMISC::CPolygon::toConvexPolygons function |
Date: | Tue, 16 Dec 2003 14:23:33 +0100 |
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.
|
[Prev in Thread] | Current Thread | [Next in Thread] |