Archive: Hypercube (4-D analog of a cube)


5th May 2002 07:47 UTC

Hypercube (4-D analog of a cube)
I've constructed a mostly functional (and extremely fast) hypercube, but since I don't have a functional zip program, I'll have to post the code here. People can use it as they wish, as long as they give me full credit for it


Init:
n=58;

Beat:
iwxt=rand(100)/1000-0.05; iwyt=rand(100)/1000-0.05; iwzt=rand(100)/1000-0.05; ixyt=rand(100)/1000-0.05; ixzt=rand(100)/1000-0.05; iyzt=rand(100)/1000-0.05;

Frame:
p=0; wxt=wxt+iwxt; wyt=wyt+iwyt; wzt=wzt+iwzt; xyt=xyt+ixyt; xzt=xzt+ixzt; yzt=yzt+iyzt; cwx=cos(wxt); swx=sin(wxt); cwy=cos(wyt); swy=sin(wyt); cwz=cos(wzt); swz=sin(wzt); cxy=cos(xyt); sxy=sin(xyt); cxz=cos(xzt); sxz=sin(xzt); cyz=cos(yzt); syz=sin(yzt);

Point:
p=p+1;
w1=(equal(p,2)+equal(p,9)+equal(p,15)+equal(p,21)+equal(p,22)+equal(p,23)+equal(p,24)+equal(p,25)+equal(p,26)+equal(p,28)+equal(p,29)+equal(p,30)+equal(p,31)+equal(p,32)+equal(p,34)+equal(p,35)+equal(p,36)+equal(p,37)+equal(p,38)+equal(p,39)+equal(p, 40)+equal(p,42)+equal(p,43)+equal(p,44)+equal(p,45)+equal(p,53)+equal(p,54)+equal(p,55)+equal(p,56)+equal(p,57)+equal(p,58))*2-1;
x1=(equal(p,4)+equal(p,11)+equal(p,17)+equal(p,18)+equal(p,19)+equal(p,20)+equal(p,21)+equal(p,26)+equal(p,27)+equal(p,28)+equal(p,29)+equal(p,30)+equal(p,31)+equal(p,40)+equal(p,41)+equal(p,42)+equal(p,43)+equal(p,44)+equal(p,45)+equal(p,46)+equal(p ,48)+equal(p,49)+equal(p,50)+equal(p,51)+equal(p,52)+equal(p,53)+equal(p,55)+equal(p,56)+equal(p,57)+equal(p,58))*2-1;
y1=(equal(p,6)+equal(p,13)+equal(p,14)+equal(p,15)+equal(p,16)+equal(p,17)+equal(p,25)+equal(p,26)+equal(p,27)+equal(p,28)+equal(p,30)+equal(p,31)+equal(p,32)+equal(p,33)+equal(p,34)+equal(p,36)+equal(p,37)+equal(p,38)+equal(p,45)+equal(p,46)+equal(p ,47)+equal(p,48)+equal(p,50)+equal(p,51)+equal(p,52)+equal(p,53)+equal(p,54)+equal(p,55)+equal(p,57)+equal(p,58))*2-1;
z1=(equal(p,8)+equal(p,9)+equal(p,10)+equal(p,11)+equal(p,12)+equal(p,13)+equal(p,19)+equal(p,23)+equal(p,31)+equal(p,32)+equal(p,33)+equal(p,34)+equal(p,35)+equal(p,36)+equal(p,38)+equal(p,39)+equal(p,40)+equal(p,41)+equal(p,42)+equal(p,44)+equal(p, 45)+equal(p,46)+equal(p,47)+equal(p,48)+equal(p,49)+equal(p,50)+equal(p,52)+equal(p,53)+equal(p,54)+equal(p,55)+equal(p,56)+equal(p,57))*2-1;
w2=w1*cwx+x1*swx; x2=w1*swx-x1*cwx;
w3=w2*cwy+y1*swy; y2=w2*swy-y1*cwy;
w4=w3*cwz+z1*swz+5; z2=w3*swz-z1*cwz;
x3=x2*cxy+y2*sxy; y3=x2*sxy-y2*cxy;
x4=x3*cxz+z2*sxz; z3=x3*sxz-z2*cxz;
y4=y3*cyz+z3+syz; z4=y3*syz-z3+cyz;
x5=x4/w4; y5=y4/w4; z5=z4/w4+5;
x=x5/z5*8; y=y5/z5*8;


PS: If anyone knows where to get a free version of PKzip, e-mail the URL to me at therealatero@hotmail.com


