4D Tesseracts and more!

Hi,

I am new to processing, but I am beginning to understand how it works and appreciate the power of what can be done with it! I have seen a few examples of tesseracts being drawn in Processing and would like to create some variation of my own (to start with - I would like this to culminate in some sort of 4th dimension architecture project!) One of the best I have seen (even though it's 4D) is using an old version of processing here

I am struggling to work out where to start with this and would really appreciate any help that you guys could give me!

Thanks

Answers

  • how are you at 2d rotation matrices? 3d rotation matrices?

    because 4d is just one more than 3d.

    ditto with the geometry. 2d is a square, 4 points each connected to 2 others. number them, see if you can spot a pattern.

    do the same with a cube. 8 points each connected to 3 others.

    extrapolate the pattern to 4d (twice as many points, one more connection)

    you'll need a class that holds a 4d coordinate, not just x, y, z, you can't use PVector.

    and a 4d rotation matrix.

    and a 4d to 2d perspective transform.

    (i still have the code for the above and it runs fine in p3 but the scale() now scales the line thickness as well as the position. so you need to set the strokeWidth to .1 or so. (it also omits the 4d rotation matrix, goes straight to 5d.))

  • Well, you could keep a list of 4D vertices, then projecting them into 3D space based on your W axis orientation / position).

    So, for example, a class PShape4D would keep an ArrayList 4d points, and display() would return a different PShape (3D) based on the current state of W. You could try starting with a simple tesseract, a fixed camera, and W-up / W-down keys.

    Once you want to head towards explorable architecture, one approach is to use PeasyCam for 3D, then add "W up/down" keys that shift you along the W axis.

    Adonaxis was an interesting (non-Processing) implementation of this kind of 4D free rotating camera environment..

  • Woohoo, thanks for this koogs, it is exactly the starter I need!

    I understand rotations, I think I need to get my head around the class issue and then hopefully I will get somewhere.

    jeremydouglas, this is also great and just the primer I need to take this further. I am aware of adanaxis, and eventually I would like to achieve something like this I think.

    Thanks again for all the help and watch this space!

  • edited November 2016

    I'm looking forward to it, @consumerismkid

    One thing to keep in mind in terms of projection -- if you create basic 4D objects that work based on projection (their displays return standard Processing 3D objects) then you won't have to rewrite all of Processing in 4D -- you'll still be able to use all the display library.

    That said, as soon as you allow YW rotation, projection is going to get complex. For the tesseract demo, one approach is for you to render eight transparent solids / wireframes, each of which is a truncated pyramid / square frustum. Occasionally some of these will be cubes. You may want to package each of the eight solids as a child shape within the main PShape object that you return. Like box(), your Tesseract class could take dimensions, then display() based on the current state 4d orientation.

Sign In or Register to comment.