| View previous topic :: View next topic |
| Author |
Message |
yoyowazzup Guest
|
Posted: Wed Jul 02, 2008 12:29 pm Post subject: Help with math. |
|
|
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
|
Posted: Wed Jul 02, 2008 12:30 pm Post subject: |
|
|
| oops, coordinates of "3" in the pic seems to be wrong, its (+50 +50) |
|
| Back to top |
|
 |
yoyowazup Guest
|
Posted: Wed Jul 02, 2008 1:04 pm Post subject: |
|
|
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
|
Posted: Wed Jul 02, 2008 1:05 pm Post subject: |
|
|
| That is for X coordinate, the list is. |
|
| Back to top |
|
 |
argneo
Joined: 14 Sep 2007 Posts: 220
|
Posted: Wed Jul 02, 2008 1:09 pm Post subject: |
|
|
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  _________________
Search&Replace
Don't use cannon to kill mosquito |
|
| Back to top |
|
 |
yoyowazzup Guest
|
Posted: Wed Jul 02, 2008 1:12 pm Post subject: |
|
|
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
|
|
| Back to top |
|
 |
yoyowazzup Guest
|
Posted: Wed Jul 02, 2008 1:24 pm Post subject: |
|
|
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
|
Posted: Wed Jul 02, 2008 1:28 pm Post subject: |
|
|
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 |
|
 |
argneo
Joined: 14 Sep 2007 Posts: 220
|
Posted: Wed Jul 02, 2008 1:52 pm Post subject: |
|
|
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
(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 |
|
 |
yoyowazup Guest
|
Posted: Wed Jul 02, 2008 2:00 pm Post subject: |
|
|
hmm this didnt work
can you test it pls |
|
| Back to top |
|
 |
argneo
Joined: 14 Sep 2007 Posts: 220
|
Posted: Wed Jul 02, 2008 2:02 pm Post subject: |
|
|
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 |
|
 |
Guest
|
Posted: Wed Jul 02, 2008 2:03 pm Post subject: |
|
|
it doesnt go (-50-50)>(-50,+50)>(+50+50) and so on  |
|
| Back to top |
|
 |
argneo
Joined: 14 Sep 2007 Posts: 220
|
Posted: Wed Jul 02, 2008 2:09 pm Post subject: |
|
|
Ups... i just realized what i did wrong.. give me 1 minute _________________
Search&Replace
Don't use cannon to kill mosquito |
|
| Back to top |
|
 |
argneo
Joined: 14 Sep 2007 Posts: 220
|
Posted: Wed Jul 02, 2008 2:20 pm Post subject: |
|
|
| 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 |
|
 |
|