IndexedFaceSet renders oddly

Have jReality programming problems or questions? Post them here.
Post Reply
kmacc
Posts: 2
Joined: Wed 23. Mar 2016, 16:46

IndexedFaceSet renders oddly

Post by kmacc » Wed 23. Mar 2016, 17:00

I'm using jReality in a project of mine and I'm having some trouble with an IndexedFaceSet. My intent in this instance is to make a single face and then thicken it. I find a strange issue when I make the face.

I've attached a screenshot. That polygon face is only supposed to fill in the pink edges of the polygon but instead I get this spurious filling outside the edges.
strange_polygon.png
strange_polygon.png (2.2 KiB) Viewed 276 times
I've tried doing it two ways and get the same results. The commented section is the way I first tried, then I used the construct polygon method.

// ifsf.setFaceCount(1);
// ifsf.setVertexCount(n);
// ifsf.setVertexCoordinates(verteces);
// ifsf.setFaceIndices(faceIndices);
// ifsf.setFaceNormals(new double[][] {{0,0,1}});
// ifsf.setGenerateVertexNormals(true);
// ifsf.setGenerateEdgesFromFaces(true);
// ifsf.update();
// IndexedFaceSet ifs = ifsf.getIndexedFaceSet();

IndexedFaceSet ifs = IndexedFaceSetUtility.constructPolygon(verteces);

In this particular case, verteces is the following array:

[[0.0, 0.0, 0.0], [0.0, 0.00292931999999999, 0.0], [-0.01841369, 0.00292931999999999, 0.0], [-0.01841369, 0.00878817000000001, 0.0], [-0.00425223200000001, 0.00878817000000001, 0.0], [0.00122842299999999, 0.00718154999999999, 0.0], [0.006047618, 0.00292931999999999, 0.0], [0.006047618, 0.0, 0.0]]

Can anybody tell me what I'm doing wrong?

Thanks,

Kenneth.

Post Reply