Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Displaying a 2D net of a 3D cube

This thread is locked; no one can reply to it. rss feed Print
Displaying a 2D net of a 3D cube
Scooter
Member #16,799
January 2018

Hi all:
I need some advice on folding a cube net into a 3D cube.
I have the net for the cube posted above. What I have a problem
with is how do I convert the 2D net into a 3D cube. Somehow I
have to have the Z coordinate for the 3D cube.
My intention is to have each side fold up in 1 degree increments.
Don't know whether I can do it but I would like some info on
how it would be done. Thanks for your time on this matter.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Scooter
Member #16,799
January 2018

Thanks Edgar!
I started this project using trig and ended up with a gosh awful mess. Since I
had the cube built, I tried to unfold it first. I got something on the screen, but
not what I wanted. Trying to unfold and fold with the cube rotating seems impossible.
I will keep at it.
Thanks again and Merry Christmas to everyone!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Scooter said:

Trying to unfold and fold with the cube rotating seems impossible.

You'll want to multiply transforms. Multiply the rotation transform with your folding transform.

Remember, you don't have a cube, you have six 3D squares, each with their own folding (rotation, translation, etc...).

3D trig can be really hard. Use a series of 2D transformations around an axis to keep it simpler. The result will be the same.

Also, keep it simple. Try to fold a single square to begin with. Make it rotate around one of its edges. That is essentially what folding is.

Go to: