Re: A89: Basic -- 3Dstudio
[Prev][Next][Index][Thread]
Re: A89: Basic -- 3Dstudio
>While finishing up SimTown, l was also beginning work on a sort of 3D program
>which can take data and rotate it and move it so that it can be viewed from
>different angles. This would be good for Basic games that want to have 3D
>perspectives, but for authors who don't want to have to redraw pictures in
>different views that wouldn't look proportional.
I wrote something like this for the 83. I really didn't find any uses for
it though.
>So far what l've got is
>something which just uses sine curves to rotate a line around 360 degrees.
>What l'm planning on doing is enabling
>rotation
>zoom in/out features
>stretch image up-down/left-right
This goes much quicker and easier if you use matrixs. An example take from
Nigel Thompson's "3D Graphics Programing for Windows 95":
Moving a point <x,y,z> in the direction of the vector <a,b,c>
| 1 0 0 a |
| 0 1 0 b | * <x, y, z, 1> = <x+a, y+b, z+c>
| 0 0 1 c |
Rotating a point m degrees around the z axes
| cos(m) sin(m) 0 |
| -sin(m) cos(m) 0 | * <x, y, z> = <x*cos(m)+y*sin(m), -x*sin(m)+y*co(m), z>
| 0 0 1 |
Which makes sense if you remember your matrix multiplication
| a b c | | x | | ax + by + cz |
| d e f | * | y | = | dx + ey + fz |
| g h i | | z | | gx + hy + iz |
This _realy_ simplafies math, plus saves time. Though you don't save time
on single translations (unless you're working in basic) , you save a good
deal of space and multiple translations can be performed with just one
matrix calculation. If you want to move a list of points by <2, 0, 1> and
rotate it around the z axes, you can multiply the two transformation
matrixs, then multiply all of the points by the result.
I did my program in basic, so the 83's vector math really sped the progam
up and made it smaller.
--Nate
References: