# Re:3d Graphics

``` BBS: Inland Empire Archive
Date: 03-17-92 (23:56)             Number: 136
From: MARK KO                      Refer#: NONE
To: BOB MURPHY                    Recvd: NO
Subj: Re:3d Graphics                 Conf: (2) Quik_Bas```
```Technical?
Well, I haven't seen this Torus program yet, but I can explain several
methods of producing "3D" graphics.
1) You can use the method of casting shadows to produce 3D like
graphics. For example, it you would look at a skeleton of a cube, it
would appear, from the front, a square in a square. Everything in the
background is just smaller if it can be seen. To use this method, a
point must be chosen where the "light" will originate to cast a shadow.
The formulas below well tell you how to calculate the new x,y
coordinates.

Xnew = (Xold*dis/(dis-Z))
Ynew = (Yold*dis/(dis-Z))
where dis is distance of light source from the object.
You should do these conversions, before converting the coordinates to
screen coordinates.

2) You can also have the computer calculate a sort of top view of a 3-D
object. This can be done very easily. The angle of rotation (verticall0
must be known. Use the following equations.
A = cos(angle), B=sin(angle)
Xnew=Xold
Ynew=(Yold*A - Zcoordinate*B)

That's it. You might have to fool around with the angl to get the
persepective you want. Remember, the angle can also be negative and it

3) If you draw an X on the screen with a vertical line going through
the middle of it, you will see three axes, X, Y, and Z. By the angle,
that each axis makes with a horizontal line, a 3D object can be
displayed. Use the following formulas to calculate the new coordinates.

Xnew = Xold*cos(A) + Yold*cos(B) + Z*cos(C)
Ynew = Xold*sin(A) + Yold*sin(B) + Z*sin(C)

Where A is the angle of the X axis, B is the angle of the Y axis and C
is the angle of the Z axis, all respective to a horizontal line and in

I hope this helps you in your program.

P.S. if you wish to learn how to make stereoscopic drawings to create a
draw three D effect, just ask.

--- RBBSMAIL 17.2A
* Origin: Computer Co-Op RBBS HST, 609-784-9404 Voorhees
NJ (RBBS-PC 1:266/29)
```

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