|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.bio.FlockingAgent
Implements an agent that flocks with other similar agents. This code is based on Mike Miller's Java code conversion for The Computational Beauty of Nature by Gary William Flake. The code has been converted to the Generation5 SDK style and system (using Visualizable etc.).
FlockingAgent| Field Summary | |
protected static double |
avoidR
|
protected static double |
avoidW
|
protected static double |
centroidR
|
protected static double |
centroidW
|
protected static int |
cols
The height of the flocking agent's world. |
protected static double |
copyR
|
protected static double |
copyW
|
protected static double |
ddt
|
protected static double |
dt
|
protected static double |
minV
|
protected static FlockingAgent[] |
myFlock
The flock this agent is in. |
protected double |
nvx
The x-velocity to be used in the next frame. |
protected double |
nvy
The y-velocity to be used in the next frame. |
protected static double |
nx
|
protected static double |
ny
|
protected double |
positionX
The x-position of this agent. |
protected double |
positionY
The positionY-position of this agent. |
protected static double |
randW
|
protected static java.util.Random |
rnd
The random seed used to generate positional data. |
protected static int |
rows
The width of the flocking agent's world. |
protected static double |
vAvoidA
|
protected static double |
vAvoidR
|
protected static double |
vAvoidW
|
protected static double |
viewA
The viewing angle of the agent. |
protected double |
vx
The x-velocity of this agent. |
protected double |
vy
The y-velocity of this agent. |
| Constructor Summary | |
FlockingAgent()
Creates a new instance of FlockingAgent. |
|
| Method Summary | |
void |
computeNewHeading(int self)
|
protected static double |
dist(double x1,
double y1,
double x2,
double y2)
|
protected static double |
dot(double x1,
double y1,
double x2,
double y2)
|
static void |
initMisc(java.util.Random r,
int rr,
int cc,
double va,
double vaa,
double mv)
|
static void |
initRadii(double cr,
double ccr,
double ar,
double vr)
|
static void |
initTime(double t,
double tt)
|
static void |
initWeights(double cw,
double ccw,
double aw,
double vw,
double rw)
|
protected static double |
len(double x,
double y)
|
protected static void |
normalize(double x,
double y)
|
void |
render(java.awt.Graphics graphics,
int sx,
int sy)
|
static void |
setFlock(FlockingAgent[] flock)
|
void |
update()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static java.util.Random rnd
protected static int rows
protected static int cols
protected static double viewA
protected static double vAvoidA
protected static double minV
protected static double copyR
protected static double centroidR
protected static double avoidR
protected static double vAvoidR
protected static double copyW
protected static double centroidW
protected static double avoidW
protected static double vAvoidW
protected static double randW
protected static double dt
protected static double ddt
protected static FlockingAgent[] myFlock
protected static double nx
protected static double ny
protected double positionX
protected double positionY
protected double vx
protected double vy
protected double nvx
computeNewHeading, then all have them updated
using update.
protected double nvy
computeNewHeading, then all have them updated
using update.
| Constructor Detail |
public FlockingAgent()
| Method Detail |
public static void initMisc(java.util.Random r,
int rr,
int cc,
double va,
double vaa,
double mv)
public static void initRadii(double cr,
double ccr,
double ar,
double vr)
public static void initWeights(double cw,
double ccw,
double aw,
double vw,
double rw)
public static void initTime(double t,
double tt)
public static void setFlock(FlockingAgent[] flock)
protected static void normalize(double x,
double y)
protected static double len(double x,
double y)
protected static double dist(double x1,
double y1,
double x2,
double y2)
protected static double dot(double x1,
double y1,
double x2,
double y2)
public void computeNewHeading(int self)
self - public void update()
public void render(java.awt.Graphics graphics,
int sx,
int sy)
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||