# Hyper-spacial ray-tracer

Discussion in 'Python' started by Rouslan Korneychuk, Oct 2, 2013.

1. ### Rouslan KorneychukGuest

I have been working on something I thought was interesting and I wanted
to know what other people think. It's a ray-tracing library than can
work with any number of spacial dimensions greater than two. It's a
Python package that uses Pygame.

The project and a screenshot are at: https://github.com/Rouslan/NTracer

For those not familiar with the concept of hyper-space: a simple example
of a three-dimensional object is a cube. A two-dimensional analogue is a
square. With one dimension, it would be a line (and with zero
dimensions, a point). Although our universe only has three spacial
dimensions (ignore theoretical physics for a moment), there is actually
no reason why it can't be any other number, and so you can go the other
way. A four-dimensional analogue of a cube is a tesseract, and when
generalized for any number of dimensions it's called a hypercube.

Of course, it's really hard to imagine anything with more than three
dimensions, which is precisely why I wrote this library. The screenshot
in the link shows a three-dimensional cross-section of a six-dimensional
hypercube at a particular angle. So far, all the library can draw is a
scene with one hypercube (although you can position the camera anywhere
you want), but I'm planning to add support for complex scenes where you
can put various kinds of shapes with arbitrary transformations and
materials (color and opacity at least).
Rouslan Korneychuk, Oct 2, 2013

2. ### Rouslan KorneychukGuest

On 10/04/2013 04:23 PM, Tony the Tiger wrote:
> On Wed, 02 Oct 2013 17:05:32 -0400, Rouslan Korneychuk wrote:
>
>> game

>
> Sorry, but that sounds awful. I hate games.
>

This... isn't a game or even related to gaming. Is it because of the use
of Pygame that you thought it was. I use Pygame because it's a wrapper
for SDL, which gives you cross-platform graphics, input and even thread
support, and because the additional drawing and font modules are useful
for prototyping and implementing user-interfaces for navigating
higher-dimensional space.

The point of this was to explore the concept of hyperspace, which is a
mathematical curiosity and also has relevance in theoretical physics.

One idea I had for this was to simulate some sort of 3D scene involving
physics (probably in another program, such as Blender), take the
resulting coordinates of the geometry at every time interval and plot it
as one 4D static scene. Every pair of connected vertexes would be
extruded from one instant in time, to the next, so each object is a
continuous 4D extrusion. When viewing with your local XYZ axes aligned
with the global XYZ axes, you would see one instant of the scene as
normal. Moving along the fourth axis, which I'll call T, will let you
see the same, earlier or later in time, but if you rotate parallel to
the T axis, you will effectively replace one of X, Y or Z with T. In
essence you will turn the time axis into a spacial axis and the spacial
axis into a time axis.

Looking at a scene with space and time lumped into one 4D space might
help in trying to better understand time, why it's different, and its
relationship with space.

I was also wondering about general relativity. I'm not going to go into
too much detail, but basically: if an object with synchronized clocks on
either end of it, passes by a static observer while traveling near the
speed of light, to the outside observer, the object will appear shorter
and the clocks will appear desynchronized, and from the object's
perspective, it is the outside observer that becomes distorted this way.
I was wondering if this seemingly strange effect is actually the natural
consequence of a simple geometric transformation, such as rotation into
the time axis.
Rouslan Korneychuk, Oct 5, 2013

3. ### Chris AngelicoGuest

On Sat, Oct 5, 2013 at 10:17 AM, Rouslan Korneychuk <> wrote:
> The point of this was to explore the concept of hyperspace, which is a
> mathematical curiosity and also has relevance in theoretical physics.

I don't have any actual use-case for what you've done, but it sure
sounds cool! Having worked with 3D ray-tracing (with POV-Ray), I'm
slightly in awe of the possibility of going to ten dimensions... yup,
cool!

ChrisA
Chris Angelico, Oct 5, 2013
4. ### Rouslan KorneychukGuest

On 10/04/2013 09:41 PM, Chris Angelico wrote:
> On Sat, Oct 5, 2013 at 10:17 AM, Rouslan Korneychuk <> wrote:
>> The point of this was to explore the concept of hyperspace, which is a
>> mathematical curiosity and also has relevance in theoretical physics.

