Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8122785

Document importance of TriangleMesh order of elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx

      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

            ckyang Chien Yang (Inactive)
            josmithjfx John Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: