### Author Topic: 3D in Basic  (Read 2462 times)

0 Members and 1 Guest are viewing this topic.

#### kalan_vod

• LV11 Super Veteran (Next: 3000)
• Posts: 2715
• Rating: +10/-0
##### 3D in Basic
« Reply #15 on: August 31, 2006, 07:39:00 pm »
QuoteBegin-runtogetdone+31 Aug, 2006, 7:46-->
QUOTE (runtogetdone @ 31 Aug, 2006, 7:46)
Here's a http://www.rafb.net/paste/results/eKrD7599.html to some basic 3D formulas that might prove useful
(Thank tr1p1ea for the links, not me

#### Halifax

• LV9 Veteran (Next: 1337)
• Posts: 1334
• Rating: +2/-1
##### 3D in Basic
« Reply #16 on: August 31, 2006, 09:46:00 pm »
sad to say though but the rotation part was to hard to implement for me so maybe someone else can try it.I can not take credit for this because if was taken from the source of Edit3D for TI-89, same with my converted BASIC stuff if was converted from that source file. Also another thing is if you wanted to draw faces then you would have to bubble sort the z axis from lowest to biggest, then the one with the most z value would get it's face drawn in first and so on. SO basically that would be a cover-up routine with the lowest visible solid areas being visible.

This rotation for all axes:
Camera.y = dist * sin(ang_x) ;
Camera.z = dist * cos(ang_x) ;
Camera.z = Camera.z * cos(ang_y) ;
Camera.x = dist * cos(ang_x) ;
Camera.x = Camera.x * sin(ang_y);
//Those are in LCAM, LCAM(1=camera.x and so on
Work_CUBE.z = - Work_CUBE.y * sin(ang_x) + Work_CUBE.z * cos(ang_x)
Work_CUBE.y =  Work_CUBE.y * cos(ang_x)  + intermediate * sin(ang_x)
//rotation around the y axis
Work_CUBE.z = - Work_CUBE.y * sin(ang_x) + Work_CUBE.z * cos(ang_x)
Work_CUBE.y =  Work_CUBE.y * cos(ang_x)  + intermediate * sin(ang_x)
//rotation around the x axis
Work_CUBE.x = Work_CUBE.x * cos(ang_z) - Work_CUBE.y * sin(ang_z)
Work_CUBE.y = Work_CUBE.y * cos(ang_z) + intermediate * sin(ang_z)
//rotation around the z axis

There are 10 types of people in this world-- those that can read binary, and those that can't.