Author Topic: I am back...  (Read 9982 times)

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
I am back...
« Reply #15 on: November 20, 2005, 11:40:11 AM »
Quote
as soon as a bot reaches the 'border' or strays across it by some tiny amount
[the smaller interval the better] ...
ie ... (x^2)+(y^2)>radius^2 by some small amount ...
do you not know it's exact position and can you not calculate the angle from the
center of the field at which this occurs?
in fact ... no need to calculate the angle is there?
if the interval is small enough, (guess it would be the bots' velocity)
then why not simply swap x and y polarity ...
thereby placing the bot in the opposite quadrant ...
and allow the next velocity displacement to carry it back inside the field?
this make any sense?
is it too simple? ;)
« Last Edit: November 20, 2005, 07:13:27 PM by Griz »
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
I am back...
« Reply #16 on: November 20, 2005, 12:56:12 PM »
NUM SAYED (MY TRANSLATION): YOU NEED TO CHANGE BOTH X AND Y. THEREFOR I SAY DO BOTH OF THE FOLLOWING EACH TIME OR DIE TRYING:

err... ok I goofed
RespownX = feildwith /2 +  (feildwith /2 - X)
RespownY = feildheight /2 + (feildheight /2 - Y)

simplfy:
RespownX = feildwith  - X
RespownY = feildheight  - Y


I NEVER SAYED THIS CODE (EHM 'MATH') WAS CONSISTING OF TWO SEPORATE PARTS.
« Last Edit: November 20, 2005, 01:00:08 PM by Botsareus »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
I am back...
« Reply #17 on: November 20, 2005, 01:11:18 PM »
Quote
That is, Respawn X = some function of current X and Y.

Totaly wrong: see picky:


Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
I am back...
« Reply #18 on: November 20, 2005, 02:17:36 PM »
Quote
Quote
as soon as a bot reaches the 'border' or strays across it by some tiny amount
[the smaller interval the better] ...
ie ... (x^2)+y^2)>radius^2 by some small amount ...
do you not know it's exact position and can you not calculate the angle from the
center of the field at which this occurs?
in fact ... no need to calculate the angle is there?
if the interval is small enough, (guess it would be the bots' velocity)
then why not simply swap x and y polarity ...
thereby placing the bot in the opposite quadrant ...
and allow the next velocity displacement to carry it back inside the field?
this make any sense?
is it too simple? ;)
That sounds right actually, assuming you're centered at 0,0 (and you're circular instead of elliptical, I think).

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
I am back...
« Reply #19 on: November 20, 2005, 02:23:22 PM »
Bots, I don't think your math is right for the simple reason that:

suppose width and height = 200 (that is, a circle with radius 100)

Assume a point at 45 degrees on the cusp of out of bounds.  It's coordinates are: (sqr(2)/2*100, sqr(2)/2*100) = (70.7, 70.7)

By your equation, this then becomes:

X = 200-70.7 = 129.3
Y = 200-70.7 = 129.3

When it's easy enough to see that it should instead be:

180 + 45 = 225

(cos(225)*100, sin(225) * 100) = (-70.7, -70.7)

Griz's proposed idea of simple flipping the sign works in this case.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
I am back...
« Reply #20 on: November 20, 2005, 03:26:28 PM »
Provided your coordinate system is set with 0,0 at the centre of the circle/elipse then simply switching the polarity of both X and Y is all you will ever need.

Sounds simple enough
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
I am back...
« Reply #21 on: November 20, 2005, 06:30:49 PM »
Quote
Provided your coordinate system is set with 0,0 at the centre of the circle/elipse then simply switching the polarity of both X and Y is all you will ever need.

Sounds simple enough
yes ... with center at 0,0
 
thing is ...
we don't want the bot to stumble ... ie ... miss a step/cycle.

so if ...
wherever in the routine it is determined that a bot is going to be 'out of bounds'
in it's next position ...
BEFORE adding the deltaX and deltaY to it's position ...
swap the polarity the x, y posistion ...
THEN ... add the delta velocities ... and repopulate.
this should put them back within the field ... in the new quadrant ...
without having missed a step.

yes?
no?
« Last Edit: November 20, 2005, 06:33:09 PM by Griz »
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
I am back...
« Reply #22 on: November 20, 2005, 06:42:36 PM »
Quote
Quote
Quote
as soon as a bot reaches the 'border' or strays across it by some tiny amount
[the smaller interval the better] ...
ie ... (x^2)+y^2)>radius^2 by some small amount ...
do you not know it's exact position and can you not calculate the angle from the
center of the field at which this occurs?
in fact ... no need to calculate the angle is there?
if the interval is small enough, (guess it would be the bots' velocity)
then why not simply swap x and y polarity ...
thereby placing the bot in the opposite quadrant ...
and allow the next velocity displacement to carry it back inside the field?
this make any sense?
is it too simple? ;)
That sounds right actually, assuming you're centered at 0,0 (and you're circular instead of elliptical, I think).
I don't see why would it differ.
a circle is an ellipse ...
only one that happens to have zero eccentricity.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
I am back...
« Reply #23 on: November 20, 2005, 07:10:55 PM »
Quote
Quote
Provided your coordinate system is set with 0,0 at the centre of the circle/elipse then simply switching the polarity of both X and Y is all you will ever need.

