Re: [ns] distance calculation of the nodes

2011-02-21 Thread Érico Porto

In this case is easier if you just make a tcl function that do that to you.

something like (don't know if the syntax is right)

proc calcDist { node_a node_b } {

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))]

}

Érico V. Porto


On Mon, Feb 21, 2011 at 12:56 AM, Suman paul choudhury 
sumanpc2...@gmail.com wrote:


 dear all
 hw
 ow is it possible to calculate the distance of the two nodes using ns-2?
 example_ if node1 has cordinates as (5,15) and the other node2 has
 cordinates (15,20)
 then what would be the command in NS-2 to calculate the distance between
 the
 nodes.

 thanking you

 regards
 suman



[ns] distance calculation of the nodes

2011-02-20 Thread Suman paul choudhury

dear all
hw
ow is it possible to calculate the distance of the two nodes using ns-2?
example_ if node1 has cordinates as (5,15) and the other node2 has
cordinates (15,20)
then what would be the command in NS-2 to calculate the distance between the
nodes.

thanking you

regards
suman