Skip to content
Forum Archive

Hypercube (4-D analog of a cube)

76 posts

Zevensoft#
Well, did you know that scientists have found 10 dimensional objects? Basically, they are the smallist objects you can get, called strings (atom > quark > gluon > string). The way they can be explain is, take a line, extend it out into a plane, then wrap it round into a cylinder. Now, that cylinder is made very small, so it looks like a line again, then, extend that into a plane, and wrap it around, and so on. This has been thought to be the basis for all time and space in this universe.
NoSage#
Mathematically, I suppose, there can be an infinite number of dimensions. I found a site a long time ago that had pictures of what a 15th dimensional object looked like. It was just a bunch of lines.
ok I'm done...
Zevensoft#
4D Sphere

Here's the code for a 4D sphere. It's colourcoded, so that values of W from -1 to 1 are parts of the spectrum from red through green to blue. Z is represented by Brightness.

Init:

res=15;pi=acos(-1);fov=120;dst=tan(fov*pi/180/2);wdst=1.5;rxs=pi/100;rys=pi/90;rzs=pi/80;rxys=pi/70;ryzs=pi/60;rxzs=pi/50;n=pow(res,3)
Per Frame:

rx=rx+rxs;ry=ry+rys;rz=rz+rzs;rxy=rxy+rxys;ryz=ryz+ryzs;rxz=rxz+rxzs;
Per Point:

x=cos(i*pi*res*res)*sin(i*pi*res)*sin(i*pi);
y=cos(i*pi*res)*sin(i*pi);
z=sin(i*pi*res*res)*sin(i*pi*res)*sin(i*pi);
w=cos(i*pi);
tx=x*cos(rz)-y*sin(rz);
ty=y*cos(rz)+x*sin(rz);
x=tx*cos(ry)-z*sin(ry);
tz=z*cos(ry)+tx*sin(ry);
z=tz*cos(rx)-ty*sin(rx);
y=ty*cos(rx)+tz*sin(rx);
tx=x*cos(ryz)-w*sin(ryz);
tw=w*cos(ryz)+x*sin(ryz);
w=tw*cos(rxy)-z*sin(rxy);
tz=z*cos(rxy)+tw*sin(rxy);
tw=w*cos(rxz)-y*sin(rxz);
ty=y*cos(rxz)+w*sin(rxz);
x=tx/(tw+wdst);y=ty/(tw+wdst);z=tz/(tw+wdst);
x=x/(z+dst);y=y/(z+dst);
h=(tw);b=z/2+.5;
red=(.5+sin((h+(2/3))*pi)/2)*b;
green=(.5+sin((h)*pi)/2)*b;
blue=(.5+sin((h-(2/3))*pi)/2)*b;
Its best also if you add a Misc->Set render mode and set it to maximum blend with line width of 3.

BTW if you want change res to how many 3D sub-spheres you want (squared equals amount of cirles).
dirkdeftly#
What's the derivation of the hypersphere? It works perfectly, I can see all 8 spheres and their rotation 👍
dirkdeftly#
I just made a stupid...I can see all the SUB-SPHERES and their rotation 😉

WHOAH! I just noticed why my hypercube is all hugified! I was trying to solve the puzzle about the correct shifting factor, and I discovered that I had to shift it on the w-axis by sqrt(8) for it to work properly. Well, I just found out that if I do this:
a=(...)-0.5;
instead of this:
a=(...)*2-1;
(a is the axis, and ... is the tracing content)
I only have to shift w by sqrt(2) - the supposedly correct shifting factor. Then I used this scope:
w1=i*2-1; x1 through z1=0;
and shifted by sqrt(2), and it worked fine.
That means that the ... must equal 2 at the end. That shouldn't be happening! Each equal(a,b) statement only happens once, but it's like they're happening twice - they return 0 or 1, but right now they're either doubling themselves or they're returning 2.
How would that be happening?

The same goes for my 5-d rotation. If it's just a line spanning from -1 to 1, and u, w, and z are all shifted by sqrt(2), the 5-hypersphere that it's rotating in is projected correctly in the window. But I can't fix the 5-hypercube the same way. I'm still trying to find the right scaling factor for it...when I do I'll post it
Montana#
the 4d-sphere, is that a sphere with 8 3d-spheres inside?

and why does it look like a lot of spirals
dirkdeftly#
I don't think you fully understand dimensional geometry yet. First of all, the step up from sphere to hypersphere is the same as from circle to sphere. A sphere is made up of an infinite number of circles, changing in size. A hypersphere is made up of an infinite number of spheres, ranging in size. Of course, we can't render an infinite number of spheres, or circles, so we have to take short cuts. For a sphere all we do is render a line spiraling around in a spherical shape. Then (I think) you render a sphere like this several times, and then stretch it into the fourth dimension (hyper)spherically. This creates the hypersphere Zevensoft made. res controls the number of spheres rendered.

