4th Demension...

Started by
16 comments, last by DarkHunter 22 years, 5 months ago
Umm, ok i am pretty new to openGL, but not that new. I am going to write a program for my math class, showing a cube rotating in the 4th demension. If you can see this, its 2 cubes, one bigger then the other, and the inside one is getting bigger, and the outside one is getting smaller, then it goes back and forth like that. I know rotation, but making them boxes is just alittle problum... maybe its just me, and im dumb, but how do i draw like a BOX!!! and second, how would i get these 2 boxes to invert like how i described?!! Please help! slim475@hotmail.com is my email, if you wanna help. I wil check the board in a few days. Peace
Advertisement
one more thing, when i said draw a box, i ment like lines, not like a side. i can easily open .bmp pictures, but i wanted just the lines. O ya, and i need the boxes to be connected by skew vertex (or parallel, if you like that name better)

i hope you can understand
head over to NeHe''s Tutorials. They''ll get you on the right track.

Scott


------------------------------------------------------------
Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."
------------------------------------------------------------
quote:Original post by DarkHunter
...showing a cube rotating in the 4th demension.

Just thought you might like to know that the proper mathematical name for what you describe is tesseract or hypercube (it is to a [3D] cube as a cube is to a square; there are also actually 8 cubes involved. There is an open source OpenGL-based screensaver that implements this for Linux. You could take a look at the sources to see how it was implemented; it''s by Jamie Zawinski, for the xscreensaver framework. (There''s screenshots on the site)


I wanna work for Microsoft!
I know its hyper cube. I wasn''t sure if anybody else would know what i ment. Look, i have looked At the guides, but nothing on the site can help me with the 4th deminsion.

i will check the screen saver thing, thanks!
Maybe what you want is a projection matrix? OpenGL won''t render things in 4D too well, but if you take some 4-D coords and project them down to 3-space, and then of course to the 2-space of your monitor, you should get the same effect. A simple way to do this might be to use the weighting factor that OpenGL uses in all it''s vertices. Do like so:
glFloat v1[] = { -1, -1, -1, -1 };
glFloat v2[] = { 1, -1, -1, -1};
glFloat v3[] = { -1, 1, -1, -1};
glFloat v4[] = { 1, 1, -1, -1};
...

Then, you can use the glVertex4f command, like so:
glVertex4fv(v1);
glVertex4fv(v2);
...

This might actually not work, since the opengl 4th coord is not really seen as being a spatial coordinate but a weighting factor. A more accurate way to do this is to make your own projection matrix and run all the 4D verts through that. I think that to do this, you need to figure out what solid you wish your hypercube to be projected onto, and then make a 5x5 projection matrix that will map the 4-space vectors, plus a weighting factor, to that solid. If you want more help, I can try to make the matrix, but it might be a fun excersize for you
quote:Original post by tsuraan
...OpenGL won''t render things in 4D too well...



The 4th dimension is purely theoretical; some consider it in physical terms as a 4th spatial dimension, while others consider it to be temporal. In other words, nothing will render 4D things well.

The hypercube is a projection of the unfolded 4D figure into 3D space. In other words, he''s performing normal 3d operations.
Here is what i define and my teacher defines as a hypercube:

Just image a square: 4 lines, each line touches 2 other lines
im sure you can still see this
Now a cube: 6 square, each square touches 4 other squares
still following?
Now a hypercube: 8 cubes, each cube touches 6 other cubes
say what?!
try drawing that out!
I''ve seen a line based "3d" hypercube before, doing only line art, I think i''ve seen what your talking about before on the web, either as a java app or a animated gif. The best way i can describe the motion is 2 cubes, one inside the other in all (3) dimensions, and the cubes are connected by lines at the corners. So the front left corner of the inner box is connected to the front left corner of the outer box. Then the inside rolls/evolves so the inside is now the outside, and so on.
As far as setting up the polygons, that''s a little bit beyond me, but this site may or may not shine some lit on it, throug you''ve probably allready seen this information in class.
http://members.tripod.de/jkoeller/hypercube.htm
along with a site with lots of links
http://www.cs.mu.oz.au/~amb/4d/
A 3d movie of a hypercube/dice compard to a regular dice
http://www.cica.indiana.edu/projects/4Dice/movies.html
If this is your first forray into 3D at all I really really Don''t recommend tackling this now, it is tough to get a good understanding of 3D, never mind animating 3D perspectives of 4D objects.
If you do have time, the best way to go about this is to know the language you intend to do this is, OpenGL so c++, now the OS win/mac/linux, setup simple 3D box that you can rotate and understand what is happening, the elaborate the model to either fake a hypercube or actually model a hypercube and do what tsuraan suggested and pass the 4d cords through a projection matrix so give you 3d cords, (which then get passed to opengl which then converts them to 2d cords to be displayed)
if new to windows
http://www.gamedev.net/reference/programming/features/gpgenesis1/
if new to opengl
http://nehe.gamedev.net
if new to 3d
http://www.gamedev.net/hosted/3dgraphics/

Hope this helps, or at least gives you an idea of what your doing. I''m sorry if you know this stuff, i wasn''t quite sure what your proficiany with any of this is.
-Scott
Ok, now i have a new question for you guys. Should i make 8 seprate cubes, OR make the 2 and connect the vetexs and have it constintally moving. At any rate, i hope sombody thinks of it fo me, i will be checking in 2morrow. Thanks for your help tho, i have gotten a new start, and it should be completeted by next weekend (if i work like an hour a day)

Just so you all know, i am a 10th grader and am looking into a career in software engineering.

peace

KISS

(keep it simple stupid)

This topic is closed to new replies.

Advertisement