Reputation: 1419
Is there a way to create a cube in 2d? as in what a 3d cube would look like from any angle? Basically something like this, basically three quadrilaterals that combined look like a cube.
I would like to generate random cubes, so whatever formula would need to allow for variations
Upvotes: 0
Views: 2743
Reputation: 105035
You can learn the transformation algorithms in this neat little 2d-->3d library called pre3D.
It probably offers more features than you need, but it’s only 36k, and you could always cut out the features you don’t need for an even smaller download size.
You can see the demo here (including an animating 2d-->3d box): http://deanm.github.com/pre3d/monster.html
You can get the code here: https://github.com/deanm/pre3d
Upvotes: 1