public abstract class BoidForces extends Object
This object is modified at each computation step to represent the forces applied to a boid particle in the forces system. It is in charge of going down the n-tree used to represent space and collect all the other boids in the field of view that could influence this boid. It then integrates these forces and compute a direction and barycenter (the point the boid tries to reach).
| Modifier and Type | Field and Description |
|---|---|
org.miv.pherd.geom.Vector3 |
attraction
The integrated attraction toward other boids in view at each step.
|
org.miv.pherd.geom.Point3 |
barycenter
The position the boid tries to reach at each step.
|
int |
countAtt
The number of boids we are attracted to.
|
int |
countRep
The number of boids we are repulsed from.
|
org.miv.pherd.geom.Vector3 |
direction
The direction of the boid at each step.
|
org.miv.pherd.geom.Vector3 |
repulsion
The integrated repulsion from the other boids in view at each step.
|
| Constructor and Description |
|---|
BoidForces(Boid b)
Forces all set at zero.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttraction(org.miv.pherd.geom.Vector3 att)
Integrate an attraction vector.
|
void |
addDirection(org.miv.pherd.geom.Vector3 dir)
Integrate a direction influence.
|
void |
addRepulsion(org.miv.pherd.geom.Vector3 rep)
Integrate a repulsion vector.
|
void |
compute()
Compute the forces applied to a boid under the form of a barycenter that
the boids tries to reach (attraction), an overall direction for all the
surrounding boids, an overall direction of all the surrounding boids.
|
org.miv.pherd.geom.Vector3 |
getDirection() |
abstract Collection<Boid> |
getNeighborhood() |
abstract org.miv.pherd.geom.Point3 |
getNextPosition() |
abstract org.miv.pherd.geom.Point3 |
getPosition() |
abstract boolean |
is3D() |
boolean |
isVisible(Boid boid,
org.miv.pherd.geom.Point3 point)
True if the given position is visible by the boid.
|
void |
moveBarycenter(org.miv.pherd.geom.Point3 p)
Integrate a new point of influence.
|
abstract void |
setPosition(double x,
double y,
double z) |
public org.miv.pherd.geom.Point3 barycenter
public org.miv.pherd.geom.Vector3 direction
public org.miv.pherd.geom.Vector3 attraction
public org.miv.pherd.geom.Vector3 repulsion
public int countAtt
public int countRep
public BoidForces(Boid b)
public void compute()
public void addRepulsion(org.miv.pherd.geom.Vector3 rep)
public void addDirection(org.miv.pherd.geom.Vector3 dir)
public void addAttraction(org.miv.pherd.geom.Vector3 att)
public void moveBarycenter(org.miv.pherd.geom.Point3 p)
public boolean isVisible(Boid boid, org.miv.pherd.geom.Point3 point)
This method first check if the given point is under the max distance of view. If so, it checks if the point is in the angle of view. The angle of view is specified as the cosine of the angle between the boid direction vector and the vector between the boid and the given point. This means that -1 is equal to a 360 degree of vision (the angle of view test is deactivated in this case), 0 means 180 degree angle, and 0.5 a 90 degree angle for example.
boid - The source boid.point - The point to consider.public org.miv.pherd.geom.Vector3 getDirection()
public abstract void setPosition(double x,
double y,
double z)
public abstract org.miv.pherd.geom.Point3 getPosition()
public abstract org.miv.pherd.geom.Point3 getNextPosition()
public abstract Collection<Boid> getNeighborhood()
public abstract boolean is3D()
Copyright © 2015. All rights reserved.