04-07-2005, 08:23 PM
By far my best. Coded in FreeBASIC, hopefully it should work in QB (one of the lines might be too long though).
[syntax="QBASIC"]
1 amp! = 25.0
2 if t! = 0.0 then screen 13 else cls
3 line (319, int(((256.0 * amp! * 99.0) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * (250.0 - (100.0 * sin(t! / 6.0))))))))-(0, int(((256.0 * amp! * 99.0) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * (250.0 - (100.0 * sin(t! / 6.0)))))))), 17
4 for x! = -1 to 450 step 5
5 line step-(int(((256.0 * amp! * x!) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * ((250.0 - (100.0 * sin(t! / 6.0))) + (amp! * cos(t! + ((x! * 2.0 * 3.141592654) / 100.0)))))))), int(((256.0 * amp! * (99.0 + (amp! * sin(t! + ((x! * 2.0 * 3.141592654) / 100.0))))) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * ((250.0 - (100.0 * sin(t! / 6.0))) + (amp! * cos(t! + ((x! * 2.0 * 3.141592654) / 100.0))))))))), ((26 - int(((((250.0 - (100.0 * sin(t! / 6.0))) + (amp! * cos(t! + ((x! * 2.0 * 3.141592654) / 100.0)))) - (250.0 - (100.0 * sin(t! / 6.0))) + amp!) / (2.0 * amp!)) * 10.0)) - 100)
6 next x!
7 t! = t! + 0.01
8 if t! >= (12.0 * 3.141592654) then t! = 0.001 else wait &h3da, 8
9 if inkey$ = "" then goto 2
[/syntax]
3D rotating coil, based on a sinusoidal wave; zoom and modified Lambert shading. It even has a reference bar.
Hope you like this one.
-shiftLynx
[EDIT: forgot to remove a comment from the code ]
[EDIT2: slight alteration to make the left-hand-side look a bit tidier]
[syntax="QBASIC"]
1 amp! = 25.0
2 if t! = 0.0 then screen 13 else cls
3 line (319, int(((256.0 * amp! * 99.0) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * (250.0 - (100.0 * sin(t! / 6.0))))))))-(0, int(((256.0 * amp! * 99.0) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * (250.0 - (100.0 * sin(t! / 6.0)))))))), 17
4 for x! = -1 to 450 step 5
5 line step-(int(((256.0 * amp! * x!) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * ((250.0 - (100.0 * sin(t! / 6.0))) + (amp! * cos(t! + ((x! * 2.0 * 3.141592654) / 100.0)))))))), int(((256.0 * amp! * (99.0 + (amp! * sin(t! + ((x! * 2.0 * 3.141592654) / 100.0))))) / (256.0 + (250.0 - (100.0 * sin(t! / 6.0))) + (amp! * ((250.0 - (100.0 * sin(t! / 6.0))) + (amp! * cos(t! + ((x! * 2.0 * 3.141592654) / 100.0))))))))), ((26 - int(((((250.0 - (100.0 * sin(t! / 6.0))) + (amp! * cos(t! + ((x! * 2.0 * 3.141592654) / 100.0)))) - (250.0 - (100.0 * sin(t! / 6.0))) + amp!) / (2.0 * amp!)) * 10.0)) - 100)
6 next x!
7 t! = t! + 0.01
8 if t! >= (12.0 * 3.141592654) then t! = 0.001 else wait &h3da, 8
9 if inkey$ = "" then goto 2
[/syntax]
3D rotating coil, based on a sinusoidal wave; zoom and modified Lambert shading. It even has a reference bar.
Hope you like this one.
-shiftLynx
[EDIT: forgot to remove a comment from the code ]
[EDIT2: slight alteration to make the left-hand-side look a bit tidier]
img]http://www.cdsoft.co.uk/misc/shiftlynx.png[/img]