|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.graphstream.boids.BoidForces
public abstract class BoidForces
Models the forces applied to a boid at each step.
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).
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
BoidForces(Boid b)
Forces all set at zero. |
|
| Method Summary | |
|---|---|
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()
|
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)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public BoidForces(Boid b)
| Method Detail |
|---|
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||