Jump to content
  • Advertisement
Sign in to follow this  

Maya Tesseract

This topic is 4392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am attempting to model a rotating hypercube in maya. Essentially, I want to duplicate what was done to create this image: [edit: image was deleted by host, use this link instead] I have already worked out an algorithm on paper that can compute the final position of a corner vertex given the frame number and the original vertex location (which must be a 4 component vector). The problem is that I do not have a lot of maya background, and therefore don't know how to apply this algorithm. How can I implement this algorithm as an input to vertices in my model? Psuedocode:
inputs: frame_number, x, y, z, w
outputs: x', y', z'

num_frames = 24
angle = 2 * pi * frame_number / num_frames

a = x * cos(angle) - w * sin(angle)
d = x * sin(angle) + w * cos(angle)

x' = a / d
y' = y / d
z' = z / d

[Edited by - 0xCHAOS on December 3, 2006 12:59:13 AM]

Share this post

Link to post
Share on other sites
Well the image that you posted doesn't seem to be active, but I'll give it a shot.
This is what I would do in order to control the vertices of an object in the way that you describe:

Create a cluster for each of the cube vertices, so that now the vertices are controlled by the clusters (you can do that by selecting each vertex and then going Deform > Create Cluster). And then assign an expression to drive the translation of each of the clusters (to do this, just go to the translateX atrribute in the channel box, right click and hit Expressions).

But what does the 4th component of the vector stand for?
If I understand how your algorithm works then I can help you write the expression.

Share this post

Link to post
Share on other sites
The image got removed from wikipedia, I guess... here is another link to it:

The idea is to display a geometric solid called a hypercube, or tesseract (a cube extended to 4 dimensions) projected onto 3D space while rotating. Just like 3D objects can be projected onto a 2D plane, 4D objects can be projected onto a 3D plane.

In 4D space, a hypercube has 16 verticees. Assuming an edge length of 2, a hypercube centered at the origin would have verticees at:

< x y z w>
< 1, 1, 1, 1>
< 1, 1, 1, -1>
< 1, 1, -1, 1>
< 1, 1, -1, -1>
< 1, -1, 1, 1>
< 1, -1, 1, -1>
< 1, -1, -1, 1>
< 1, -1, -1, -1>
<-1, 1, 1, 1>
<-1, 1, 1, -1>
<-1, 1, -1, 1>
<-1, 1, -1, -1>
<-1, -1, 1, 1>
<-1, -1, 1, -1>
<-1, -1, -1, 1>
<-1, -1, -1, -1>

A simple way to project from 3D to 2D is to divide both x and y by the z component. Similarly, a simple way to project from 4D to 3D is to divide x, y, and z by the w component. Before we can do this, we must perform our time based rotation in 4D space, and then translate the cube so that it exists completely in the positive w half space (or the projection will cause inversion and potentially divide by zero errors).

In 2D space, one rotates about a point. In 3D space, one rotates about a line. In 4D space, one rotates about a plane. All this really means is that whatever the dimensionality of the space, only components along two orthogonal vectors will change during a rotation. For the sake of simplicity I only want to rotate about the y-z plane axis (y and z stay fixed, as x and w change). Hence, to get the new x and w for a vertex based on the angle of rotation, we use some trig:

new_x = x * cos(angle) - w * sin(angle)
new_w = x * sin(angle) + w * cos(angle)

Next, we must translate into the positive w half space. A translation of 3 is probably good.

final_w = new_w + 3

Finally, we must project by dividing x, y, and z by the w component.

x' = new_x / final_w
y' = y / final_w
z' = z / final_w

As the animation progresses, the angle input should vary from 0 to 90 degrees.

Hopefully this more fully explains what I am trying to do. Segmoria, thanks for the input, I will look into using clusters.

Share this post

Link to post
Share on other sites
Thanks again, turns out clusters were exactly what I needed. After researching a bit about mel scripting I was able to make it work. The result:

[Edited by - 0xCHAOS on November 29, 2006 1:46:08 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!