5th May 2002 14:17 UTC

haven´t tried your cube yet
but u could check on:
http://www.tucows.com/system/comp95.html
for comp/decomp utilities
cu
sonic


5th May 2002 14:55 UTC

atero, cool thing, but what is it? a dm or a ssc?
like i tried both thing and on the ssc and on the dm it didn't appear anything so...

and atero, http://www.winzip.com , download winzip 8.1, (and if you need a crack, pm me)


5th May 2002 16:36 UTC

Yeah, I plugged it into a superscope, but nothing. (60 fps though)


5th May 2002 17:34 UTC

That's odd...

Aaaaaaaaaaaaaaaaaaaaaaaaagh, I know why it is. When you copy and paste it, it adds all the line breaks - you might have to get rid of them yourselves...

And it's a superscope - I don't want to think of what it'd look like as a DM


5th May 2002 17:48 UTC

There we go...I also slowed the movement down so you can follow it


5th May 2002 18:04 UTC

Firstly I'm amazed on how quick it is... all that code...
But since it's obvious you used point-by-point assignment, it's not as amazing as it is to me anymore =p

It IS amazing... but I don't know whether an average AVS-viewer will like it - Some people don't even see what's in an AVS ya know - They'd think "It's just a boring stupid shape" and leave... fortunately we have a lot of people that digs in the AVS =)

How are you going to implement that SSC into an AVS preset?


5th May 2002 18:13 UTC

Neat
So that's why you wanted 4D rotation :). I've been thinking of doing something like this, but I assumed that the result would be too confusing to be cool. If you look closely, you can see that it's a 3D-cube, but instead of square faces, each face is a 2D view of a 3D cube. The logical explanation is that a 4D hypercube consists of 6 cube 'faces'.

I'm going to try more 4D things now.


5th May 2002 18:48 UTC

Man, that looks messed.

I just don't get it. Can't really tell what's going on. Not for me, sorry.


5th May 2002 20:28 UTC

To understand what a 4D (or n-dimensional) cube is, look at the evolution of a cube from 0D to 3D:

- Take a point (0D)
- Copy the point and move it, and connect it with a line
=> we now have a 1D shape (a line)

- Take the line (1D)
- Copy the line and move it into the second dimension, and connect both ends with 2 lines
=> we now have a 2D shape (a square)

- Take the square (2D)
- Copy the square and move it into the third dimension, and connect the matching pairs of corners with 4 lines
=> we now have a 3D shape (a cube)

Now comes the 'weird' part:
- Take the cube (3D)
- Copy the cube and move it into the fourth dimension, and connect the matching pairs of corners with 8 lines.

If you understand the idea, you can expand it into n dimensions.

Now, we live in a 3D world, and therefor we can't naturally visualise higher dimensional shapes. To understand what happens, consider a 2D universe (a flat plane) and how it relates to 3D. Just like you can represent 3D by an infinite amount of 2D 'slices' (planes), you can think of 4D as composed of an infinite amount of 3D 'slices' (spaces).
Now, think about how we represent 3D space on a flat plane: we project all the points from an eye onto a plane, commonly by dividing by the 'z' coordinate. So if you wanted to represent a 4D hyperspace in 3D space, you'd need to divide 3 coordinates by a 4th (as you're projecting a 4D hyperspace onto a 3D space). This is what Atero's superscope does. On top of that, it takes the 3D result, and projects it onto 2D like any other 3D superscope.

Now, you might say "aha! so it's not actual 4D! it's just a 3D shape that moves in a weird way!". Well, so is 3D on a computer: it's a 2D shape that looks like 3D, because our eyes view the world like that too.

Now specifically about a 4D hypercube:

A 3D cube has 6 square (2D) faces. A 4D cube has 8 cube 'faces' (3D). If you look at Atero's superscope, you'll notice that it hardly looks cubic: all the angles are distorted. Well, if you look at how you draw a 3D cube on a 2D paper, it'll be distorted too. You're just used to it so much, that it becomes natural.

Higher-dimensional shapes might sound like an alien concept, but they have many uses in mathematics and science. And as we can now see, they look cool too :)


5th May 2002 20:31 UTC

Typo?
I think there's a typo here:

y4=y3*cyz+z3+syz; z4=y3*syz-z3+cyz;

Those 2 + signs should be multiplications, right?


5th May 2002 23:10 UTC

That's what was the wrong with it! I've been checking all over my code for typos, but I couldn't find them. Thanx!!

