Hello, Recently, i'm researching on the wireless and mobile networking. I would like to calculate the distance between two wireless nodes which are moving in their communication range, so that, in the upper layer, I can select a nearer node to send data.
There probably existed such a question in the list (as shown below), but I think it's for fix nodes, while not what i'm expecting. set x1 [$node_a set X_] set y1 [$node_a set Y_] set x2 [$node_b set X_] set y2 [$node_b set Y_] set distance [expr "sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))"] Therefore, would anyone mind pointing me out the way of calculating such a distance in NS-2 (by using C++ code or TCL)? Regards, Cheav