Bots and Simulations > DNA - General
How can you approximate sin-1?
Botsareus:
--- Code: ---cond
start
*.xpos 33 cos add *.ypos 33 sin sub angle debugint
stop
end
--- End code ---
PwaPwaPwaPwaaaaown :P
edit:
--- Code: ---Private Sub Form_Load()
Dim ang As Double
ang = 1.1
'MsgBox Sin(ang) & " " & Cos(ang)
'MsgBox (Sin(ang) ^ 2 + Cos(ang) ^ 2) ^ 0.5
'MsgBox Sin(ang) & " " & (1 - Cos(ang) ^ 2) ^ 0.5
'MsgBox Atn(Sin(ang) / ((1 - Sin(ang) ^ 2) ^ 0.5))
mysin = Sin(ang)
'MsgBox Atn(Sin(ang) / ((1 - Sin(ang) ^ 2) ^ 0.5))
yo = 0.5
MsgBox Atn(yo / ((1 - yo ^ 2) ^ 0.5))
End Sub
--- End code ---
MysticalDumpling:
--- Quote from: Shadowgod2 on May 01, 2014, 11:39:50 PM ---i can't help but notice that the equation doesn't factor in the vel of any bot as far as i can tell. this could help.
--- End quote ---
I know. I made a new formula. And *.refvelscalar is sprinkled through both equations.
MysticalDumpling:
My new formula in DB
If Nums is right an arccos ~= 1, then
--- Code: ---1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div 2 pow *.refxpos *.refypos angle 2 pow add 1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div*.refvelscalar mult 2 pow 80 ]1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div 2 pow mult 2 *.refxpos *.refypos angle mult mult div
--- End code ---
Otherwise, it has to be
--- Code: ---22 14 div 1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div 2 pow *.refxpos *.refypos angle 2 pow add 1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div*.refvelscalar mult 2 pow 80 ]1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div 2 pow mult 2 *.refxpos *.refypos angle mult mult div sub 1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div 2 pow *.refxpos *.refypos angle 2 pow add 1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div*.refvelscalar mult 2 pow 80 ]1600 *.refxpos *.refypos angle mult 2 pow *.refvelscalar 2 pow add *.refxpos *.refypos angle *.refvelscalar mult 2 mult *.refaim *.aim sub cos mult 40 *.refvelscalar mult div 2 pow mult 2 *.refxpos *.refypos angle mult mult div 3 pow 6 div sub
--- End code ---
Acck. I hate reverse polish with equations like this. I probably misplaced something imp. :wacko:
Now, how to use the darn thing....
vector math sounds like a good idea.
MysticalDumpling:
While I was typing that post, a conversation happened in real time. I have never seen anything like it before...
Shadowgod2:
it happens :P
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version