Qbasicnews.com
December 03, 2021, 12:37:03 PM
 Pages: 1 [2]
 Author Topic: 3d programming  (Read 9515 times)
TheBigBasicQ
*/-\*

Posts: 4550

 « Reply #15 on: February 15, 2004, 05:23:20 AM »

andy, thats some cool code =P.
 Logged
andy
Senior Member

Posts: 175

 « Reply #16 on: February 15, 2004, 09:51:02 AM »

thanks, I'm quite pleased with it myself.
 Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

www.stickskate.com
andy
Senior Member

Posts: 175

 « Reply #17 on: February 21, 2004, 11:34:52 AM »

my program rotates points around the center of rotation, but if I draw a circle it wont work, kind of obviouse I know, but how could I calculate and draw an elpse?
 Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

www.stickskate.com
Oz
I hold this place together

Posts: 923

 « Reply #18 on: February 21, 2004, 12:32:16 PM »

Well.....you could do this

Code:

CONST xRes = xx
CONST yRes = xx
CONST zRes = 200

CONST PI = 3.14159

SCREEN xx

for angle = 1 to 360
ang=angle*PI/180
x = x + rad * sin(ang)
y = y + rad * cos(ang)
'For percision
zm# = zoom/200*10
za#=z/200*10
x = (x / (zm#+za#))+ (xRes\2)
y = (y / (zm#+za#))+ (yRes\2)
pset (x,y),15
next

 Logged
SCM
Wandering Guru

Posts: 311

 « Reply #19 on: February 21, 2004, 11:57:29 PM »

You can generate the points for the elipse like this.
Code:
CONST Pi = 3.1415926, x = 0, y = 1
NumberOfPoints = 100

DIM Elipse (NumberOfPoints, y) AS SINGLE

a = 100          ' Semi-major axis
b = 50           ' Semi-minor axis
Theta = 0

dTheta! = 2 * Pi / NumberOfPoints

For P = 0 to NumberOfPoints
Theta = P * dTheta!     'or Theta = Theta + dTheta!
Elipse(P, x) = a * COS(Theta)
Elipse(P, y) = b * SIN(Theta)
NEXT
 Logged

hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
andy
Senior Member

Posts: 175

 « Reply #20 on: February 24, 2004, 05:42:38 PM »

Can you explain how both of your codes work, and how I could incorperate them.

They look very confusing
 Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

www.stickskate.com
relsoft
*/-\*

Posts: 3927

 « Reply #21 on: February 26, 2004, 04:23:37 AM »

SCM's code is very readable if you know how to convert between polar to cartesian coodinates.