Also, I find for the hypersphere res should be a power of 10 and n should be an exponent of res divided by 10, 100, or 1000 PLUS ONE. The plus one ensures that everything is congruent (which makes it much easier to watch).
UnConeD#
The hypersphere is nice, but it has one flaw: it doesn't describe the surface of the sphere. Using a line to spiral around a spherical surface gives you the shape, but it fails to describe the topology.

A better representation of a sphere is using parallels and *******ns (as in my Groovy Saturn preset). Of course, doing this for a hypersphere would be *very* hard. But it's really the best thing to do.
Just like the hypercube is only complete with all the connecting lines.
dirkdeftly#
UnConeD, I've been reading a book on the subject, and it had the source code for a program (in C) which will supposedly render n-dimensional cubes. I compiled it, the code is fine, it just doesn't work. The rendering part goes something like this:
printf("%f %f \n",x1,y1)
f, x1 and y1 should be the coordinates for the points. The only problem is, it's printing a series of numbers, not positions. I think it has something to do with my using a C++ compiler. Could you help?

If you want I could send you it's code, my code (i had to tweak it a bit to fit my compiler), and the program.
UnConeD#
The line you pasted means:

printf("%f %f \n",x1,y1)

Echo the real numbers 'x1' and 'y1' in the format "%f %f \n" (\n is a linebreak) to the screen.

So it's only outputting 2 coordinates... I assume these are pre-transformed to a 2D projection then?

If you want I could whip up a quick Windows program to draw them through basic GDI commands (ugly but works).

Send it to steven at acko dot net (spam proof 🙂).

(By the way, the book you're reading is that a physical or electronic book? In the second case I wouldn't mind getting a copy...)
dirkdeftly#
No, it's not just outputting 2 coordinates, it's outputting the coordinates for the endpoints of every edge in the object.
And it's supposed to draw the lines...

