Vector operation

13 views
Skip to first unread message

John Scott

unread,
Apr 24, 2017, 1:39:16 PM4/24/17
to ns-3-users
Hi,

I am trying to multiply a double value with a vector, but that gives me an error.

double deltaT; // difference between two timestamps in seconds
Vector oldPosition; // some (x,y,z) from mobilityModel
Vector directionOfMove; // some (x,y,z) from mobilityModel

Vector newPosition = (deltaT * oldPosition.x + directionOfMove.x, deltaT * oldPosition.y + directionOfMove.y);

The error is:
error: conversion from double to non-scalar type ns3::Vector {aka ns3::Vector3D}’ requested


I couldn't find anything in this mailing list so far. Can you help please?

Tommaso Pecorella

unread,
Apr 24, 2017, 2:00:55 PM4/24/17
to ns-3-users
Vector newPosition = Vector(deltaT * oldPosition.+ directionOfMove.x, deltaT * oldPosition.+ directionOfMove.y, deltaT * oldPosition.+ directionOfMove.z);

I.e., you missed a "Vector" and the z coordinate.


T.
Reply all
Reply to author
Forward
0 new messages