>
> I don't have any actual use-case for what you've done, but it sure
> sounds cool! Having worked with 3D ray-tracing (with POV-Ray), I'm
> slightly in awe of the possibility of going to ten dimensions... yup,
> cool!
>

Thanks. For a while, I was worried nobody else thought it was interesting.

It's funny that you say that about ten dimensions, considering I was
thinking I should add scroll bars to the example script so the controls
don't get cut off when going to 100 dimensions.
Rouslan Korneychuk, Oct 5, 2013
5. ### 88888 DihedralGuest

On Saturday, October 5, 2013 8:17:52 AM UTC+8, Rouslan Korneychuk wrote:
> On 10/04/2013 04:23 PM, Tony the Tiger wrote:
>
> > On Wed, 02 Oct 2013 17:05:32 -0400, Rouslan Korneychuk wrote:

>
> >

>
> >> game

>
> >

>
> > Sorry, but that sounds awful. I hate games.

>
> >

>
>
>
> This... isn't a game or even related to gaming. Is it because of the use
>
> of Pygame that you thought it was. I use Pygame because it's a wrapper
>
> for SDL, which gives you cross-platform graphics, input and even thread
>
> support, and because the additional drawing and font modules are useful
>
> for prototyping and implementing user-interfaces for navigating
>
> higher-dimensional space.
>
>
>
> The point of this was to explore the concept of hyperspace, which is a
>
> mathematical curiosity and also has relevance in theoretical physics.
>
>
>
> One idea I had for this was to simulate some sort of 3D scene involving
>
> physics (probably in another program, such as Blender), take the
>
> resulting coordinates of the geometry at every time interval and plot it
>
> as one 4D static scene. Every pair of connected vertexes would be
>
> extruded from one instant in time, to the next, so each object is a
>
> continuous 4D extrusion. When viewing with your local XYZ axes aligned
>
> with the global XYZ axes, you would see one instant of the scene as
>
> normal. Moving along the fourth axis, which I'll call T, will let you
>
> see the same, earlier or later in time, but if you rotate parallel to
>
> the T axis, you will effectively replace one of X, Y or Z with T. In
>
> essence you will turn the time axis into a spacial axis and the spacial
>
> axis into a time axis.
>
>
>
> Looking at a scene with space and time lumped into one 4D space might
>
> help in trying to better understand time, why it's different, and its
>
> relationship with space.
>
>
>
> I was also wondering about general relativity. I'm not going to go into
>
> too much detail, but basically: if an object with synchronized clocks on
>
> either end of it, passes by a static observer while traveling near the
>
> speed of light, to the outside observer, the object will appear shorter
>
> and the clocks will appear desynchronized, and from the object's
>
> perspective, it is the outside observer that becomes distorted this way.
>
> I was wondering if this seemingly strange effect is actually the natural
>
> consequence of a simple geometric transformation, such as rotation into
>
> the time axis.

Use the synchronous digital logics
with a globbal clock by iterators of
various actions for this kind of
projects in Python.

Please check myHDL and Python.
auto-
88888 Dihedral, Oct 5, 2013
6. ### Peter PearsonGuest

[OT] Re: Hyper-spacial ray-tracer

On Fri, 04 Oct 2013 20:17:52 -0400, Rouslan Korneychuk <> wrote:
[snip]
> I was also wondering about general relativity. I'm not going to go into
> too much detail, but basically: if an object with synchronized clocks on
> either end of it, passes by a static observer while traveling near the
> speed of light, to the outside observer, the object will appear shorter

[snip]

That's special relativity, not general relativity. Python is
very sensitive to that distinction.

--
To email me, substitute nowhere->spamcop, invalid->net.
Peter Pearson, Oct 5, 2013
7. ### Rouslan KorneychukGuest

Re: [OT] Re: Hyper-spacial ray-tracer

On 10/05/2013 11:26 AM, Peter Pearson wrote:
> On Fri, 04 Oct 2013 20:17:52 -0400, Rouslan Korneychuk <> wrote:
> [snip]
>> I was also wondering about general relativity. I'm not going to go into
>> too much detail, but basically: if an object with synchronized clocks on
>> either end of it, passes by a static observer while traveling near the
>> speed of light, to the outside observer, the object will appear shorter

> [snip]
>
> That's special relativity, not general relativity. Python is
> very sensitive to that distinction.
>

whoops
Rouslan Korneychuk, Oct 5, 2013