GetSpeed -> GetVelocity
This commit is contained in:
@@ -19,7 +19,7 @@ static void
|
||||
CourseChange (ns3::TraceContext const&, Ptr<const MobilityModel> mobility)
|
||||
{
|
||||
Vector pos = mobility->GetPosition ();
|
||||
Vector vel = mobility->GetSpeed ();
|
||||
Vector vel = mobility->GetVelocity ();
|
||||
std::cout << Simulator::Now () << ", model=" << mobility << ", POS: x=" << pos.x << ", y=" << pos.y
|
||||
<< ", z=" << pos.z << "; VEL:" << vel.x << ", y=" << vel.y
|
||||
<< ", z=" << vel.z << std::endl;
|
||||
|
||||
@@ -77,10 +77,10 @@ HierarchicalMobilityModel::DoSetPosition (const Vector &position)
|
||||
m_child->SetPosition (childPosition);
|
||||
}
|
||||
Vector
|
||||
HierarchicalMobilityModel::DoGetSpeed (void) const
|
||||
HierarchicalMobilityModel::DoGetVelocity (void) const
|
||||
{
|
||||
Vector parentSpeed = m_parent->GetSpeed ();
|
||||
Vector childSpeed = m_child->GetSpeed ();
|
||||
Vector parentSpeed = m_parent->GetVelocity ();
|
||||
Vector childSpeed = m_child->GetVelocity ();
|
||||
Vector speed (parentSpeed.x + childSpeed.x,
|
||||
parentSpeed.y + childSpeed.y,
|
||||
parentSpeed.z + childSpeed.z);
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
private:
|
||||
virtual Vector DoGetPosition (void) const;
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetSpeed (void) const;
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
void ParentChanged (const TraceContext &context, Ptr<const MobilityModel> model);
|
||||
void ChildChanged (const TraceContext &context, Ptr<const MobilityModel> model);
|
||||
|
||||
@@ -39,9 +39,9 @@ MobilityModel::GetPosition (void) const
|
||||
return DoGetPosition ();
|
||||
}
|
||||
Vector
|
||||
MobilityModel::GetSpeed (void) const
|
||||
MobilityModel::GetVelocity (void) const
|
||||
{
|
||||
return DoGetSpeed ();
|
||||
return DoGetVelocity ();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
/**
|
||||
* \returns the current position.
|
||||
*/
|
||||
Vector GetSpeed (void) const;
|
||||
Vector GetVelocity (void) const;
|
||||
/**
|
||||
* \param position a reference to another mobility model
|
||||
* \returns the distance between the two objects. Unit is meters.
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
* Concrete subclasses of this base class must
|
||||
* implement this method.
|
||||
*/
|
||||
virtual Vector DoGetSpeed (void) const = 0;
|
||||
virtual Vector DoGetVelocity (void) const = 0;
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
@@ -200,9 +200,9 @@ RandomDirection2dMobilityModel::DoSetPosition (const Vector &position)
|
||||
m_event = Simulator::ScheduleNow (&RandomDirection2dMobilityModel::Start, this);
|
||||
}
|
||||
Vector
|
||||
RandomDirection2dMobilityModel::DoGetSpeed (void) const
|
||||
RandomDirection2dMobilityModel::DoGetVelocity (void) const
|
||||
{
|
||||
return m_helper.GetSpeed ();
|
||||
return m_helper.GetVelocity ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class RandomDirection2dMobilityModel : public MobilityModel
|
||||
virtual void DoDispose (void);
|
||||
virtual Vector DoGetPosition (void) const;
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetSpeed (void) const;
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
static const double PI;
|
||||
Ptr<RandomDirection2dMobilityModelParameters> m_parameters;
|
||||
|
||||
@@ -164,7 +164,7 @@ void
|
||||
RandomWalk2dMobilityModel::DoWalk (Time delayLeft)
|
||||
{
|
||||
Vector position = m_helper.GetCurrentPosition ();
|
||||
Vector speed = m_helper.GetSpeed ();
|
||||
Vector speed = m_helper.GetVelocity ();
|
||||
Vector nextPosition = position;
|
||||
nextPosition.x += speed.x * delayLeft.GetSeconds ();
|
||||
nextPosition.y += speed.y * delayLeft.GetSeconds ();
|
||||
@@ -186,7 +186,7 @@ void
|
||||
RandomWalk2dMobilityModel::Rebound (Time delayLeft)
|
||||
{
|
||||
Vector position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
|
||||
Vector speed = m_helper.GetSpeed ();
|
||||
Vector speed = m_helper.GetVelocity ();
|
||||
switch (m_parameters->m_bounds.GetClosestSide (position))
|
||||
{
|
||||
case Rectangle::RIGHT:
|
||||
@@ -223,9 +223,9 @@ RandomWalk2dMobilityModel::DoSetPosition (const Vector &position)
|
||||
m_event = Simulator::ScheduleNow (&RandomWalk2dMobilityModel::Start, this);
|
||||
}
|
||||
Vector
|
||||
RandomWalk2dMobilityModel::DoGetSpeed (void) const
|
||||
RandomWalk2dMobilityModel::DoGetVelocity (void) const
|
||||
{
|
||||
return m_helper.GetSpeed ();
|
||||
return m_helper.GetVelocity ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class RandomWalk2dMobilityModel : public MobilityModel
|
||||
virtual void DoDispose (void);
|
||||
virtual Vector DoGetPosition (void) const;
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetSpeed (void) const;
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
StaticSpeedHelper m_helper;
|
||||
EventId m_event;
|
||||
|
||||
@@ -154,9 +154,9 @@ RandomWaypointMobilityModel::DoSetPosition (const Vector &position)
|
||||
Simulator::ScheduleNow (&RandomWaypointMobilityModel::Start, this);
|
||||
}
|
||||
Vector
|
||||
RandomWaypointMobilityModel::DoGetSpeed (void) const
|
||||
RandomWaypointMobilityModel::DoGetVelocity (void) const
|
||||
{
|
||||
return m_helper.GetSpeed ();
|
||||
return m_helper.GetVelocity ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
void BeginWalk (void);
|
||||
virtual Vector DoGetPosition (void) const;
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetSpeed (void) const;
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
StaticSpeedHelper m_helper;
|
||||
Ptr<RandomWaypointMobilityModelParameters> m_parameters;
|
||||
|
||||
@@ -48,7 +48,7 @@ StaticMobilityModel::DoSetPosition (const Vector &position)
|
||||
NotifyCourseChange ();
|
||||
}
|
||||
Vector
|
||||
StaticMobilityModel::DoGetSpeed (void) const
|
||||
StaticMobilityModel::DoGetVelocity (void) const
|
||||
{
|
||||
return Vector (0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
private:
|
||||
virtual Vector DoGetPosition (void) const;
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetSpeed (void) const;
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
Vector m_position;
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ StaticSpeedHelper::GetCurrentPosition (void) const
|
||||
}
|
||||
|
||||
Vector
|
||||
StaticSpeedHelper::GetSpeed (void) const
|
||||
StaticSpeedHelper::GetVelocity (void) const
|
||||
{
|
||||
return m_paused? Vector (0.0, 0.0, 0.0) : m_speed;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class StaticSpeedHelper
|
||||
void Reset (const Vector &speed);
|
||||
Vector GetCurrentPosition (const Rectangle &bounds) const;
|
||||
Vector GetCurrentPosition (void) const;
|
||||
Vector GetSpeed (void) const;
|
||||
Vector GetVelocity (void) const;
|
||||
void SetSpeed (const Vector &speed);
|
||||
void Pause (void);
|
||||
void Unpause (void);
|
||||
|
||||
@@ -68,9 +68,9 @@ StaticSpeedMobilityModel::DoSetPosition (const Vector &position)
|
||||
NotifyCourseChange ();
|
||||
}
|
||||
Vector
|
||||
StaticSpeedMobilityModel::DoGetSpeed (void) const
|
||||
StaticSpeedMobilityModel::DoGetVelocity (void) const
|
||||
{
|
||||
return m_helper.GetSpeed ();
|
||||
return m_helper.GetVelocity ();
|
||||
}
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
private:
|
||||
virtual Vector DoGetPosition (void) const;
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetSpeed (void) const;
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
void Update (void) const;
|
||||
StaticSpeedHelper m_helper;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ Sample ()
|
||||
Ptr<Node> node = *nodeIter;
|
||||
Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
|
||||
Vector pos = mobility->GetPosition ();
|
||||
Vector vel = mobility->GetSpeed ();
|
||||
Vector vel = mobility->GetVelocity ();
|
||||
|
||||
NodeUpdate update;
|
||||
update.node = PeekPointer<Node> (node);
|
||||
|
||||
Reference in New Issue
Block a user