# 3D graphics and VR

``` BBS: MOONFLOWER
Date: Thu Mar (22:02)              Number: 151
From: MADRIUS #131 @5092           Refer#: NONE
To:                               Recvd: YES
Subj: 3D graphics and VR             Conf: (5) The Edge-F

Noone seems to be too interested in our project on Virtual Reality,
but
I will continue posting the information around it in case someone out there is
silently writing all this stuff and figuring out stuff on their own.  Please,
if anyone else out there is working on a project and has a breakthrough, post
it!  I want to collaborate my efforts with as many people as I possibly can.
I found out some information on graphically representing 3-dimensional
points that should help a whole lot.  First of all, I need two arrays for some
lineart drawings I'm working on.
The first array is P.  The first dimension is the number assigned to
the point, from (for the purposes of this example) 0-500.  The second
dimension
of P is from 0-2, and is the x,y,or z coordinate.  For example, P(1,0) would
be
the x coordinate of point 1, P(1,1) would be the y coord for point 1, P(1,2)
would be the Z.  P(2,1) would be the y coord for point 2, and so on.
The second array is also two dimensions, the first being the number of
a line, the second being either endpoint 1 or 2 for the line.  i.e. Line 1
would go from the point # stored in L(1,0) to the point # in L(1,1).  So to
draw line 1, we would need to set the variable A to L(1,0) and the variable B
to L(1,1). Then draw a line from (P(A,0),P(A,1),P(A,2)) to
(P(B,0),P(B,1),P(B,2)).
Next we come to the problem of where to display a point with X,Y,and Z
coordinates on a screen that only uses X and Y coordinates.  I found a formula
that does this exact thing...There's a diagram that explains it, but it's kind
of hard to draw it out in ASCII, so I will just list the formula, play around
with it yourself and see how it works in proportion.  Maybe I will draw out
the
diagram as a .GIF and upload it here...The formula is:

Y*D1
new Y=------
D1+Z

Where Y and Z are the Y and Z coords of the point, and D1 is the distance of
the user's eye from the screen.

Now for some ideas on translation.
--Shifting: Really easy, just add or subtract from the X,Y,or Z coordinates of
each point to find the new location, whether you want to shift up, down, left,
right, toward you, or away from you.

--Scaling: Move each point away from the center point of the object

--Rotation: here's some formulas for rotation about each axis (t=angle of
rotation.)

X' = X * COS(T) - Y * SIN(T)
Y' = Y * COS(T) + X * SIN(T)
Z' = Z

X' = X * COS(T) - Z * SIN(T)
Y' = Y
Z' = Z * COS(T) + X * SIN(T)

X' = X
Y' = Y * COS(T) - Z * SIN(T)
Z' = Z * COS(T) + Y * SIN(T)

We now have all kinds of information for representing and changing 3D
objects.  Try playing around with these in your programs and see what you come
up with...

C'mon people, we need to start working on this... Keep VR out of the
hands of government and corporate pigs who have a monopoly on other technology
and will definitely charge a high price for this one!  If we can develop a VR
program and maybe a computer around it, we can all have it, without laws or
restrictions!

:)
```

Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET