Jump to content
Sign in to follow this  

Getting from point A to B in a circle

Recommended Posts

So you have a circle, 360 degrees around. Somewhere in that circle you have point A. This is where "you" are located. You have the X and Y coordinates for location A. You are facing a degree. You need to turn a certain amount of degrees to face point "B", which you also have the X and Y coordinate of.

Thats the problem, anyone know how to solve?






RotationDegree (Which way you are facing): 39 (degrees)

My wild guess is it has to do something with the Tan() function in AutoIt (Or something like that I forgot the name). I'm only in Algebra right now, and I asked everyone I knew and they couldn't figure this out.

Edited by =sinister=

Share this post

Link to post
Share on other sites

What do you need to solve for?

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post

Link to post
Share on other sites

Perhaps it's just me, but that problem is kinda confusing :) Coordinates are relative. So we need to know where the circle is centered.

The equation of a circumference centered at ( a , b ) is:

(x-a)^2 + (y-b)^2 = r^2

and this one is centered at (0,0)

x^2 + y^2 = r^2

Another thing I don't understand is what you mean by "You are facing a degree". Could you do some graphics?

If you have two points that belong to a circumference, it should be quite easy to make the mouse move from point A to B following the circle.

Edited by Nahuel

Share this post

Link to post
Share on other sites

Not trying to do with mouse.

Lets say you are "facing" north, or looking directly north. This is the data I know:

-Degree i'm looking at, or facing.

-The XY Coordinates of where I am standing

-The XY Coordinates of where I need to go

I need to rotate x amount of degrees to face the coordinate I need to go to. Sorry for my bad explanation =P

So basically i'm solving the the x amount of degrees I need to face the B coordinates.

I'll try to make a graphic


Sorry for bad explanation

Edited by =sinister=

Share this post

Link to post
Share on other sites

I think I know what he wants but I forget the math to do it.

He is standing at the outer edge of a circle (at point A) facing the center of the circle. Point B is another point on the outside egde of the circle. How many degrees would he have to turn to be facing point B?

Look at a compass. If he is standing at south(180°) while facing north (0°) and point B is east(90°) then he would have to turn 45° to the right in order to face Point B.


Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver: - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post

Link to post
Share on other sites

why do the points have to be on a circle, that fact changes nothing. There must [i assume] be some significance in that information.

Assuming that information was pointless, we have 2 points on the standard X,Y coordinate plane.

The location of A will be (x1, y1) and the location of B will be (x2, y2)

The rotation of A will be direction

If x1 > x2 Then
  Return 180 - direction + ATan((x1-x2)/(y1-y2))
Else x1 < x2
  Return direction + ATan((x1-x2)/(y1-y2))

I'm not completely sure about the direction part of it, but finding the angle is correct. If you're going to use this, make sure to check if y1 = y2 (Divide by 0).

Edited by crzftx

Share this post

Link to post
Share on other sites

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
Sign in to follow this  

  • Create New...