Do you know of any, actively developed, C/C++ library that can take a bunch (preferably a large amount) of 4D vertices, project them back into 3D space with respect to some arbitrary "4D camera" projection matrix and output regular 3D vertices that I could feed into OpenGL for hardware accelerated visualisation? I'd also need the ability to perform standard transformations in 4D space (translation, rotation along all 4 axes and uniform scaling).
-
4Sounds like you would need quintonions to implement rotations ;-) (Nice question!) – Kerrek SB Aug 08 '11 at 21:18
-
1I just have to ask: what are you using this for? – Beta Aug 08 '11 at 22:02
-
Isn't the basic problem here, that they way you project 4D shapes into 3D space rather arbitrary? Like, there is no standard way of doing so, ergo there is no standard library implementation to do so? – J T Aug 08 '11 at 22:06
-
@JT: What do you mean? 3D perspective projection onto a 2D plane is well established, isn't projecting from 4D into a 3D space just an extension to that? Please forgive my ignorance if I'm wrong. :) – MasterM Aug 08 '11 at 22:11
-
@Beta: I'm thinking about writing an indie game that would employ 4D space in spatial puzzles. – MasterM Aug 08 '11 at 22:15
-
i don't understand why you would want to make 4d object then convert it to 3d, when its easier to make it 3d and have it originally you had. Pardon me if I am wrong. – Grigor Aug 08 '11 at 22:21
-
1And all this while, I thought the 4th dimension was time... – Brad Aug 08 '11 at 22:22
-
2The idea is definitely cool, and I hope you succeed! Please note that the "quintonions" were a joke, there's no such thing. It's a happy accident that the Euclidean group of R^3 (which can be realized as the the group of rotations in R^4) is equivalent to the multiplicative group of unit quaternions. This doesn't happen in most other dimensions, and you just have to use standard linear algebra. – Kerrek SB Aug 08 '11 at 22:23
-
Mathematically it is just an extension. But there is a difference of perception. You have a concept of 3D and can reconstruct it from a 2D projection. When you project 4D in 3D you have no natural notion about "how it should look" and cannot reconstruct anything. Thus you have no natural projection from 4D into 3D. But maybe I'm wrong and there is some very cool way to do it :) – pmr Aug 08 '11 at 22:23
-
Maybe you should ask Marc Ten Bosch what he did for [Miegakure](http://marctenbosch.com/miegakure/)? – Adam Rosenfield Aug 08 '11 at 22:28
-
@Kerrek: Although quintonions are fictional, there _is_ a group called the [octonions](http://en.wikipedia.org/wiki/Octonion) (though they do not correspond to a rotation group, as far as I'm aware). – Adam Rosenfield Aug 08 '11 at 22:31
-
@Kerrek SB: I got that. :) Thanks! – MasterM Aug 08 '11 at 22:32
-
@pmr: I was thinking about using 3D corridors submerged and folded in 4D space. That way there's no problem with perception because player thinks he's in regular 3D space while moving in all 4 dimensions without realising it (just like a 2D ant walking on a 2D ribbon folded in 3D space). – MasterM Aug 08 '11 at 22:34
-
@Adam: Octonions are also an algebra, like the quaternions, so there's a group of units, which acts as symmetries of 8-dimensional space. There are a couple of other symmetry groups related to octonions, but they're all in higher dimensions. – Kerrek SB Aug 08 '11 at 22:37
-
@pmr: You cannot reconstruct 3D from *one* 2D projection, but you can from *two* projections. Similarly you can reconstruct 4D from two 3D projections... – Kerrek SB Aug 08 '11 at 22:38
-
@Kerrek By reconstruct I meant "a human can imagine the 3D world" not the mathematical sense. Should have been clearer. – pmr Aug 08 '11 at 22:41
-
There are other possibilities. A plain corridor is 1D. If it branches normally it's embedded in a 2D space. If it also branches up and down, it's embedded in 3D. If also branches in *the other two directions*, then you might not see those, not until you hit the button that rotates around an axis not in 3-space, and then you'd see... – Beta Aug 09 '11 at 00:33
-
take a look at this [how should i handle morphing objects in opengl?](https://stackoverflow.com/a/44970550/2521214) – Spektre Jul 09 '17 at 09:29
2 Answers
The following is a poor answer (since I am by no means an expert on the topic), but I decided to take a quick peek around and came up with this thesis: http://steve.hollasch.net/thesis/#chapter4
Projection of a 4D object into 3-space is, as you would expect, a simple extension on the projection of 3D into 2-space, and the above thesis demonstrates different kinds of projection from 4D to 2-space. The code samples are in C, so it should be easy to follow.

- 24,948
- 7
- 64
- 80
-
Thank you. I stumbled upon one or two similar papers and one very outdated library for projecting 4D vertices into 3D space but I was hoping for an actively developed project. So for now I'm going to leave this question opened. If I don't find one I'll roll my own. – MasterM Aug 08 '11 at 22:40
-
2@MasterM: If you do come up with something, please do post what you learn (or perhaps what you do!) as an answer. I'd love to see what you come up with. – greyfade Aug 08 '11 at 22:42
-
@MasterM, enthusiastic second to greyfade's request. This question is definitely a new favorite. Consider stereograms as a way of enhancing the 3d sense. – luser droog Aug 10 '11 at 03:56
-
1The link in this answer is dead, but the chapter can still be accessed via this link: http://steve.hollasch.net/thesis/#chapter4 – user234461 Mar 28 '16 at 09:14
-
Professor Andrew Hanson (Indiana University) developed a graphics library for visualizing 4D geometry. It's called GL4D. It's designed to mimic the feel of OpenGL (though I'm not sure whether it is actually built on top of OpenGL). It is GPU-accelerated. It supports projection, slicing, hidden-surface removal, per-voxel lighting, and semi-transparent shading.
Here's the publication which explains GL4D: GL4D paper
Here's a link to the source code: GL4D Source Code
And here's a video demonstration of GL4D: GL4D Video Demonstration

- 1,881
- 4
- 20
- 40