How to Draw Four Dimensional Figures
67
In this article we will see how to draw a 2- dimensional representation of 4- dimensional objects.
Fig. 1 shows the x-axis or number line. This is a single dimension. Any point on the line is represented by a single number (+x or -x) that indicates its distance from the origin (0).
Fig. 3 shows the x,y plane, indicted by a square that contains the x,y axes of 2-D space. These axes are 90O to each other. Any point on the plane is located by two numbers (x,y). X is the distance from the y-axis to the point. Y is the distance from the x-axis to the point. The 2-D coordinate system is a single plane.
Any point in 3-D space is located by 3 numbers (x,y,z). The 3-D coordinate system consist of 3 planes. Here these planes are indicated by squares and they are each 90O to each other. Because we are viewing the planes at an angle and their image is flatten to the 2-D surface of the page, the squares do not look like squares and the angles do not appear to be 90O. However, we are use to seeing squares at an angle and can accept the drawing as representing 3 perpendicular squares.
The 4-D coordinate system consist of 6 planes. This equals all the paired combinations of the axes, xy, xz, xw, yw, zw and yz. That is the number of combinations of n objects taken r at a time = n!/r!(n-r)! = 4!/2!(4-2)! = 24/4 = 6.
Just as the 3-D planes appear distorted when projected on a 2-D surface, these planes in 4 dimensions are even more distorted when projected on a 2-D surface. Fig. 7 shows the 2-D projection of the 6 planes that described 4-D space. Any point in 4-D space is located by 4 numbers (x,y,z,t). A representation of 4-D space is like a time exposed photo since each 3-D section occurs at a each different instant in time. This 4-D space is the Minkowski space when the Lorentz transformations are used with this coordinate system.
In analectic geometry there are two combined equations used for rotating all the 2D points in an object by the angle q, on the x,y plane. These equations are
x’ = x*cos q – y*sin q and
y’ = x*sin q +y*cos q.
Using the equations for the 3-D figure
By expanding these two equations into 6 equations and using points indcated by 3 numbers, produces a 2D representation of a 3D object. When one plane is rotated the whole figure is rotated by the same amount. By using 3 different angles of rotation this representation of a 3- dimensional object can be viewed from any angle.
Algorithm that produces the 3D effect
XA=X*COS(A1)-Y*SIN(A1):
YA=X*SIN(A1)+Y*COS(A1)
XB=XA*COS(A2)-Z1*SIN(A2)
ZA=XA*SIN(A2)+Z1*COS(A2)
ZB=ZA*COS(A3)-YA*SIN(A3)
YB=ZA*SIN(A3)+YA*COS(A3)
Using the equations for the 4-D figure
By expanding these two equations into 12 equations and using points indcated by 4 numbers, produces a 2D representation of a 4D object. By rotating any or all of the six planes of the 4D object the representation of a 4- dimensional object can be viewed from any angle.
Algorithm that produces 4D image
ZA=Z*CQS(A1)-W*SIN(A1)
WA=Z*SIN(A1)+W*COS(A1)
YA=Y*COS(A2)-WA*SIN(A2)
WB=Y*SIN(A2)+WA*COS(A2)
XA=X*COS(A3)-ZA*SIN(A3)
ZB=X*SIN(A3)+ZA*COS(A3)
XB=XA*COS(A4)-WB*SIN(A4)
WC==XA*SIN(A4)+WB*COS(A4)
YB=YA*COS(A5)-ZB*SIN(A5)
ZC=YA*SIN(A5)+ZB*COS(A5) :
XC=XB*COS(A6)-YB*SIN(A6)
YC=XB*SIN(A6)+YB*COS(A6)
X2=K*(XC+XC*ZC/800+XC*WC/800)+158:REM adds perspective to x(k=scale)
Y2=0.8*K* (YC+YC*ZC/800+YC*WC/800)+100:REM adds perspective to y(k=scale)
The computer program 4D-CUBE draws the tesseract
This program draws a 2-dimentional representation of a 4-dimentional hypercube. Each of the 16 points or vertices are indicated by 4 numbers. One number for the x-axis, the y-axis, the z-axis and the w-axis. The 32 edges are indicated by drawing a line between two vertices. Fig. 12 & 13 show the hypercube at different degrees of rotation. Fig. 14 shows the hypercube with no rotation around any axis. Because the program has a perspective factor in it fig. 14 appears as 3 connected squares. Without perspective fig. 14 would appear as a single square just as a 3D cube does. In GW Basic the height of the pixels is greater than the width. When figures are viewed on the screen they are taller than they should be. By multiplying the final y by 0.8, these drawings have been adjusted so that the height and the width are proportionally corrected.
4D hypercube and the rotation of each plane
ROTATION OF ZW PLANE 10O
ROTATION OF YW PLANE 20O
ROTATION OF XZ PLANE 30O
ROTATION OF XW PLANE 40O
ROTATION OF YZ PLANE 50O
ROTATION OF XY PLANE 60O
4D hypercube and rotation of planes . . 4D hypercube and rotation of planes
ROTATION OF ZW PLANE 50O . . . . . . . . ROTATION OF ZW PLANE 0O
ROTATION OF YW PLANE 50O . . . . . . . ROTATION OF YW PLANE 0O
ROTATION OF XZ PLANE 50O . . . . . . . . ROTATION OF XZ PLANE 0O
ROTATION OF XW PLANE 0O . . . . . . . . ROTATION OF XW PLANE 0O
ROTATION OF YZ PLANE 0O . . . . . . . . ROTATION OF YZ PLANE 0O
ROTATION OF XY PLANE 0O . . . . . . . . ROTATION OF XY PLANE 0O
The computer program 4D-CUBE in GW Basic
100 CLS:REM 4D-CUBE 110 DIM X(300)
120 DIM Y(300)
130 DIM Z(300)
140 DIM W(300)
150 INPUT "SCALE (suggest 1)";K
160 INPUT "ROTATION OF ZW PLANE IN DEGREES";Al
170 INPUT"ROTATION OF YW PLANE IN DEGREES";A2
180 INPUT "ROTATION OF XZ PLANE INDEGREES";A3
190 INPUT "ROTATION OF XW PLANE IN DEGREES";A4
200 INPUT "ROTATION OF YX PLANE IN DEGREES";A5
210 INPUT "ROTATION OF XY PLANE IN DEGREES";A6
230 A1=A1/57.29577951 converts degrees to radians
240 A2=A2/57.29577951
250 A3=A3/57.29577951
260 A4=A4/ 57,29577951
270 A5=A5/57.29577951
280 A6=A6/57.29577951
290 SCREEN 1,0: CLS:KEY OFF:COLOR 0,1 320 FOR N=I TO 2
330 READ X,Y,Z,W:REM reads data
340 IF X=1.000 THEN 530
350 ZA=Z*CQS(A1)-W*SIN(A1) :REM Algorithm that produces 4D image
360 WA=Z*SIN(A1)+W*COS(A1)
370 YA=Y*COS(A2)-WA*SIN(A2)
380 WB=Y*SIN(A2)+WA*COS(A2)
390 XA=X*COS(A3)-ZA*SIN(A3)
400 ZB=X*SIN(A3)+ZA*COS(A3)
410 XB=XA*COS(A4)-WB*SIN(A4)
420 WC==XA*SIN(A4)+WB*COS(A4)
430 YB=YA*COS(A5)-ZB*SIN(A5)
440 ZC=YA*SIN(A5)+ZB*COS(A5) :
450 XC=XB*COS(A6)-YB*SIN(A6)
460 YC=XB*SIN(A6)+YB*COS(A6)
470 if n=1 then 540
480 X2=K*(XC+XC*ZC/800+XC*WC/800)+158:REM adds perspective to x(k=scale)
490 Y2=0.8*K* (YC+YC*ZC/800+YC*WC/800)+100:REM adds perspective to y(k=scale)
500 NEXT N
505 IF W=40 THEN 1000: REM highlights one 3D cube
510 LINE (X1, Y1)-(X2,Y2),3:REM draws figure
520 GOTO 320
530 END
540 X1=K* (XC+XC*ZC/800+XC*WC/800)+158:REM adds perspective to x(k=scale)
550 Y1=0.8*K*(YC+YC*ZC/800+YC*WC/800)+100:REM adds perspective to y(k=scale)
560 GOTO 500
600 DATA -40,-40,40,-40,40,-40,40,-40
610 DATA -40, -40, 40, 40, 40, -40, 40, 40
620 DATA 40,-40,40,-40,40,40,40,-40
630 DATA 40,-40/40,40,40,40,40,40
640 DATA 40,40,40,-40,-40„40,40,-40
650 DATA 40,40,40,40,-40,40,40,40
660 DATA -40,40,40,-40,-40,-40,40,-40
670 DATA -40 ,40. 40, 40, -40, -40, 40, 40
680 DATA -40,-40,-40,-40,40,-40,-40,-40
690 DATA -40, -40, -40, 40, 40, -40, -40, 40
700 DATA 40,-40,-40,-40,40,40,-40,-40
710 DATA 40,-40,-40, 40, 40, 40,-40, 40
720 DATA 40, 40, -40, -40, -40, 40, -40, -40
730 DATA 40,40,-40,40,-40,40,-40,40
740 DATA -40,40,-40,-40,-40,-40,-40,-40
750 DATA -40,40,-40,40,-40,-40,-40,40
760 DATA -40, -40, 40, -40, -40,-40,-40,-40
770 DATA -40,-40,40,40,-40,-40,-40,40
780 DATA 40, -40, 40, -40, 40, -40, -40, -40
790 DATA 40, -40, 40, 40, 40, -40, -40, 40
800 DATA 40, 40,40,-40,40,40,-40,-40
810 DATA 40,40,40,40,40,40,-40,40
820 DATA -40,40,40,-40,-40,40,-40,-40
830 DATA -40, 40, 40,40, 40 , 40, -40, 40
840 DATA -40,-40,40,-40,-40,-40,40,40
850 DATA 40,-40,40,-40,40,-40, 40,40
860 DATA 40,40,40,-40,40,40,40,40
870 DATA -40,40,40,-40,-40,40,40,40
880 DATA -40,-40,-40,-40,-40,-40,-40,40
890 DATA 40,-40, -40, -40, 40, -40, -40, 40
900 DATA 40,40,-40,-40,40,40,-40,40
910 DATA -40,40,-40,-40,-40, 40,-40, 40
920 DATA 1000,1000,1000,1000
1000 LINE(X1,Y1)-(X2,Y2),2
1010 GOTO 320
The computer program 4D-Plane
This program draws a 2-dimentional representation of the six planes of the 4-axes. Fig. 15 shows the six planes and the coordinates in 4D space. A layout like this is helpful before drawing any 4-D figure. By using 6 different angles of rotation this representation of 4- dimensional planes can be viewed from any angle. When all the angles are at zero we see the x.y plane as a square. All the other planes are edge on.
Fig. 15 lays out all the points in the 4D coordinate system. These are used in the computer program 4D-PLANE
In fig. 16 to 18 we see 3D planes are drawn with blue lines, while all the planes containing the w-axis are drawn in red. When we run the computer program the 3D planes are drawn with white lines while all the planes containing the w-axis are drawn in purple. In GW Basic the height of the pixels is greater than the width. When figures are viewed on the screen they are taller than they should be. By multiplying the final y by 0.8, these drawings have been adjusted so that the height and the width are proportionally corrected.
4D planes and the rotation of planes 4D planes and the rotation of planes
ROTATION OF ZW PLANE 0O . . . . . . . . ROTATION OF ZW PLANE 0O
ROTATION OF YW PLANE 0O. . . . . . . . ROTATION OF YW PLANE 0
ROTATION OF XZ PLANE 0O . . . . . . . . ROTATION OF XZ PLANE 30O
ROTATION OF XW PLANE 0O . . . . . . . ROTATION OF XW PLANE 50O
ROTATION OF YZ PLANE 0O . . . . . . . .ROTATION OF YZ PLANE 70O
ROTATION OF XY PLANE 0O . . . . . . . . ROTATION OF XY PLANE 90O
4D coordinate planes and the rotation of each plane
ROTATION OF ZW PLANE 10O
ROTATION OF YW PLANE 20O
ROTATION OF XZ PLANE 30O
ROTATION OF XW PLANE 40O
ROTATION OF YZ PLANE 50O
ROTATION OF XY PLANE 60O
This figure is complex and hard to visulise. To help in the visualization of this figure in fig. 18a it is separated into 2 parts. First are the 3-d planes with the x,y,z axis. Second are the planes containing the w axis.
Computer program 4D-PLANE
100 CLS:REM 4D-PLANE
110 DIM XC300) . 120 DIM Y(300) 130 DIM Z(300) 140 DIM W(300) 150 INPUT "SCALE";K
160 INPUT "ROTATION OF ZW PLANE IN DEGREES";Al
170 INPUT "ROTATION OF WY PLANE IN DEGREES";A2
180 INPUT "ROTATION OF XZ PLANE IN DEGREES"; A3
190 INPUT "ROTATION OF XW PLANE IN DEGREES";A4
200 INPUT "ROTATION OF YZ PLANE IN DEGREES";A5
210 INPUT "ROTATION OF XY PLANE IN DEGREES";A6
230 A1=A1/57. 2957795* :REM converts degrees to radians
240 A2=A2/57.29577951*
250 A3 =A3/57. 29577951*
260 A4=A4/57.29577951*
270 A5=A5/57,29577951*
280 A6=A6/57.29577951*
290 SCREEN 1,0:CLS:KEY OFF:COLOR 0,1
320 FOR.N=1 TO 2
330 READ X,Y,Z,W
340 IF X=1000 THEN 530
350 ZA=Z*COS(A1)-W#SIN(A1):REM algorithms to produce 2D representation of 4D object
360 WA=Z*SIN(A1)+W*COS(A1)
370 YA=Y*COS(A2)-WA*SIN(A2)
380 WB=Y*SIN(A2)+WA*COS(A2)
390 XA=X*COS(A3)-ZA*SIN(A3)
400 ZB=X*SIN(A3)+ZA*COS(A3)
410 XB=XA*COS(A4)-WB*SIN(A4)
420 WC=XA*SIN(A4)+WB*COS(A4)
430 YB=YA*COS(A5)-ZB*SIN(A5)
440 ZC=YA*SIN(A5)+ZB*COS<A5)
450 XC=XB*COS(A6)-YB*SIN(A6)
460 YC=XB*SIN(A6)+YB*COS(A6)
470 IF N=l THEN 540
480 X2=K*(XC+XC*ZC/800+XC*WC/800)+158
490 Y2=0.8*K*(YC+YC*ZC/800+YC*WC/800)+100
500 NEXT N
505 IF W= 40 OR W= -40 THEN 1000
510 LINE (X1,Y1)-(X2,Y2),3
520 GOTO 320
530 END
540 X1=K*(XC+XC*ZC/800+XC*WC/800)+158
550 Y1=0.8*K*(YC+YC*ZC/8OO+YC*WC/800)+100
560 GOTO 500
600 DATA - 40,- 40„0,0 , 40,- 40,0,0
610 DATA 40,- 40,0,0,40,40,0,0
620 DATA 40,40,0,0,-40,40,0,0
630 DATA - 40,40,0,0,- 40,- 40,0,0
640 DATA - 40 ,0,40, 0, 40, 0., - 40, 0
650 DATA 40, 0,- 40,0,40,0, 40,0
660 DATA - 40,0,40,0 , 40,0,40, 0
670 DATA - 40, 0, 40, 0, - 40, 0, - 40, 0
680 DATA 0, - 40, - 40, 0, 0, 40, - 40, 0
690 DATA 0,40,- 40,0,0,40,40,0
700 DATA 0,40,40,0,0, - 40, 40, 0
710 DATA 0,- 40, 40, 0,0,- 40,,- 40,0
720 DATA - 40,0,0,- 40,40,0,0,-40
730 DATA 40,0,0,- 40,40,0,0,40
740 DATA 40,0,0,40,- 40,0,0,40
750 DATA - 40,0.0,40,- 40,0,0,- 40
760 DATA 0,- 40,0,- 40,0,40,0,- 40
770 DATA 0,0, 0, - 40 , 0, 40, 0, 40
780 DATA 0,40.0, 40,.0,40,0,40
790 DATA 0, -40, 0, 40, 0, -40,, 6, - 40
800 DATA 0,0, 40, - 40, 0, 0, - 40, - 40
810 DATA 0,0,40, 40, 0., 0, 40, - 40
820 DATA 0,0, 40, 40, 0, 0, - 40, 40
830 DATA 0,0,- 4,40,0,0,- 40,- 40
840 DATA 40, 0, 0, 0, - 40, 0, 0.0
850 DATA 0,40,0,0,0,- 40,0,0
860 DATA 0,0,40,0,0,- 40,0
870 DATA 0,0,0,40,0,0,0,- 40
920 DATA 1000,1000,1000,1000
1000 LINE (X 1, Y1) – (X2, Y2) , 2
1010 GOTO 320
This program has built in perspective, so that lines more distance from the eye are smaller. To remove this perspective change lines 480, 490, 540, and 550 to;
480 X2=K*(XC)+158
490 Y2=K*(YC)+100
540 X1=K*(XC)+158
550 Y1=K*(YC)+100
This also true for the previous program the 4D-CUBE. The perspective can be removed from that program by the same lines in it.
An approximate 4-D drawing can be made by drawing a 3-D drawing of an object twice. Then connecting the point with lines. Fig. 20 shows the 4-D coordinate system drawn this way.
Fig. 21 shows the 4-D tetrahedron, cube and octahedron drawn this way.
By understanding these principals you can draw all sorts of 4D figures. These can be used to study and understand multiple dimensional systems.
PrintShare it! — Rate it: up down flag this hub









