Creating a spiral shape from 3d cubes - javafx

301 views Asked by At

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?

1

There are 1 answers

1
mipa On

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.