Search code examples
java-3d

Polygon strange behavior


I'm starting my adventure with java3d.

I'm getting unexpected results when creating my own Shape3D. I set geometry with following points (exactly in this order):

1 - (0.0, 0.5, 0.0), 
2 - (0.0, 0.25, 0.4330127018922193), 
3 - (0.0, -0.25, 0.43301270189221935), 
4 - (0.0, -0.5, 0.0), 
5 - (0.411819551773166, -0.25, 0.13380828366490874), 
6 - (0.4118195517731659, 0.25, 0.13380828366490874)

There are more, but it's enough to present the situation. If you draw/imagine it you will have points 1 and 4 in one Y line, and 2,3,5,6 creating a rectangle.

What I need to achieve is to have a plane connecting:

  • Point 1
  • Line from 2 to 6
  • Line from 3 to 5
  • Point 4

I got almost this, it's hard to explain so I'll attach a picture:

full image

As you can see, the plane goes through line connecting 4-2 and 5-2 instead of 5-3.

Anybody have an idea how to fix it? I can provide more code if necessary, but I didn't want to put everything and didn't know which part might interest you.


Solution

  • It's not what I wanted, but I've found a workaround. I put points in following order (numbers taken from question):

    1,2,6,6,2,3,5,5,3,4
    

    And I set stripCounts filled like this:

    3,4,3
    

    It produces more smaller particles but it's working and after additional work can be generic.

    If no better answer appears, I'll accept my own.