Live data from Hacker News

Geometry from Another Universe

falsifian.org

81–90 of 91 posts

Re: Geometry from Another Universe

#81
post #15

If you're interested in this, you may be interested in Hyperbolica, which is a whole game about this concept: https://store.steampowered.com/app/1256230/Hyperbolica/ https://www.youtube.com/watch?v=EMKLeS-Uq_8

Antichamber too https://store.steampowered.com/app/219890/Antichamber/

Antichamber has lots of weird, cool stuff in it, but nothing to do with non-Euclidean geometry. (They just use the term incorrectly.)

Re: Geometry from Another Universe

#82
post #9

I thought this might have been something about a Greg Egan book ( https://www.gregegan.net/DICHRONAUTS/DICHRONAUTS.html is a recent one with space-time composed of two dimensions of space and two of time), but these demos are really fun too. Especially like the connectedness of everything that's not in some sense cheated with portals.

Egan's Diaspora also deals with this in some chapter. https://www.gregegan.net/DIASPORA/15/15.html

I don't understand anything in that page but the pictures are great.

Re: Geometry from Another Universe

#83

If you're interested in this, you may be interested in Hyperbolica, which is a whole game about this concept: https://store.steampowered.com/app/1256230/Hyperbolica/ https://www.youtube.com/watch?v=EMKLeS-Uq_8

Sokyokuban, a non-euclidean sokoban

https://news.ycombinator.com/item?id=25892889

Re: Geometry from Another Universe

#84
post #20

Very cool, but I have a question. > This is done using WebGL, an API for drawing 3D graphics in a browser. You might think it's only designed to draw ordinary, Euclidean things, but it turns out it's perfectly suited to rendering this world as well. WebGL (and OpenGL) works with four-dimensional coordinates (x,y,z,w). Normally, you'll be advised to just set that w coordinate to 1 all the time. If you do that, the x,…

The 4D coordinates are almost treated as ratios. (x,y,z,w) = (tx,ty,tz,tw) when t is positive, but if t is negative it's a different point.

This happens to work with (Open/Web)GL. Here's my understanding of why. Say you tell WebGL to draw a triangle with points at clip space coordinates (i.e. after all the transforming is done) (1,0,0,1), (0,1,0,1), (0,0,0,1). If you multiply all those by a positive number, e.g. (10, 0, 0, 10), (0, 10, 0, 10), (0, 0, 0, 10), you get the same triangle. But if you multiply by a negative number, they will not be drawn at all: (-1, 0, 0, -1), (0, -1, 0, -1), (0, 0, 0, -1) is not drawn. I think this is because of the rules for clipping: only points where -w Related: my code draws the universe twice on each frame. First I draw things that are more than halfway around the sphere from you, and then I reset the z buffer and draw things that are closer to you. https://git.sr.ht/~falsifian/s3d/tree/main/item/src/S3D/Draw...

Re: Geometry from Another Universe

#85
post #20

Very cool, but I have a question. > This is done using WebGL, an API for drawing 3D graphics in a browser. You might think it's only designed to draw ordinary, Euclidean things, but it turns out it's perfectly suited to rendering this world as well. WebGL (and OpenGL) works with four-dimensional coordinates (x,y,z,w). Normally, you'll be advised to just set that w coordinate to 1 all the time. If you do that, the x,…

The 4D coordinates are almost treated as ratios. (x,y,z,w) = (tx,ty,tz,tw) when t is positive, but if t is negative it's a different point. This happens to work with (Open/Web)GL. Here's my understanding of why. Say you tell WebGL to draw a triangle with points at clip space coordinates (i.e. after all the transforming is done) (1,0,0,1), (0,1,0,1), (0,0,0,1). If you multiply all those by a positive number, e.g. (10,…

Another thing maybe worth mentioning: the magnitudes matter when GL is doing interpolation, which is especially noticeable when there are textures.

That is, if you scale just one of the three points of the triangle, e.g. (1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 0, 1000), then while the triangle will appear in the same place as before, interpolation (e.g. deciding which part of the texture to draw in each pixel of the triangle) changes.

The current version of the demo doesn't have any textures but that's mostly laziness on my part. For a while I gave the rooms "ceilings" which were each a checkerboard-pattern square, which forced me to figure out how to get the interpolation thing right. So I can confirm it can be done. But I dropped the ceilings because they just got in the way.

Re: Geometry from Another Universe

#86

Does anyone know of a good visualization of a hypercube? Specifically, I'd like to be able to rotate it around various axes to see what its shadow looks like in 3D. On that note, a VR rendering might help since a 2D projection overcomplicates the shadow. It's easy to construct, just build a point, extrude the point out to make a line, extrude the line out to make a square, extrude the square out to make a cube, then…

This demo is actually fairly close to showing you a hypercube.

The six rooms in the house form six cells of the hypercube. You can make one more cube by joining up the tops of the walls: that cell is always above you. And finally, there would be one more cell below you. (To be a bit more precise: the six rooms of the house would have to be extended to be twice as tall. The tops of the walls are at coordinates (+-1, 1, +-1, +-1), but right now the bottoms of the walls are at (+-1, 0, +-1, +-1). You have to remove the floor and make the walls go all the way down to (+-1, -1, +-1, +-1).

You can do this for any 4D polytope. Taking it down a dimension, the layout of the house shows how to put a cube on a 2-sphere. I could have done it for any other 3D polyhedron. Give the sphere and the polyhedron the some centre point, and then project all the lines of the polyhedron onto the sphere. Each face of the polyhedron becomes a 2-D region on the sphere (in the case of the house, each room is a square). Going a dimension up, you can centre the 3-sphere and the polytope on the same point, and do the same kind of projection. Every cell of the polytope turns into one 3-D region of the 3-sphere.

I wish I had had time to include that.

Re: Geometry from Another Universe

#88
post #80

I didn't know Idris could do WebGL!

I am grateful for the idris2-dom library by Stefan Höck: https://github.com/stefan-hoeck/idris2-dom/ . It covered most of the web APIs I used.

I'm using the WebGL API pretty directly, though. So if it were missing I could have hacked it with some foreign function calls, but it would have been a lot more effort.

Re: Geometry from Another Universe

#89

Would love to see this where you can toggle between a three-sphere, flat, and 3-hyperbolic space.

And arbitraily gluable diffrrentiable manifolds!

That is one of my fantasies, if I had enough time. Apply different rules to different regions of space.
Post reply on HN