# 4D Building Blocks

## The Game

You are presented a four dimensional scene, containing some objects (on the main screen).
(If you are not familiar with 4D concepts, please read first the introduction at the end.)

• Your objective is to combine the given objects yielding the goal.
• You can choose a different scene with goal in the "objectives" menu (the previous scene and goal is then discarded).
• By toggling "goal" you switch between seeing the scene and seeing the goal.
• You can cycle through selecting the different objects, with the corresponding buttons.
• The selected object is marked with a small dot in its center, don't be surprised if the placement is somewhat odd sometimes.
• You can combine all objects, touching the currently selected object facet by facet, with the combine-button.
• Assistingly you can see the coordinates of the axes (x,y,z,w) of the small dot in the Object Control Panel.

Every action in the object control can also be performed by keystroke, the concept is as follows:

## The 4D 4-finger keyboard system

With the 4 fingers of the left hand you control the objects and with the 4 fingers of the right hand you control the cameras. Normally the left 4 fingers are placed at a,s,d,f and the right 4 fingers are placed at j,k,l,; (on a US keyboard). Each finger is responsible for one 4 dimensional direction:

1. the pointing finger: x-Axis
2. the middle finger: y-Axis
3. the ring finger: z-Axis
4. the little finger: w-Axis

So pressing the corresponding finger moves the selected object along the specified axis. Pressing shift provides for moving in the opposite direction. The row on the keyboard above the just described middle row is responsible for 4 dimensional rotation. The fingers on the left hand rest on the keys q,w,r,t and the fingers on the right hand rest on the keys u,i,o,p. Each 4D rotation can be specified by two axes determining the rotation plane. The rotation is about moving the first axis to the second axis. In the same way you specify the rotation with your 4 fingers. For example first pressing the pointing finger (r), holding and pressing the small finger (q) provides for a rotation of the selected object from x to w.

For the not so extraordinary operating you can also use the cursor keys for moving the objects: left-right for x-axis, down-up for the y-axis, shift down-up for the z-axis and shift left-right for the w-axis. There is also the possibility to rotate the camera with the cursor keys by holding ctrl. The remaining keys are as follows:

• Use the keys x/v to select the previous/next object.
• Use the key c to combine the selected object with all bordering objects.
• Use g to toggle viewing the goal.
• Use h for resetting the view.
• z and Z for zoom-in and zoom-out
• Use t for toggling showing the tetrahedral
• Use 3 or 4 for switching to 3D or 4D camera movement respectively
• b cycles through the 3 modes of (4d) occlusion allowance (none, backface culling, complete occlusion culling).

## The Camera control

We use the following view model: There is a 4D scene and a 4D camera. The 4D camera projects the 4D scene to its 3D film/projection area. Depending on the viewing mode this 3D area is recreated behind your screen from the viewpoint of a 3D (stereo) camera.

Generally the left mouse button is for rotation and the right mouse button for translation. Drag the mouse with the respectively pressed button and you will see the results. Left mouse button with shift is zoom.

You have perhaps already noticed that in the camera3/4d control panels two 2-axis elements are underlined. Per default xz and yw is underlined on the 4d camera control panel and xz and yz on the 3d camera control panel. The first underlined element corresponds to the rotation when dragging the mouse left-right and the second corresponds to the rotation that is performed when dragging the mouse down-up. Whether rotation of the 3d or 4d camera is performed depends on the corresponding switch. Also you can adjust there whether you mean rotation regarding the space axis (sys) or regarding the camera axes (cam).

For shifting the camera similarly two axes in the camera control panels are selected. The translation along the first selected axis corresponds again to the left-right movement of the mouse and the second selected axis corresponds to the down-up movement of the mouse.

## The view modes

Per default the red/cyan mode is presented to you, if you have no red/cyan glasses, choose another mode via the "view" menu. The following modes are available to you.

"flat"
This is the most undesirable mode for viewing 4D scenes. Nonetheless every one with at least one eye is able to use it. Use it only if every other method fails for you in the moment.
"parallel eye"
If you have no difficulties to see the depth in magic eye pictures probably you are able to use this mode or the crossed-eye mode. You cannot determine absolute depth in that mode. Because the eyes are parallel, the focus angle cannot be used to determine the depth. Simply focus the eyes to infinity behind the screen. Though its not as accurate as the anaglyph mode, I like its brilliance.
"crossed eye"
This mode is untested because I am unable to use it. So theoretically focus your eyes in front of the screen (if necessary take a pencil to focus on) so that the two pictures overlap and melt. Use the adjustment screen to verify your viewing results.
"red/cyan" or anaglyph
Take red/cyan glasses (you can get cardboard-framed ones for less than a dollar) and enjoy this stunning virtuality!