Sounds simple enough
yes ... with center at 0,0
 
thing is ...
we don't want the bot to stumble ... ie ... miss a step/cycle.

so if ...
wherever in the routine it is determined that a bot is going to be 'out of bounds'
in it's next position ...
BEFORE adding the deltaX and deltaY to it's position ...
swap the polarity the x, y posistion ...
THEN ... add the delta velocities ... and repopulate.
this should put them back within the field ... in the new quadrant ...
without having missed a step.

yes?
no?
a modification of the above:

this all depends upon the relative magnitude of bot velocity vs field width.
if the bot's delta v is small compared to the field width ...
it isn't going to ever be way 'out of bounds'.
so it really doesn't make much difference if we fudge a bit on exactly where we repopulate or if it 'misses a step'.
how-some-ever ...
if we have some bot screaming thru our enviro ...
then we will need to accurately calculate how far their delta x and y would have
taken them out of bounds ... and accruately calculate how far 'in bounds' we should
then repopulate them on the next cycle.
this can of course be done for every bot that transgresses ...
but it will take computing time.
so it all depends on how willing we are to trade off accuracy for speed ...
or if it is even neccessary to do so.
everything contains some sort of compromise, does it not? ;)

taking a look at priorities is always the first step ...
in establishing/embarking upon ...  any plan of attack.
or so it seems to me.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
I am back...
« Reply #24 on: November 20, 2005, 07:58:16 PM »
Quote
Quote
Quote
Quote
as soon as a bot reaches the 'border' or strays across it by some tiny amount
[the smaller interval the better] ...
ie ... (x^2)+y^2)>radius^2 by some small amount ...
do you not know it's exact position and can you not calculate the angle from the
center of the field at which this occurs?
in fact ... no need to calculate the angle is there?
if the interval is small enough, (guess it would be the bots' velocity)
then why not simply swap x and y polarity ...
thereby placing the bot in the opposite quadrant ...
and allow the next velocity displacement to carry it back inside the field?
this make any sense?
is it too simple? ;)
That sounds right actually, assuming you're centered at 0,0 (and you're circular instead of elliptical, I think).
I don't see why would it differ.
a circle is an ellipse ...
only one that happens to have zero eccentricity.
I menat only that I agree with it for the case of a circle.  An ellipse is less self-obvious to me.  Now that I think about it a little more, I think certain ellipses would work this way and some wouldn't...  I'm not entirely sure.  Geometry isn't my strong suit.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
I am back...
« Reply #25 on: November 20, 2005, 08:16:55 PM »
There is no difference whatsoever between a circle and an elipse as far as these calculations go.

Like giz said, a circle is simply an elipse with zero ecentricity. Just like a square is a rectangle with 4 equal sides
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
I am back...
« Reply #26 on: November 20, 2005, 08:44:19 PM »
Quote
I menat only that I agree with it for the case of a circle. An ellipse is less self-obvious to me. Now that I think about it a little more, I think certain ellipses would work this way and some wouldn't... 
???
in what way?
an ellipse is a pretty simple/basic representation of a specific 2D spatial relationship.
what 'transformation' could you apply to one that you could not apply to another?

if you come up with it ...
please share, as it will be news to me ...
and I'm always interested in amending/adding to ...
what I think I already know.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
I am back...
« Reply #27 on: November 20, 2005, 11:42:17 PM »
Again, geometry isn't my strong suit.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
I am back...
« Reply #28 on: November 21, 2005, 08:56:33 AM »
Just think of a circle as plotting      
 
X(centre) + X radius * sin(angle) against Y(centre) + Y radius * cos(angle)

All you have to do is apply a different radius in the X and Y directions to get an elipse

You could even use a circular (eliptical) coordinate system if you like. Might be a bit complex though.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
I am back...
« Reply #29 on: November 21, 2005, 10:14:34 AM »
is there really a need to go elliptical?
I understand we want to utilize as much of the screen as possible but ...
how about ...
using as large a circular field as will fit the vertical dimensions of the screen ...
and using the remainder, be it on the left, right or both ...
for the various buttons/sliders for the controls one might want to access.
also ... one could call up something like a graph or robot info ...
and not have them be on top of the field blocking the 'action'.

just a thought ....
as it's seems coding bot placement/movement/repopulating ...
will be less complicated using a simple circle than trying to compensate
for an elliptical field ... ie ... calculating out of bounds/repop, etc.

if you can visulize it ...
using an elliptical field vs a circular one ...
really doesn't utilize that much more of the retangular screen ...
so it becomes a matter of priorities again ...
is the small sacrifice in area worth the less complicated coding ...
or not?

just tossing our ideas for consideration before Nums/PY/whoever
wades into the code. ;)
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]