DGtal-team / DGtal

Digital Geometry Tools and Algorithm Library
https://dgtal.org
GNU Lesser General Public License v3.0
370 stars 115 forks source link

Wrong order of quad when export Obj voxel #988

Closed kerautret closed 9 years ago

kerautret commented 9 years ago

For instance:

aBoard << SetMode3D("PointVector", "Paving"); aBoard << Point(0,0,0); aBoard.saveOBJ("test.obj");

produce:

OBJ format

/# generated from Board3D from the DGTal library mtllib test.mtl

o 0 usemtl Mat_0 v -0.5 -0.5 0.5 v 0.5 -0.5 0.5 v -0.5 -0.5 -0.5 v 0.5 -0.5 -0.5 v -0.5 0.5 0.5 v 0.5 0.5 0.5 v -0.5 0.5 -0.5 v 0.5 0.5 -0.5 vn -1 0 0 vn 0 0 -1 vn 0 1 0 vn 0 0 1 vn 0 -1 0 vn 1 0 0 f -8//-6 -7//-6 -5//-6 -6//-6 f -8//-5 -6//-5 -2//-5 -4//-5 f -8//-4 -7//-4 -3//-4 -4//-4 f -7//-3 -5//-3 -1//-3 -3//-3 f -6//-2 -5//-2 -1//-2 -2//-2 f -4//-1 -3//-1 -1//-1 -2//-1

dcoeurjo commented 9 years ago

what do you mean by "order" ?

kerautret commented 9 years ago

the order in the sequence of vertices

dcoeurjo commented 9 years ago

what do you mean ? wrong convention ? (cw,ccw w.r.t. exterior normal) ?

kerautret commented 9 years ago

neither ccw or not, just the order itself : with normal order: x1,x2,x3, x4 if i am not wrong it was in other order like x1 x2 x4 x3,

kerautret commented 9 years ago

and perhaps in ccw instead cw since depending of the normal estimation it could be not visible

dcoeurjo commented 9 years ago

strange because x1 x2 x4 x3 would produce a kind of "butterfly" in the OBJ viewers and I never saw that (blender, meshlab...)

kerautret commented 9 years ago

for meshlab I saw that it converts a quad into two triangles and the normal vector can also be fine if the order x1 x2 x4 is ok or double sided rendering.

dcoeurjo commented 9 years ago

can you please check this issue together with PR #1022 ?

kerautret commented 9 years ago

yes of course I will do it sorry for the delay ;)

kerautret commented 9 years ago

looks fine now, thanks, by the way I see some other pb on test of dgtalBoard3D-line with line but not related to this issue/PR so I merge ;)

kerautret commented 9 years ago

closing fixed in PR #1022