AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with math.
Goto page 1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
yoyowazzup
Guest





PostPosted: Wed Jul 02, 2008 12:29 pm    Post subject: Help with math. Reply with quote

First please look at this picture


what i here need to happen is,
change variable of mouse position from the center point (0,0) to (-50,-50)
then next goes to (-50, +50) then (+50,+50), going circle as the red line

i want this done by math calculation, not writing all the coordinates in script myself and thats the problem..
i calculated much but i dont see a good solution here except writing it all down:(

anyone good at math to calculate this in easy way using
+= and/or -=?

any solution is welcome.. thanks!
Back to top
yoowazzup
Guest





PostPosted: Wed Jul 02, 2008 12:30 pm    Post subject: Reply with quote

oops, coordinates of "3" in the pic seems to be wrong, its (+50 +50)
Back to top
yoyowazup
Guest





PostPosted: Wed Jul 02, 2008 1:04 pm    Post subject: Reply with quote

this is order of coordinate it should follow

Code:
-50
+50
+50
+50
-50
-100
-100
-100
-100
-50
+50
+100
+100
+100
+100
+100
+50
-50
-100
-150
-150
-150
-150
-150
.....


and this is the difference of current and next coordinate
Code:
0
+100
0
0
-100
-50
0
0
0
+50
+100
+50
0
0
0
0
-50
-100
-50
-50
0
0
0
0
0
....
Back to top
yoyowazzup
Guest





PostPosted: Wed Jul 02, 2008 1:05 pm    Post subject: Reply with quote

That is for X coordinate, the list is.
Back to top
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 1:09 pm    Post subject: Reply with quote

If you want this done like a circle is one thing... and as a square is a completely different thing... please be more specific with what you want...

Is not the same to have a spiral, a circle, a square or a labyrinth Razz
_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
yoyowazzup
Guest





PostPosted: Wed Jul 02, 2008 1:12 pm    Post subject: Reply with quote

its spiral i think
first coordinate then to next, next next, yes in spiral direction from center
Back to top
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 1:19 pm    Post subject: Reply with quote

Archimedean spiral


Is this what you want?
_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
yoyowazzup
Guest





PostPosted: Wed Jul 02, 2008 1:24 pm    Post subject: Reply with quote

thanks but i bet that doesnt help me
like i said in the first post, i need pointer to get on the coordinate, that is a point, and those points are away from each other.
they can not be connected like THIS spiral in the wiki you gave me.
what i meant by spiral is, going the direction which is similar to spiral way.
square or circle or spiral doesnt really matter here i think..
Back to top
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 1:28 pm    Post subject: Reply with quote

So... basically... you want something like a square spiral... but just the rotation coordinates... well... that can be done...

Give me 5 minutes...
_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 1:52 pm    Post subject: Reply with quote

Well... basically... this is a mechanic that you may use or modify... As it is now... it will generate the corner coordinates. (I started from the first position, because the computer just doesn't know how to divide by 0 Razz

(CODE NOT TESTED)

Code:
x:=-50
y:=-50
cuad:=1
cuad++
if(cuad=5)
cuad:=1
if(cuad=1 || cuad=3)
{
ax:=(x/abs(x))*(-1)
x:=ax*(abs(x)+50)
}
if(cuad=2 || cuad 4)
{
ay:=(y/abs(y))*(-1)
y:=ay*(abs(y)+50)
}

_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
yoyowazup
Guest





PostPosted: Wed Jul 02, 2008 2:00 pm    Post subject: Reply with quote

hmm this didnt work Sad
can you test it pls
Back to top
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 2:02 pm    Post subject: Reply with quote

I had to correct some stuff... check if what you have is what you see now.
_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Jul 02, 2008 2:03 pm    Post subject: Reply with quote

it doesnt go (-50-50)>(-50,+50)>(+50+50) and so on Mad
Back to top
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 2:09 pm    Post subject: Reply with quote

Ups... i just realized what i did wrong.. give me 1 minute
_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
argneo



Joined: 14 Sep 2007
Posts: 220

PostPosted: Wed Jul 02, 2008 2:20 pm    Post subject: Reply with quote

Code:
Esc::ExitApp

F1::
{
x:=-50
y:=-50
cuad:=1
Dist:=50
loop
{
cuad++
if(cuad=5)
{
cuad:=1
}
if(cuad=1 || cuad=3)
{
ax:=(x/abs(x))*(-1)
x:=x+(ax*(abs(x)+dist))
dist:=dist+50
}
if(cuad=2 || cuad=4)
{
ay:=(y/abs(y))*(-1)
y:=y+(ay*(abs(y)+dist))
}
MsgBox, %x%,%y%
}
}return


Test now please
_________________
Search&Replace

Don't use cannon to kill mosquito
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group