Note that you should use the adjustment screen to get an optimal viewing experience. You should size the 1cm or 1" square to that size (by operating the vertical and horizontal screen resolution).

### Perspectives and Projections

There are some different methods how to map 3D objects to a pictorial. Most of them have 4D counterparts.

Perspective Projection
This is the most natural projection, which we can find on photographs for example. Objects in the background are depicted smaller than objects in the foreground. Parallel depth lines join in one point in the picture.

One drawback of the perspective projection is that we cannot easily conclude the real lengths due to the depth shortening. Of course no projection can preserve all lengths but it is already of much help to preserve the lengths (or at least the ratio to the original) parallel to the axes of the coordinate system, especially for rectangular shapes as in technical drawing or (this) computer game. Those projections are called axonometric projections (for further information see here).

To achieve this, one first defines the image of the trihedral on the picture (i.e. three vectors `u,v,w` attached to a point `o`). Then every point with the coordinates `(x,y,z)` is mapped to the point `o+x*u+y*v+z*w` on the picture. This is the same as if we apply the 2x3 matrix `(u,v,w)` to the vector (x,y,z)T plus `o`, i.e. it is equivalent to being an affine transformation from 3D to 2D.

Each axonometric projection has a viewing axis, that is the axis mapped to `o`. Depending on the length ratio of the `u,v,w` one categorizes the axonometric projection into isometric, dimetric and trimetric projections. Typical used axonometric projections are (we give ratios between the length of `u,v,w` and the angles from `(0,1)` to `u,v,w`):

 30° Isometric Perspective isometric 1:1:1 30°/90°/150° Military Perspective isometric 1:1:1 45°/90°/135° Cavalier Perspective dimetric 2:2:1 0°/90°/45° Chinese Perspective dimetric 2:2:1 0°/90°/30°

On the other hand we have parallel projections and orthogonal projections. Parallel projection: (parallel) rays mapping the object to the canvas. Orthogonal projection: The rays hit the canvas perpendicular.

When asking which axonometric projections is useful for four dimensions, we note that (except for scaling) the 30° isometric perspective is the only one that is a orthogonal projection (with the eye looking from `(1,1,1)` to `(0,0,0)`). And the cavalier perspective is the only one that leaves all except the last axis untouched and the last axis has the same angle to each other axis in the image. (Though this is true for the military projection with the y-axis too.) Both descriptions can easily be extended to `n` dimensions. And so we do to 4 dimensions (while we always use perspective projection for 3D).

The axonometric projections all use a fixed viewing angle so 4D rotation is disabled with them.

## Introduction

For a really recommendable introduction look at the 4D Visualization Page. As a starting point have also a look at Wikipedia's 4th dimension. There is also a great educational movie about 4 dimensional space. The rest of this chapter is only a quick patch introduction.

In opposite to the most spread idea of the time being the 4th dimension we consider here a truly 4 dimensional space, that is with 4 orthogonal space axes. Of course in our physical space we cannot put 4 axes together so that each is orthogonal to each other. On a paper we similarely can not draw 3 orthogonal lines but anyway most pictures show 3 dimensional content. Maybe a four dimensional beeing uses its pictures (i.e. 3 dimensional cuboids) to depict 4 dimensional content. And so we will do.

The four dimensional space is the straight forward generalization of the movement from 0 to 1 to 2 to 3 dimensions. So most questions for 4 dimensions can be answered when looking at the relation of the 2 (flatland) and 3 dimensional (our physical) space. Let us clarify the following questions:

What happens if a 4D sphere is pushed through our space?
Not yet explained.
What are rotation axes in 4D space?
In 2 dimensions we have a rotation center. In 3 dimensions we have a rotation axis. In 4 dimensions we have a rotation plane. But we don't need that many axes to describe a rotation. Given to different directions there is in each dimension a uniquely determined rotation transforming the first direction into the second. In general a rotation is a length and orientation preserving geometric transformation, or in other words where the determinant of the transformation matrix is 1.
What does a 4 dimensional cube look like?
Not yet explained.
How many and what platonic solids are there in 4D space?
See The Platonic Solids in 4D (By Paul Bourke) and further Uniform Polytopes in 4D (By George Olshevsky).
Does a four dimensional space really exists?
Not yet explained.

There are useful other resources in the web to learn about 4D. You may want to have a look at (Sorted more or less from introductory to advanced):