And the book is a paperback by Clifford A. Pickover (do you suppose he's the same pickover as the one who created the pickover orbital? *looks it up*)
dirkdeftly#
BTW, I figured out why my hypercube wasn't working right. I was rotating it in a cube of the radius sqrt(3), not sqrt(2). I feel safer now...😛
Matt_W74656#
sorry....

I'm sorry but i just cant get this thing to sork you make it sound so good though. Can plez when you get it to zip up post it here. It doesnt matter if we have to put it in are selves thanks.
dirkdeftly#
Okiedokie...Matt, the zipped version is in the fourth or fifth post on this thread.

And this is my current application of the hypercube. I'm pretty sure this one is going in my pack.
dirkdeftly#
Shoot, I forgot to tell everybody this:
DO NOT PUBLISH YOUR PRESET USING MY HYPERCUBE UNTIL THE FORWARD FLOW IS RELEASED ON WINAMP.COM!!!

Anywho, yeah Nic, you can use it
Zevensoft#
Yada yada, anyone wanting to use me 4D sphere just include credit for me.

Also, if you increase res to 10000, but add n=1000 to the init line, you'll get some cool-looking curves. Use res=1000,n=10000 to be able to clearly see the spheres.
sonic.blade#
dimensions

one thing that should be mentioned is that
the concept of dimensioned is not limited
to distances is space.
so you can basicly consider the r, g and b-
values as dimensions.
if we leave our dimensions clamped between 0 and 1
(or -1 and 1(or-999999999999 and +99999999999
(or whatever finite intervall) we can split time
easily into x, y and z-movement eventually h, p and b-rotation
and so on
so u can easily construct a 12-dimensional object in screen-space

jm2c
sonic
dirkdeftly#
I'm trying to decide whether that was actually a meaningful contribution or just a desperate attempt to sound cool.
The concept of dimensional geometry IS about spacial relationships. The color of an object is a property. It has only to do with it's material configuration. Therefore color is a unidimensional property. Therefore color is not a dimension in itself.
time has been theorized as a fourth spatial dimension, and our movement through it is relative to our movement in 3-space.
And what are h-, b-, and p- rotation? Also remember that a rotation is a perpetually changing movement; it has no constant direction.

And you kind of missed the point of this whole thread; that rotation in higher dimensions and translation between dimensions is extremely easy to program.
UnConeD#
I'm not sure what you mean sonic.blade...

Of course a space doesn't need to have a spatial meaning... any vector can be used, wether it's a point, a colour, etc.

Maybe you meant that you can use colour to indicate the coordinate of a point in a higher dimension as well?
Krash#
I know what sonic.blade means, though I'm not sure how well I'll go with explaining it - I haven't done maths of any real sort in years, and multi-dimensional stuff in even longer.

If we first of all think about a unit sphere. The sphere exists for values of x, y, and z between -1 and 1, and does not exist for all other values (outside the function's domain, as it were).
This is a simple concept to grasp, as we deal with three dimensions every day.

If you want to easily comprehend a 4th dimensional unit sphere, the best way is to arbitrarily assign some value to the 4th dimension. Most commonly, people assign time to the 4th dimension.

You can then imagine that at time t=0, a 4th dimensional unit sphere would look identical to a 3d unit sphere. But if you went back to t=-0.5 (keeping x, y and z at 1, for simplicity's sake), you would see a smaller sphere.
Why?
Well, if you think about a 3d sphere, a 2d cross-section taken at z=-0.5 is a smaller circle than at z=0. So for a 4d sphere, the "cross-section" at t=-0.5 will be a smaller sphere than that taken at t=0.

You can progress this across the entire domain of t (-1 to 1). If you remember that t is time, you can therefore imagine that 4d sphere would appear as nothing before t=-1, at which point it would become an infintesimal sphere. This sphere would grow until it reached unit dimensions at t=0, and would then shrink back to nothingness. Of course, this is just for visualising a 4d shape.

The elegance of this method means that you can assign practically any continuous property to a dimension. You can even use non-continuous properties, provided you limit the domain appropriately.

For example, you can set colour as an example. Colour is actually a value on an electromagnetic frequency spectrum. So if you assign colour to the 5th dimension, and set "red" to c=-1, and "blue" to c=1, with a smooth spectrum in between, you can imagine a 5th dimensional sphere.

This would be a growing/shrinking sphere, as for the 4th dimensional sphere, but the sphere would have an infinite number of spheres inside it, of differing colours. In the center of the 5-hypersphere would be two infintesimal spheres, one red, and one blue. The outside of the sphere when it was at it's maximum size and colour variation (x,y,z,t and c all equal 0) would be green. There would be a smooth gradient opf colour within the sphere, in BOTH directions (green->red and green->blue). Sort of like an everlasting gobstopper...

You can extend this however you like. Assign pitch, yaw and roll to dimensions - that brings us up to 8-d. Assign other properties - luminescence, transparency, roughness... brings us up to 11-d. You can even use non-visual properties (as these properties are simply there to help us understand the shape) such as volume, frequency of a generated noise, etc.

Maybe I've explained this poorly... I don't know... it's been too long.

- Krash
sonic.blade#
thanx krash and unConeD
i really just wanted to give some imput to the topic and
it was´nt my intention to show off.
Atero: -I just ment the 2-dimensional representation of n-dimensional
objects (not just geometries)
-HPB-rotation means heading-pitch-banking its basicly just
another notation to prevent gimballockup
to explain a bit more scintific why i counsider those
things as (useable) dimensions i want to point out the sence of
distances in space (i hope the translation is OK)
a space is defined by it´s metrik and the only three needs
for a metrik (distance-funktion) d:XxX->R are:
1.) d(x,y)=0 <--> x=y
2.) d(x,y) = d(y,x)
3.) d(x,z)<= d(x,y)+d(y,z)
as far as i know (please correct me if i´m wrong)
a n-dimensional metrik space can be easily constructed
as space is (x1,x2,x3,...,xn) and
metrix is d^n(x^n,y^n)=d(x1,y1)+d(x2,y2)+...+d(xn,yn)
when all properties (x1,x2...xn) are independent
so i consider every property that can be represented as a Real-Number
as a valid dimension.
hope it makes sence
sonic
dirkdeftly#
I think I'd trust you more if you would spell "meant," "metric ~ics," and "function" correctly.
But in any case, no, you did not make sense.

Krash: Again, that was kind of the point of this thread...
sonic.blade#
sorry for my bad english, i do all the math-stuff
at the university in german.
i wasn´t supposed to start and endless thread about math
over here i just wanted to give some input.
sonic
n-D being#
Going back up to zevensoft's hypersphere, *******ns can be represented (approximately) by changing the first three lines of code to
x=cos(i*pi*res)*sin(i*pi*res*res)*sin(i*pi);
y=cos(i*pi*res*res)*sin(i*pi);
z=sin(i*pi*res)*sin(i*pi*res*res)*sin(i*pi);

Layering this scope on top of his original gives a much clearer view of the 4D surface shape.

David
dirkdeftly#
EEEEEEEAAAAAAARGH

WHY ON EARTH DID YOU REVIVE THIS

IT WAS DAMN NEAR A YEAR OLD!!!

/me sobs uncontrollably 😢
mikm#
not if its is a digital clock 😛

you should copy each part into the correct 'section' of the superscope and make sure you have it set to lines, not dots (or vice versa)