Mobility models for ad-hoc networks
Column model
The '+' simbol denotes the gravity center.
The '.' points are the reference locations of the nodes.
The "0" node is the target point, it is not animated.
Click with the mouse to move the column toward this position.
public static Pos move_column(int node) { // move a node in column
model
// Move semi_random the node requested, with the limitations of the
model
Pos p=(Pos)loc.get(new Integer(node)); // real position
Pos r=(Pos)ref.get(new Integer(node)); // theoretic position
double d=p.distance(r);
int xi=(int)(Math.random()*(d+5));
int yi=(int)(Math.random()*(d+5));
if (p.isLeft(r)) xi+=p.x; else xi=p.x-xi;
if (p.isUp(r)) yi+=p.y; else yi=p.y-yi;
return new Pos(xi,yi);
}
If you have not the correct behavior, please let your browser to totally reload the
contents of this page. The complete source code of these applets is here.
Miguel Sanchez 1998
|