Code center > Suggestions

I am back...

<< < (5/8) > >>

PurpleYouko:
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

Griz:

--- 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
--- End quote ---
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?

Griz:

--- 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?
--- End quote ---
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? ;)
--- End quote ---
That sounds right actually, assuming you're centered at 0,0 (and you're circular instead of elliptical, I think).
--- End quote ---
I don't see why would it differ.
a circle is an ellipse ...
only one that happens to have zero eccentricity.

Griz:

--- 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
--- End quote ---
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?
--- End quote ---
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.

Numsgil:

--- 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?
--- End quote ---
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? ;)
--- End quote ---
That sounds right actually, assuming you're centered at 0,0 (and you're circular instead of elliptical, I think).
--- End quote ---
I don't see why would it differ.
a circle is an ellipse ...
only one that happens to have zero eccentricity.
--- End 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...  I'm not entirely sure.  Geometry isn't my strong suit.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version