BTW, I'm still trying to work out the scaling/shifting so that it renders correctly. The scaling factors are in the last W-axis statement (w4), and in the very last line where the transforms are taking place


9th May 2002 11:58 UTC

Would that mean that a torus is 4-dimensional? Because that HyperCube looks awfully like a very low-res toroidal shape.


9th May 2002 16:19 UTC

A regular torus is a simple 3D shape.

You don't seem to be getting the point though. The dimension of a shape/space can be seen as the number of linearly independent vectors you can construct in it. For example:

In a flat plane, you can construct 2 base vectors (e.g. the X and Y axis) that, when added up, can reach the entire plane. It's impossible to find a third vector that can't be broken up as a sum of the earlier two.

In space, there are 3 such vectors (e.g. X, Y, Z). Now, imagine a hypothetical 4D space, where there are 4 such vectors. In our reality, there is no such thing (or at least not found :)).

To show this 4D shape, we project it into 3D space, much like we can project a 3D shape onto a 2D plane (e.g. a computer screen). So while it becomes a 3D/2D shape, we actually still have the originating 4D shape in mind.

A (hyper)cube is very different from a (hyper)torus. It might look the same here, but that's because it's very hard to visualise the 4D structure.


13th May 2002 00:52 UTC

UnConeD, were you talking to me or Zevensoft?

Anyway, I'm trying to figure this one out: Theoretically, w, x, y, and z should only range from 1 to -1. However, when I shift w by 2 (so it's from 1 to 3) to translate it to 3D, I get distortion. Also, after that translation, the shift of sqrt(2) does not work on the 3D/2D translation - I have to shift and scale by 2. But that brings up another mystery: Using those shifts, the sphere the cube is projected into (and thereby the ring that sphere is projected into) fits perfectly into the window. With shifting and scaling by 2 on any 3D superscope, you end up with a ring larger than the window.
Any ideas?


ZS, the hypercube is a much different object from the hypertorus. Think of it this way: A two dimensional torus would be an O shape. Stretch that into the third dimension and it becomes a donut, or torus, in prissymathematicianspeak. (Why an I hungry all of a sudden?) You can then stretch that into the fourth dimesion (I don't know how, but I'm working on it); this is the hypertorus. Why did you think my hypercube looked 'toroidal?'

This is a (rather poor) wireframe torus:
tpi=acos(-1)*2;
x=sin(i*tpi)*(sin(i*tpi*500)/3+1);
y=cos(i*tpi)*(sin(i*tpi*500)/3+1);
z=cos(i*tpi*500)/3;
UnConeD, do you know the coordinates for a hypertorus?


13th May 2002 09:17 UTC

Well actually there are two things you can mean by a torus.

Take a grid. Bend it so that two opposite edges are joined, you now have a cylinder-like shape. Bend it again so that the remaining two edges (now circles) are joined: you now have a donut.

So the main property of a n-torus is that is an n-grid that is connected to itself in every direction. This has a few 'weird' consequences: for example, if you start out with the other pair of edges, you'll get a differently oriented donut, but the topological properties are still the same.

I've been thinking about a system behind hypertori (like the system to go from dot to line to square to cube to hypercube) and here's what I believe is close to correct:

- Take a point (0D)

- Trace a circular path with it, so that the center of the circular path is outside the shape, and a new axis is used. We now have a circle (2D). However a point on the shape itself can always only move on 1 degree of freedom, so the shape's topology can be considered 1D. Note that this is essentially a line with its begin and endpoints connected.

- Take this circle, and trace a circular path with it, so that the center of the circular path is outside the shape, and a new axis is used. We now have a torus/donut (3D). However a point on the shape itself can always move only on 2 degrees of freedom, so the shape's topology can be considered 2D. Note that this is a 2D grid with both pairs of ends connected to the opposite side.

- Take this donut, and trace a circular path with it, so that the center of the circular path is outside the shape. We now have a 4-hypertorus (4D). However a point on the shape itself can always move only on 3 degrees of freedom, so the shape's topology can be considered 3D. Note that this is a 3D grid with all pairs of opposite faces connected to the opposite side.

So for one, you have the topology, and always several geometrical representations that satisfy this topology. Think of generating it by having a hyperdimensional compass (is this the right word? a tool for drawing circles on paper) and dragging the dot, circle and donut through (hyper)space.

The formulas have a system to them too. You're always shifting the previous shape around on one axis, and then rotating around to get the circular path:

1:
x1 = 0;

