Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58430 Members - Latest Member: Jesse Webb

April 27, 2024, 05:00:13 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Visualizing 4-dimensional objects?
Pages: [1]
Print
Author Topic: Visualizing 4-dimensional objects?  (Read 2266 times)
nayon
Level 5
*****


dickfish


View Profile
« on: February 02, 2009, 11:37:22 AM »

I know it can be done, ( http://www.superliminal.com/cube/cube.htm ), but I wonder how can one project a 4d object onto a 2d plane, code-wise. Anyone got any ideas?
Logged

Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #1 on: February 02, 2009, 11:39:22 AM »

There's Hypercubes:

http://en.wikipedia.org/wiki/Hypercube
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #2 on: February 02, 2009, 11:40:16 AM »

I have some old code lying around that I should be able to dig up. Basically, I just projected all the vertices through a point onto a hyperplane and then rendered the new 3D objects with openGL. There exists a notebook that contains all the math for the projection, but I don't have access to it at the moment.

My code uses a modifying version of the .obj file format with tetrahedrons instead of triangles. It's also very messy.

I'll attach the code when I get back.

Here it is.
« Last Edit: February 02, 2009, 01:01:22 PM by Gold Cray » Logged
Chris Whitman
Sepia Toned
Level 10
*****


A master of karate and friendship for everyone.


View Profile
« Reply #3 on: February 02, 2009, 11:45:41 AM »

The simplest way would just be an orthogonal projection. Pick two orthonormal basis vectors from your four dimensional space to span your plane, and get the projected coordinates of any point by doing a regular ol' vector projection.

I.e., you could let {u=(1,0,0,0),v=(0,1,0,0)} be your two basis vectors and then calculate the projection of any point w onto a point w' in your subspace with w'=(w.u)u+(w.v)v

Your basis for the subspace doesn't actually have to be orthonormal, but it's easier if it is, obviously. Also, this might not actually be particularly exciting.
Logged

Formerly "I Like Cake."
Chris Whitman
Sepia Toned
Level 10
*****


A master of karate and friendship for everyone.


View Profile
« Reply #4 on: February 02, 2009, 11:48:35 AM »

Yeah, if you want perspective 3D you could just compose an orthogonal projection into a three dimensional subspace of your four dimensional space with a perspective projection into a plane. That might be a little more interesting.
Logged

Formerly "I Like Cake."
nayon
Level 5
*****


dickfish


View Profile
« Reply #5 on: February 02, 2009, 11:50:44 AM »

Hmm... It would probably look like a huge meaningless mindfuck though, amirite?

Also, to apply transformations and other stuff using linear matrices, one would require a 5th coordinate, which would probably make this generally super inefficient.
Logged

Chris Whitman
Sepia Toned
Level 10
*****


A master of karate and friendship for everyone.


View Profile
« Reply #6 on: February 02, 2009, 11:58:10 AM »

Yeah, affine mappings on a four dimensional space will require 5x5 matrices, but I don't expect under reasonable circumstances that will be particularly taxing for a modern computer. I mean, if you're planning to project thousands of polygons entirely in software it might not be particularly fast, but it's just multiplying and adding.

Whether it looks totally meaningless or not depends a lot on what you're working with. Obviously doing this with a hypercube looks pretty reasonable, and if you 'skin' the four dimensional geometry with some sense-making 3D stuff like the way they do it in the animation (by connecting the points with cylinders in your 3D subspace, for example) it is reasonably intelligible.

Edit: I mean, you could probably do something really neat by making some gross geometric features in 4D, projecting them and then just doing regular 3D stuff using the projected points.
Logged

Formerly "I Like Cake."
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #7 on: February 02, 2009, 12:12:43 PM »

This is a nice article, though it probably doesn't answer your question directly, you might get some ideas from it.
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #8 on: February 02, 2009, 01:05:56 PM »

From the brief time I spent playing around with it, I think that given control of rotation and position, even just a plain 3d project of a 4d shape can be perfectly intuitive. There is certainly potential for a sort of "puzzle" fps.
Logged
Anthony Flack
Level 5
*****



View Profile WWW
« Reply #9 on: February 02, 2009, 05:44:46 PM »

I'd like to see what it looked like to have a 4d object rotating in 3d space (as opposed to 2d space on a monitor screen; some kind of 3d projection).
Logged

Currently in development: Cletus Clay
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #10 on: February 03, 2009, 02:00:59 PM »

I just did a quick search and and found this. They've got both a hypercube simulation and a 4D game.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic