The order of definition of points in a TriangleMesh (clockwise or counter-clockwise) seems to be important and the TriangleMesh Javadoc could be updated to explain the importance.
I believe this is to do with the notion of front and back sides to a triangle.
For instance, when used in the statement, mesh.getFaces().setAll(faces), the faces array:
int[] faces = {
2, 2, 1, 1, 0, 0,
2, 2, 3, 3, 1, 1
};
is not the same as the array:
int[] faces = {
2, 2, 0, 0, 1, 1,
2, 2, 1, 1, 3, 3
};
Even though the arrays seem to be defining the same triangles.
I believe this is because: The direction in which the face is defined is important. The first face array sample defines points 2, 1, 0 (i.e. the triangle is defined in a counter-clockwise order). The second face array sample defines points 2, 0, 1 (clockwise). In an initial untransformed orientation, a face which is defined in a clockwise manner faces away from the viewer. A face which is defined in a counter-clockwise manner faces toward the viewer.
See related StackOverflow question:
http://stackoverflow.com/questions/19960368/how-to-make-sense-of-javafx-triangle-mesh
I believe this is to do with the notion of front and back sides to a triangle.
For instance, when used in the statement, mesh.getFaces().setAll(faces), the faces array:
int[] faces = {
2, 2, 1, 1, 0, 0,
2, 2, 3, 3, 1, 1
};
is not the same as the array:
int[] faces = {
2, 2, 0, 0, 1, 1,
2, 2, 1, 1, 3, 3
};
Even though the arrays seem to be defining the same triangles.
I believe this is because: The direction in which the face is defined is important. The first face array sample defines points 2, 1, 0 (i.e. the triangle is defined in a counter-clockwise order). The second face array sample defines points 2, 0, 1 (clockwise). In an initial untransformed orientation, a face which is defined in a clockwise manner faces away from the viewer. A face which is defined in a counter-clockwise manner faces toward the viewer.
See related StackOverflow question:
http://stackoverflow.com/questions/19960368/how-to-make-sense-of-javafx-triangle-mesh
- blocks
-
JDK-8101810 Finish javadoc for FX 8 3D API
- Resolved