0

I am a lot of confused about how i create a complex 3d model in javafx. More specifically, I want create a spiral or helix which is a group of many cubes.

I have the mathematical type to create my points for the mesh:

for (int i = 0; i < 20; i++) {
        v1=Math.sin(pi*i*0.125)*150;
        v2=i*50;
        v3=Math.cos(pi*i*0.125)*150;           
        mesh.getPoints().addAll((float)v1,(float) v2,(float) v3); 
        mesh.getPoints().addAll((float)v1,(float) v2,(float) - v3);
        mesh.getPoints().addAll((float)v1,(float) -v2,(float) v3);
        mesh.getPoints().addAll((float)v1,(float) -v2,(float)- v3);

        mesh.getPoints().addAll((float)-v1,(float) v2,(float) v3);
        mesh.getPoints().addAll((float)-v1,(float) v2,(float) -v3);
        mesh.getPoints().addAll((float)-v1,(float) -v2,(float) v3);
        mesh.getPoints().addAll((float)-v1,(float) -v2,(float) -v3);

    }

But when i try to write the faces , output is awful. How faces must be written?

dimitrager
  • 11
  • 2

1 Answers1

0

What you have shown are just the points. What about the faces? Have a look here: https://github.com/FXyz/FXyz This may help to get you going.

mipa
  • 10,369
  • 2
  • 16
  • 35
  • FXyz is a very good and helpful guide.. I found a lot of information! Thank you! But what i need to do in general for my application, is to create custom 3d shapes. So I decided to create a java class for each user-defined shape. Correct me if I am wrong. – dimitrager Sep 18 '17 at 10:53