math - Parametric Equation of a Circle in VB.NET -


private sub autoset(angle integer, radius double)     dim degrees integer = angle * (math.pi / 180)     'radius strength of shot * 4, due aiming circle being ~400 pixels     dim setx double = (radius * 4) * (math.cos(angle))     dim sety double = (radius * 4) * (math.cos(angle))     'dim sety double = (radius * 4) * (math.sin(angle))      'center tank     dim tankx double = tankicon.location.x '- 10     dim tanky double = tankicon.location.y '- 5      dim clickx integer = tankx + setx     dim clicky integer = tanky - sety      graphics.fromimage(mainimageframe.image).fillrectangle(brushes.blue, clickx, clicky, 10, 10)     mainimageframe.refresh()     metrolabel3.text = setx     metrolabel4.text = sety   end sub  private sub metrobutton1_click(sender object, e eventargs) handles metrobutton1.click     autoset(angletrackbar.value, powertrackbar.value) end sub 

since i'm not allowed post screen shot, here link screenshot of actual code: http://i.imgur.com/afrrup5.png

assume:

powertrackbar.value = 56 angletrackbar.value = 75 

the problem attempting x , y values seen applet on page: http://www.mathopenref.com/coordparamcircle.html. using code above , comparing metrolabel3/4 output wolframalpha same formula manually switching variables number: (56*4) * (cos(75))

i have tried numerous versions of radiantodegree , vice versa functions within code no avail. thing able match wolframalpha when use "radian" function compared normal degree. unable post more screenshots since not have high enough reputation guess you'll have take word use of functions. although manually turn on, append &a=trigrd_r radians or &a=trigrd_d end of wolframalpha url on result page.

the expected result (i assume) of function ~57.97 per degree mode on wolframalpha. actual output current code ~206.47..

i cannot figure out reason vb.net not being able output correct number while wolframalpha capable

you should use formula translate function argument in degrees radians needed sin/cos

dim radiansangle double = degreesangle * (math.pi / 180) 56 * 4 * cos(75) = 224 * cos(1.3 radians) = 224 * 0.26 ~ 58  

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -