## Higher spatial dimensions

A few days ago I had an interesting discussions about the existence of other dimensions. In my experience most people who have heard about Big Bang, relativity or even inflationary theory are unfamiliar with have a vague understating of this concept. Although higher spatial dimensions are extremely easy to understand and even have applications in everyday circumstances.

Most of us are familiar with the idea of flatlanders (thanks to Carl Sagan), 2-dimensional flat creatures that live on a plane, or a surface. A flatlander can never see a 3rd dimension but he can deal with it mathematically. A flatlander can certainly understand points, lines, circles and all other 2D geometrical objects. A flatlander needs 2 piece of information to identify any point in his universe: X and Y. He should have no problem in imagining line-lander creatures who need one piece of information to identify the positions in their universe: X. He can think that his flatland is made of infinite number of line-lands. To make a flatland you have to take a line-land and drag it in a direction orthogonal to it.

Flatlander knows that any position in line-land can be described by:

And any position in flatland can be described by:

Or

Y is a dimension that is unknown to line-landers and is the direction that we dragged the line-land to create a flatland.

We as 3-dimensional creatures can think that our 3D world is made of a flatland, dragged in a direction orthogonal to it. Any position in our world can be described by:

Or

Z is the new direction that is orthogonal to flatland.

You already got the picture, a 4-dimensional creature can drag our volume-land in a direction orthogonal to it to create his 4D world and so on.

(W is the new dimension).

In other words:

A line-lander has no idea of a flatland. The position is only X for him. He describes a 0-land by X.

A flatlander describes a line-land by , a set of s.

A volume-lander describes a flatland by , a set of s

A 4D-lander describes a volume-land by , a set of s.

From elementary mathematics you must remember that a set of objects could be described by a function. For example if is a function defined on real numbers and for each real number that it receives it returns another real number then:

Is the description of a line-land from a flatlander’s point of view.

Other kinds of line-lands include:

And so on.

The line-lander only knows about X. If somebody tells him that his line-land is a part of a flat-land he doesn’t immediately find out what F function describes his line-land the flatland. But F is easily known to the flatlanders who are studying the line-land. Generally F describes the shape of the universe in a higher spatial dimension.

Let’s talk about an interesting example. Assume that the line-land world as it is seen by our flatlanders is a circle. It means that . The poor line-lander has no idea about the 2-dimensional shape of his world but he can find it out.

The line-lander finds out that his world is indeed bounded if he starts walking toward a direction and reaches the starting point.

A sphere is a 3-dimensional circle, F for a sphere is:

Let’s rewrite these two equations in a more usual form:

1D Circle:

2D Sphere:

Look at the pattern:

0D | A Pair of Points | ||

1D | Circle | ||

2D | Sphere | ||

3D | 3-Sphere | ||

ND | N-Sphere |

The surface of a sphere could be described by many circles. The smallest circle at the north pole is a point, the radius of the circles grows as we reach the equator and then again shrinks back to 0 at south pole. This is best described in this form of spherical coordinates:

is a circle. A sphere is a collection of circles stacked on each other. The circles at north and south pole have 0 radius and the radius of the circle at equator is maximum (a). We can think that the radius of these circles change by: . This is orthogonal to (and is in the new dimension).

So describes a sphere.

In the same sense you can think that a circle is made of many pairs of points. At the top of the circle the distance between the pairs is 0, it reaches a maximum in equator and again 0 in the bottom.

Now we can extend this model to higher dimension spheres. Take a 3D sphere with radius 0, increase the radius to a maximum and then shrink it back to 0; you have a 3-sphere.

is a 3-sphere (a 4 dimensional sphere)

This way you can make other higher dimensional shapes. Note that here we only talked about spatial dimensions.

For example a stack of lines in Y-direction makes a square, a stack of flat squares in Z direction makes a cube and a stack of cubes in W direction makes a tesseract.

Take a look at the projection of a tesseract (4D cube) in 3D space here.

## Hollywood Principle

Today I was working on refactoring some names in Hyzobox In/Out API. It is my personal favorite piece of code in the whole platform. In summary it allows the publisher of the game to customize the game in runtime dynamically by injecting codes and executing some functions in the context of the game (In) and to get notified about the events that are occurring inside the game (Out).

Inversion of Control is very natural in JavaScript and it has been used extensively in In/Out API. It’s quite different from popular prototype pattern but most everyday JavaScript programmers use IoC even though they don’t usually notice it.

Here is a sample in our API:

We register an event listener in Hyzobox, waiting for landing view of the game to be loaded:

var hb = Hyzobox.createInstance(); var landingview_loaded = function(hbEvent) { // do something with hbEvent } hb.addEventListener('landingview_loaded', landingview_loaded);

It’s is clear that we don’t have control over when landingview_loaded event will be fired and its handler will be called.

hbEvent argument that is of type Hyzobox.Event has a data attribute that is of type Object. In this example the data is a LandingView instance. We can interact with this object in the event handler:

var landingview_loaded = function(hbEvent) { var view = hbEvent.data; view.inject('a-container-id', 'some text'); };

In this example we are injecting ‘some text’ to an element identified by ‘a-container-id’ inside landing view.

addEventListener() is part of Out and inject() is part of In API. If we want to listen to the events that are occurring inside a particular view, we should register their halnders after the view has been loaded:

var landingview_loaded = function(hbEvent) { var view = hbEvent.data; view.attachEventListener('playNow', function playNowHandler(playNowHbEvent) { // do something with playNowHbEvent }); };

And so on, we can have many nested Ins and Outs.

It’s easy to see that in these examples the control has been transferred to the event handlers. The caller raise the events but it’s the responsibility of the handlers to control the functionalities.

I don’t want to go into the the details now, because the work hasn’t yet been finished on these APIs. Once released, we will post them in Hyzobox documentations and Hyzonia tech blog in the following weeks.

leave a comment