Ham123 Posted May 26, 2009 Share Posted May 26, 2009 So basically this is it, im trying to program a simple game. There is a graph with a circle located on it. Its center is at the origin, and its radius is any number you want. lets call it x. There is a radius drawn from the center to any random point on the circle. for this example, lets say the radius is 8, and the intersection is at (6, 2*sqrt7) The second intersection is at (0,8) How would one find out the degrees (or distance) along the circle from the first point, to the second? Link to comment Share on other sites More sharing options...

dantay9 Posted May 26, 2009 Share Posted May 26, 2009 (edited) You can use trigonemetric ratios to find the degrees. Cos(X) = 6/8. X is your degrees. Edited June 9, 2009 by dantay9 Link to comment Share on other sites More sharing options...

Mat Posted May 26, 2009 Share Posted May 26, 2009 Well. If you want a more long winded method than dantays, try this out.We have a triangle wherePoint a = 0,0Point b = 6, sqrt (11)Point c = 0, 8from there we know the sidesc = sqrt (6^2 + sqrt (11) ^ 2) = sqrt (36 + 11) = sqrt (47)b = 8a = sqrt (6^2 + (8 - sqrt (11)) ^ 2) = sqrt (36 + (8 - sqrt (11)) ^ 2)We know know all the sides of a triangle. Use my very nice triangle calculator (or the cosine rule). you should getA = 61.07°B = 66.91°C = 52.02°If you want the maths...Cosine rule:cos A = (b^2 + c^2 - a^2) / 2bcA = acos( (( 8 ^ 2) ^ 2 + 47 - (36 + (8 - sqrt (11) ^ 2))) / 2 * 8 * sqrt (47))which gives an error I give up. but you get the idea! when I am in the mood I'll try to find out where I went wrong.MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...

Ham123 Posted May 26, 2009 Author Share Posted May 26, 2009 Well. If you want a more long winded method than dantays, try this out.We have a triangle wherePoint a = 0,0Point b = 6, sqrt (11)Point c = 0, 8from there we know the sidesc = sqrt (6^2 + sqrt (11) ^ 2) = sqrt (36 + 11) = sqrt (47)b = 8a = sqrt (6^2 + (8 - sqrt (11)) ^ 2) = sqrt (36 + (8 - sqrt (11)) ^ 2)We know know all the sides of a triangle. Use my very nice triangle calculator (or the cosine rule). you should getA = 61.07°B = 66.91°C = 52.02°If you want the maths...Cosine rule:cos A = (b^2 + c^2 - a^2) / 2bcA = acos( (( 8 ^ 2) ^ 2 + 47 - (36 + (8 - sqrt (11) ^ 2))) / 2 * 8 * sqrt (47))which gives an error I give up. but you get the idea! when I am in the mood I'll try to find out where I went wrong.MDieselthank you for this, however, i think you guys misunderstood my question. i mean the distance along the circle from point to point. but its all good, i figured it out, going to use atan for it Link to comment Share on other sites More sharing options...

Malkey Posted May 26, 2009 Share Posted May 26, 2009 So basically this is it, im trying to program a simple game. There is a graph with a circle located on it. Its center is at the origin, and its radius is any number you want. lets call it x. There is a radius drawn from the center to any random point on the circle. for this example, lets say the radius is 8, and the intersection is at (6, 2*sqrt7) The second intersection is at (0,8) How would one find out the degrees (or distance) along the circle from the first point, to the second?This appears to work. ; $x1 = 0; First x position $x2 = 6; Second x position $Radius = 8 #cs $ang1 = ACos($x1/$Radius) ConsoleWrite($ang1*180/(4 * ATan(1)) & @CRLF) $ang2 = ACos($x2/$Radius) ConsoleWrite($ang2*180/(4 * ATan(1)) & @CRLF) $deg = abs($ang2 - $ang1)*180/(4 * ATan(1)) ; eg. in degrees if angle difference was 90deg, $ratio would equal 90/360 i.e. 1/4 of the perimeter of the circle $ratio = abs($ang2 - $ang1)/(8 * ATan(1)) ; Note (4 * ATan(1)) = Pi $ArcLength = 8 * ATan(1) * $Radius * $ratio; 2*Pi*radius*Ratio #ce $deg = Abs(ACos($x2 / $Radius) - ACos($x1 / $Radius)) * 180 / (4 * ATan(1)) $ArcLength = 8 * ATan(1) * $Radius * Abs(ACos($x2 / $Radius) - ACos($x1 / $Radius)) / (8 * ATan(1)) MsgBox(0, "", "Degree difference = " & Round($deg, 4) & @CRLF & "Arc length = " & Round($ArcLength, 4)) ; Link to comment Share on other sites More sharing options...

## Recommended Posts

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account## Sign in

Already have an account? Sign in here.

Sign In Now