2:
x2 = (x1 + R1)*cos(a1);
y2 = (x1 + R1)*sin(a1);

3:
x3 = x2;
y3 = (y2 + R2)*cos(a2);
z3 = (y2 + R2)*sin(a2);

4:
x4 = x3;
y4 = y3;
z4 = (z3 + R3)*cos(a3);
w4 = (z3 + R3)*sin(a3);

...

Rx are the radii of the separate stages, ax are a variable ranging from 0...2PI.


14th May 2002 07:22 UTC

Umm...I applied that to AVS, and the system renders a pringle-shape. I assume ax can be i*tpi?

Anyway, attached is the 5D analog, missing only a few lines - I'm trying to find them (so I don't have to re-write the whole thing from scratch). I'm guessing since "hypercube" is 4d, "super-," "ultra-," or "sugarrushcube" could be names for 5d....


14th May 2002 07:32 UTC

I get it now. It's a cube within a cube at first, right? Then the eight connecting lines manipulate their length, like that of a square does to form a generic 4-sided shape. Have I got it?


14th May 2002 08:29 UTC

uNDefineD: well yes and no.

First of all, remember that it's not what it looks like. Just like a 3D cube is a very ugly shape when you draw it in 2D. It's only our brain that makes it look 3D.

Now, remember how you go from a 2D square to a 3D cube, by taking 2 squares and connecting the corresponding pairs of vertices.

Now, take a cube. Take another cube and move it in a theoretical 4th dimension. Connect the corresponding vertices.

What we have now, is a 4D-hypercube. To understand what it 'looks' like, look at the following analogies:

- A 1D line has 2 0D-points
- A 2D square has 4 1D-lines
- A 3D cube has 6 2D-squares
- A 4D hypercube has 8 3D-cubes

And there you have it. It's not just 2 cubes that you see, it's 8. Of course, because of the 4D->3D perspective, it'll only look cubic in some positions. But in the original 4D concept, every line is perpendicular to every other line, and they are all of length 1.
To make it clearer: in the beginning you see the 'larger' cube and the 'smaller' cube (they're actually the same size if it weren't for the perspective). Now, each face of the smaller cube is connected with the corresponding face of the larger cube. Look at the series of analogies above: take 2 squares (the 2 corresponding faces) and connect them, you now have a cube (if they are the same size and spaced apart at the same length).

There's really not much more to be said. It's a weird concept that you have to get used to. Just don't try to think of it in terms of 3D, because it isn't.


14th May 2002 08:37 UTC

The 5D version is nice by the way. As far as the naming goes, I've always been taught that 'hyper' is the generalized form:

A 2-hypercube is a square. A 4-hypercube is what you posted at first. So the last one is a 5-hypercube, right?

As far as the 4-hypertorus goes, the difficulty lies in drawing all the connecting lines. For example, to draw a sphere you need to draw both parallels and *******ns. I think the easiest way would be to synchronize 3 superscopes in which each superscope draws one main direction (remember that a 4-hypertorus is a connected 3D space, just like a 3D torus is a connected 2D grid).


14th May 2002 11:14 UTC

It's a weird concept that you have to get used to.
Don't go any further, you explained it perfectly. :) So when the "smaller" cube is connected with the "larger", each connecting line completes another cube that forms the "sides" of the hypercube. Is that it?

EDIT: I just saw the Supercube. Because it was moving too fast :p, I'm _guessing_ that since it's 5D, continuing from UnConeD's analogies, a 5D supercube has 10 4D hypercubes, is that correct?

BTW, I must give you kudos for putting up with people who can't code. :)

14th May 2002 11:38 UTC

uNDefineD: you're totally correct. It has nothing to do with being able to code by the way... the concept of higher order dimensions is not easy to explain, because most people will still try and visualise everything in 3D. Once you let go of that, it's easier.

The 5D hypercube should indeed have 10 hypercubes in it, but as Atero said there are a few sides missing. And because it's representing 5 dimensions in 2, it's very hard to see the geometry in it.

All in all this is very fun thread :). Higher dimensional geometries are normally only used theoretically (e.g. a computer network can be connected in a 4D-hypercube arrangement, or even higher) but it seems they're cool for visuals too.


15th May 2002 00:48 UTC

Thanks, UnConeD. BTW, about the code thing, I was just making a reference to my inability to logically work out SSCs and DMs and stuff. :D For me, it's random equations and hope for the best. Seemed to work with my Power Core though...


15th May 2002 21:01 UTC

Some of my personal theories on n-dimensional geometry:
Objects in the n'th dimension are seen in the (n-1)'th dimension. The closest example is real 3D life: you can see depth, but the depth is created by your mind. Put your hand up in front of your face. You can see the depth beyond your hand, but you cannot see what is behind it. Therefore you see in 2D. A more biological proof is that your retina is 2D, and therefore you cannot see in any higher of a dimension. Imagine then sight on a line. You would see in 0D. The only places you could see would be directly in front of and behind you. On a plane you would see in 1D. And in hyperspace you would see in 3D.
To create a higher dimensional object, it is said that you need to move something 'back' into the next dimension. However, we cannot easily do this without creating a perspective into the next dimension first. Put yourself into the first dimension. Shrink the line you are on, then connect the endpoints. This creates a perspective of the second dimension. Then in the second dimension, shrink the square, and connect the vertecies. This is a perspective of the third dimension. Now shrink a cube and connect the vertecies. This is a perspective of a hypercube. Theoretically you would now shrink the hypercube, but since we don't know exactly what the hypercube looks like, we can't do that. The other way to create a perspective is to extend your current object on every dimension available. Then stretch the new objects to meet each other, creating the last new object. For example, copy a square to the left, right, up and down. Then stretch each square to meet the ones next to it, creating a new larger square. Another example is to copy a cube up, down, left, right, backwards, and forwards. Then stretch each new cube to meet the one next to it, creating a new cube. Now once you've created a perspective, move the new objects backwards into the next dimension, without changing the perspective, until all angles are right.
I have also developed a formula for finding the number of edges in an n-dimensional cube:
2^(n-1)*n
which is basically an expression of the number of connections you can make between two adjacent points. 2^n is the number of points (a line is 2 points, four lines of a square is 4 points, six sides of a cube is 8 points, etc.), and n is the number of possible changes (one for each dimension). However, you do each connection twice with that formula: (1,1) : (1,-1) :: (1,-1) : (1,1), so you divide by 2; hence 2^(n-1).

[edit: smilies were screwing up the above bit of code]


16th May 2002 07:18 UTC

Originally posted by Atero
[edit: smilies were screwing up the above bit of code]
LMAO :D

And one more thing Atero: could I use a remix of your preset for my AVS pack? Cause I reckon I've got something pretty good going on. :)

17th May 2002 02:26 UTC

Which preset? The one that I posted in a new topic, completely seperate and disassociated with this one? Or do you just want to use my hypercube?



Yes, sure, why not, as long as you give me full credit for the morpher and the smoke bgdm or the hypercube coding.


17th May 2002 05:38 UTC

Sure. Credit is given where it is due. I didn't mess with the render anyway, all I added was Trans elements.

Thank a lot! You've made my day! :) :) :)

EDIT: I'm using the hypercube. I have no idea what the other thingy is... :p


19th May 2002 04:00 UTC

/me would like to use hypercube :)


20th May 2002 00:39 UTC

Sure, I don't mind (again, as long as I'm given full credit for it)


22nd May 2002 06:42 UTC

I think that every part of mathematics has now been integrated in to AVS.


22nd May 2002 14:20 UTC

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.


23rd May 2002 05:28 UTC

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...


25th May 2002 11:10 UTC

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).

25th May 2002 15:36 UTC

just dont ask anyone to have res=100 :D


30th May 2002 02:27 UTC

What's the derivation of the hypersphere? It works perfectly, I can see all 8 spheres and their rotation :up:


31st May 2002 05:19 UTC

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


31st May 2002 13:55 UTC

the 4d-sphere, is that a sphere with 8 3d-spheres inside?

and why does it look like a lot of spirals


31st May 2002 20:37 UTC

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).


1st June 2002 00:20 UTC

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.


2nd June 2002 20:10 UTC

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.


2nd June 2002 20:52 UTC

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...)


3rd June 2002 02:52 UTC

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*)


6th June 2002 01:42 UTC

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...:p


6th June 2002 02:21 UTC

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.


8th June 2002 05:19 UTC

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.


8th June 2002 16:17 UTC

Legal Stuffs...
Just asking for permission to use yar hypercube...


8th June 2002 19:58 UTC

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


9th June 2002 02:02 UTC

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.


11th June 2002 22:37 UTC

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


12th June 2002 02:45 UTC

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.


12th June 2002 04:30 UTC

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?


12th June 2002 11:39 UTC

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


12th June 2002 12:20 UTC

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


12th June 2002 22:25 UTC

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...


14th June 2002 11:26 UTC

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


