Brief program

by Nacho (no login)

Just for you to see a small 3d program. You can experiment with the "funcion", it gets pretty cool drawings
SCREEN 12:CLS:CLEAR
line (0,240)-(640,240),2
line (320,0)-(320,480),2
line (100,479)-(539,0),2
angulo1 = 45

escalareal=2
escala=320/escalareal
salto = 8
color1 = 15
COMIENZO:
angulo = angulo1*3.141593/180 rem radianes
for z1=320 to -320 step (-salto)
for x1=-320 to 320 step salto
x=x1/escala
z=z1/escala
x2 = (x1+salto)/escala
z2 = (z1+salto)/escala

rem esta debe ser la funcion prncipal, de -1 a 1
y = altura (x,z)
y2 = altura (x,z2)
y3 = altura (x2,z)
y4 = altura (x2,z2)
factorb=1 rem 2/3
a = (x*escala)-(z*escala)*cos(angulo)+320
b = 240-((y*escala)*factorb-(z*escala)*sin(angulo))
a2 = (x*escala)-(z2*escala)*cos(angulo)+320
b2 = 240-((y2*escala)*factorb-(z2*escala)*sin(angulo))
a3 = (x2*escala)-(z*escala)*cos(angulo)+320
b3 = 240-((y3*escala)*factorb-(z*escala)*sin(angulo))
a4 = (x2*escala)-(z2*escala)*cos(angulo)+320
b4 = 240-((y4*escala)*factorb-(z2*escala)*sin(angulo))
line (a,b)-(a3,b3),color1
line (a4,b4)-(a2,b2),color1
line (a3,b3)-(a4,b4),color1
line (a2,b2)-(a,b),color1
rem PAINT (a+1,b+1),3

next
next

delay = .1
t! = TIMER
WHILE TIMER - t! < delay! <br> WEND
angulo1=angulo1-1
CLS
GOTO COMIENZO

END

FUNCTION altura (ox,oz)
c = SQR(ABS(2-ox*ox-oz*oz))
rem c = cos(ox+oz)/4+sin(oz*ox)/2-LOG(ABS(ox))
altura = c
END FUNCTION

FUNCTION puntoa (oa)

END FUNCTION

Posted on Nov 8, 2009, 12:20 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
* What does puntoa do? Punt? Cause it does nothing... on Nov 20, 3:51 PM
 How can I see 3D images when I only have 2 eyes? on Dec 30, 11:05 PM
  Depth perceptionunseenmachine on Jan 5, 8:23 AM
   WRONG! on Jan 5, 10:08 AM
    Ok...how aboutunseenmachine on Jan 5, 11:00 AM
     * A few more beers I'll be seeing triple....... on Jan 5, 1:13 PM