[ns] Get node positions in C++
Mubashir Rehmani
mshrehmani at gmail.com
Wed Nov 5 12:26:04 PST 2008
Hi Ivanovich Medeiroa
You can get the node location in your c++ by using the following code:
double x,y,z;
Node* srcnode = 0 ;
srcnode = Node::get_node_by_address(2); //put here the node id
MobileNode* tmnode = (MobileNode*)srcnode;
tmnode->getLoc(&x, &y, &z);
cout<<"Node Location : "<<x<<" "<<y<<endl;
Hope it helps.
Feel free to contact me.
Regards
Mubashir Husain Rehmani
LIP6, UPMC, Paris, France.
2008/11/5 Ivanovich Medeiroa <ivanovitchm at yahoo.com.br>
>
> Hi everyone,
>
> I am developing a wireless application and I need to get the X, Y and Z
> node positions. How can I do that?
>
> Example of my OTcl code:
>
> set ns [new Simulator]
> ...
> $node(0) set X_ 10.0
> $node(0) set Y_ 20.0
> $node(0) set Z_ 0.0
> ...
>
> How can I get these values in the C++ (my application) code?
>
> Regards,
> Ivan.
>
>
> Novos endereços, o Yahoo! que você conhece. Crie um email novo com a
> sua cara @ymail.com ou @rocketmail.com.
> http://br.new.mail.yahoo.com/addresses
--
Mubashir Husain Rehmani
Mobile : 00 33 (0)6 32 00 89 35
More information about the Ns-users
mailing list