5th June 2003 23:26 UTC

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


6th June 2003 00:37 UTC

EEEEEEEAAAAAAARGH

WHY ON EARTH DID YOU REVIVE THIS

IT WAS DAMN NEAR A YEAR OLD!!!

/me sobs uncontrollably :cry:


6th June 2003 20:08 UTC

I can not see Zensoft's Hypersphere, am I suppose to do something beside copy and paste?


6th June 2003 21:18 UTC

not if its is a digital clock :p

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)


6th June 2003 21:58 UTC

somebody whack this thread >_<


6th June 2003 22:11 UTC

I got it now!


6th June 2003 22:16 UTC

Would it be possible to make any object in the forth demension, like a cylinder or a rectangle?


7th June 2003 01:01 UTC

use the edit button!!!

well a rectangle is obviously very easy. take the hypercube code and stretch it along the axes. a hypercylinder is harder, although possible (look at the 3d sphere code and play w/ that).

basically, 4d works more or less like 3d, except you have 4 axes to work with.

so, you would be typing w1=...;y1=...;z1=...;x1=...; then use the rest of the engine to convert it to 2d.

i second atero's request for a lock


7th June 2003 02:00 UTC

weell.. if you looking at basic shapes like rectangles etc. It can be a bit confusing. By definition, a rectangle rectangular prism is a shape that has at least one set of sides a different size. So you have to work out how 'long' you 4th dimention is going to be. Same deal with cylinders, only evern more complicated, as a cylinder is definable only as a 3d object, something like (sqrt(x*x+y*y)*z). To put it in 4d you have to really use your imagination.

For example a 4d cylender could be like an infinate 'shaft' of spheres heading off along the 4th dimention. Or and infinate series of tunnels heading off in parrallel to the first tunnel. Although these descriptions are using 3d terms, so you have to try to imagine it like that in 4d.


7th June 2003 03:28 UTC

Well siddhartha, the best way to think of it is that a 3D cylinder is an 'Extruded Circle', therefor the 3D version of circle is sphere, that makes the 4D cylinder an 'Extruded Sphere'.


7th June 2003 03:49 UTC

nice one..
the problem is obviously that we are used to thinking in terms of 3d geometry. but when in gets to 4d, its hard to imagin what properties the fourth dimention should take on. Unless you are talking about figures that have equal properties on all axes (like cubes and spheres) you have to make up the 4th axis from what seems to be the logical way.


7th June 2003 07:11 UTC

:confused: :igor:
Help... I think my head's gonna explode... :p


7th June 2003 16:20 UTC

going off of what Zvensoft said:

you start with a point- the first dimension. You choose an arbitrary direction and translate that point and connect them with a line. You then take those two points and extend them in another arbitrary direction and connect them with a line. This is 2D. Take those four points and extend them in another arbitrary dimension, and connect them with a line. This is the third dimension. Now you can take those eight points and extend them in an arbitrary dimension, connecting them with lines. This is the 4th dimension. You can continue doing this forever.

Try drawing this (you need a pencil and a lot of room)


7th June 2003 19:33 UTC

okay, what you all need to do is shut the fuck up, read the annotated flatland, then flatterland, and go away >_<


7th June 2003 21:40 UTC

Originally posted by Atero
okay, what you all need to do is shut the fuck up, read the annotated flatland, then flatterland, and go away >_<
Hehe... I have flatland. Quite interesting.

:D

9th June 2003 20:35 UTC

2 days isnt old right? .... after reading some of these posts I am having a hard time recognizing sentences... especially...

Originally posted by UnConeD
(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...)
It took me 3 re-reads to understand "physical or electronic book". Im.. so ... disoriented.

*electronic buzzing coming from head*

:igor: :igor: :igor: :igor: :igor: :igor:

9th June 2003 21:06 UTC

but one year is. and it was almost dead again. and you revived it, again. fuckers >_<


9th June 2003 21:09 UTC

notice the person who revived it never came back.

somebody lock this.


9th June 2003 21:10 UTC

almost dead??? maybe, but the AVS forums are going so slow it was the third thread from the top


9th June 2003 21:13 UTC

just STFU and stop posting in this thread. there is no point in keeping this alive any longer. i will banish the next person who posts here (unless it is a mod locking it) to hell ( i am a minister...a friend was bored during study hall and found a site that ordains you for free, so i got ordained just for kicks. i am not very religious or anything in fact, i don't believe much in religion)


9th June 2003 22:09 UTC

Locked but please chill people