Commit d56143b2 authored by Ant01n3's avatar Ant01n3

Bug in the angle of view.

parent 10c0fe6c
......@@ -106,7 +106,7 @@ public class Boid extends AdjacencyListNode {
break;
}
if (!found) {
if (!found && !forces.isVisible(b.particle, this.getPosition())) {
if (toRemove == null)
toRemove = new LinkedList<Boid>();
......
......@@ -412,7 +412,7 @@ public class Context extends AdjacencyListGraph {
public static void main(String... args) {
Context ctx = new Context();
BoidSpecies species = ctx.getDefaultSpecies();
species.angleOfView = -1;
species.angleOfView = 0;
ctx.addAttribute("ui.quality");
ctx.addAttribute("ui.antialias");
......
......@@ -108,6 +108,8 @@ public abstract class Forces {
public void moveBarycenter(Point3 p) {
barycenter.move(p);
}
public abstract boolean isVisible(BoidParticle boid, Point3 other);
/**
* A definition of the forces.
......@@ -264,7 +266,8 @@ public abstract class Forces {
return (d <= source.getBoid().getSpecies().viewZone);
}
*/
protected boolean isVisible(BoidParticle source, Point3 point) {
@Override
public boolean isVisible(BoidParticle source, Point3 point) {
// Check both the distance and angle of view according to the direction
// of the source.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment