circles + archs
Author 
Message 
JSBN

Posted: Thu May 08, 2003 11:57 am Post subject: circles + archs 


i am getting pissed off, so i thought i'd ask. I need to get a circle to move in an arch. can someone give me some pionters?
problem is that after a short period of time it starts to move too quickly :/ 





Sponsor Sponsor



Tony

Posted: Thu May 08, 2003 12:04 pm Post subject: (No subject) 


use trig to find your new location.
SOH CAH TOA
or you could use a circle equation... x^2 / Rx + y^2 / rY = 1
Radius remains the same, X is determined by forloop, solve for y and you got your new position...
Though that would work for 0 to 180 degrees... use trig if you wanna move further. 
Tony's programming blog. DWITE  a programming contest. 




Homer_simpson

Posted: Thu May 08, 2003 12:45 pm Post subject: (No subject) 


I dunno if this is what yer askin for... =/
code:  View.Set ("offscreenonly")
var y := 0
var a, b, c := 0.0
a := .001
b := 0
c := 50
for x : 320 .. 320
y := round (a * ((x + b) ** 2) + c)
drawfilloval (x + 320, y, 10, 10, 9)
View.Update
delay (10)
cls
end for 






JSBN

Posted: Thu May 08, 2003 6:22 pm Post subject: (No subject) 


yes, but i need it to go faster and for 90o (bottom to mid top)
+10 bits for helping a mod 





Homer_simpson

Posted: Thu May 08, 2003 6:56 pm Post subject: (No subject) 


i guess this is as fast as it can be...
code:  View.Set ("offscreenonly")
var yy, y := 0
var a, b, c := 0.0
a := .00099
b := 0
c := 0
for x : 0 .. 640
y := round (a * ((x + b) ** 2) + c)
%remove this loop to make it faster
for xx : 0 .. 640
yy := round (a * ((xx + b) ** 2) + c)
drawdot (xx, yy, 12)
end for
%remove this loop to make it faster
drawfilloval (x, y, 10, 10, 9)
View.Update
cls
end for







Homer_simpson

Posted: Thu May 08, 2003 6:58 pm Post subject: (No subject) 


oooooooh sorry=(
nvm the last post try this one u can make it go as fast as u want
code:  var yy, y := 0
var a, b, c := 0.0
a := .00099
b := 0
c := 0
for x : 0 .. 640 by 5 % this is the speed
y := round (a * ((x + b) ** 2) + c)
%remove this loop to make it faster
for xx : 0 .. 640
yy := round (a * ((xx + b) ** 2) + c)
drawdot (xx, yy, 12)
end for
%remove this loop to make it faster
drawfilloval (x, y, 10, 10, 9)
View.Update
cls
end for 






Asok

Posted: Thu May 08, 2003 8:03 pm Post subject: (No subject) 


hehe JSBN, homer just figured out a nice chunk of your ISP for you. Be sure to give him credit in your ISP. 





JSBN

Posted: Fri May 09, 2003 11:17 am Post subject: (No subject) 


yeah, will do, thx alot man 





Sponsor Sponsor




