Login  Register

Re: Calculate angle between two vectors (probably @Igor :)

Posted by Nicolai Hess on Mar 19, 2014; 10:08am
URL: https://forum.world.st/Calculate-angle-between-two-vectors-probably-Igor-tp4749351p4749730.html

2014-03-19 8:49 GMT+01:00 MartinW <[hidden email]>:
Nicolai Hess wrote
> This was of course wrong, I don't know what the
> other method computes, but not the angle between two vectors.

Yes i also wrote a test and i think my method is right.


Nicolai Hess wrote
> Now the question is, why do you think your method is wrong / the boids
> behave wrong?

When i use my method to calculate the field of vision the Boids always fly
from top left to down right and if i turn on the circling option, they crowd
in the bottom right quadrant.
If i give them a 360 degree field of vision by always returning true for
isInFieldOfVision they behave correctly. This means they fly in a nice
circle around the center and if circling is turned off, the swarm flies in
different directions each time you start the simulation.

Perhaps the problem is not the calculation of the angle but is in the
isInFieldOfVision: method...

:) yes and I think the testcases in testIsInFieldOfVision
are wrong, or I misunderstand how the boids are moving.

in testIsInFieldOfVision
subject has velocity 100@0, I understand this as "moves from left to right".
testobject other2 and other3 are above and below subect, and not behind and
in front, both should be visible with the fieldOfView.
Btw. the field of view is rather big, 0.75*Float Pi is 135 degree, but  clock *and* counterclockwise
->  270 degree field of view.


And it is funny to change the field of view to 0, after the boids started.
 



--
View this message in context: http://forum.world.st/Calculate-angle-between-two-vectors-probably-Igor-tp4749351p4749697.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.