A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
constant-velocity-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006,2007 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef CONSTANT_VELOCITY_HELPER_H
9
#define CONSTANT_VELOCITY_HELPER_H
10
11
#include "
box.h
"
12
13
#include "ns3/nstime.h"
14
#include "ns3/vector.h"
15
16
namespace
ns3
17
{
18
19
class
Rectangle;
20
21
/**
22
* \ingroup mobility
23
*
24
* \brief Utility class used to move node with constant velocity.
25
*/
26
class
ConstantVelocityHelper
27
{
28
public
:
29
ConstantVelocityHelper
();
30
/**
31
* Create object and set position
32
* \param position the position vector
33
*/
34
ConstantVelocityHelper
(
const
Vector& position);
35
/**
36
* Create object and set position and velocity
37
* \param position the position vector
38
* \param vel the velocity vector
39
*/
40
ConstantVelocityHelper
(
const
Vector& position,
const
Vector& vel);
41
42
/**
43
* Set position vector
44
* \param position Position vector
45
*/
46
void
SetPosition
(
const
Vector& position);
47
/**
48
* Get current position vector
49
* \return Position vector
50
*/
51
Vector
GetCurrentPosition
()
const
;
52
/**
53
* Get velocity; if paused, will return a zero vector
54
* \return Velocity vector
55
*/
56
Vector
GetVelocity
()
const
;
57
/**
58
* Set new velocity vector
59
* \param vel Velocity vector
60
*/
61
void
SetVelocity
(
const
Vector& vel);
62
/**
63
* Pause mobility at current position
64
*/
65
void
Pause
();
66
/**
67
* Resume mobility from current position at current velocity
68
*/
69
void
Unpause
();
70
71
/**
72
* Update position, if not paused, from last position and time of last update
73
* \param rectangle 2D bounding rectangle for resulting position; object will not move outside
74
* the rectangle
75
*/
76
void
UpdateWithBounds
(
const
Rectangle
& rectangle)
const
;
77
/**
78
* Update position, if not paused, from last position and time of last update
79
* \param bounds 3D bounding box for resulting position; object will not move outside the box
80
*/
81
void
UpdateWithBounds
(
const
Box
& bounds)
const
;
82
/**
83
* Update position, if not paused, from last position and time of last update
84
*/
85
void
Update
()
const
;
86
87
private
:
88
mutable
Time
m_lastUpdate
;
//!< time of last update
89
mutable
Vector
m_position
;
//!< state variable for current position
90
Vector
m_velocity
;
//!< state variable for velocity
91
bool
m_paused
;
//!< state variable for paused
92
};
93
94
}
// namespace ns3
95
96
#endif
/* CONSTANT_VELOCITY_HELPER_H */
box.h
ns3::Box
a 3d box
Definition
box.h:24
ns3::ConstantVelocityHelper
Utility class used to move node with constant velocity.
Definition
constant-velocity-helper.h:27
ns3::ConstantVelocityHelper::ConstantVelocityHelper
ConstantVelocityHelper()
Definition
constant-velocity-helper.cc:21
ns3::ConstantVelocityHelper::m_lastUpdate
Time m_lastUpdate
time of last update
Definition
constant-velocity-helper.h:88
ns3::ConstantVelocityHelper::GetCurrentPosition
Vector GetCurrentPosition() const
Get current position vector.
Definition
constant-velocity-helper.cc:52
ns3::ConstantVelocityHelper::m_position
Vector m_position
state variable for current position
Definition
constant-velocity-helper.h:89
ns3::ConstantVelocityHelper::GetVelocity
Vector GetVelocity() const
Get velocity; if paused, will return a zero vector.
Definition
constant-velocity-helper.cc:59
ns3::ConstantVelocityHelper::Update
void Update() const
Update position, if not paused, from last position and time of last update.
Definition
constant-velocity-helper.cc:74
ns3::ConstantVelocityHelper::UpdateWithBounds
void UpdateWithBounds(const Rectangle &rectangle) const
Update position, if not paused, from last position and time of last update.
Definition
constant-velocity-helper.cc:92
ns3::ConstantVelocityHelper::Unpause
void Unpause()
Resume mobility from current position at current velocity.
Definition
constant-velocity-helper.cc:123
ns3::ConstantVelocityHelper::SetPosition
void SetPosition(const Vector &position)
Set position vector.
Definition
constant-velocity-helper.cc:43
ns3::ConstantVelocityHelper::SetVelocity
void SetVelocity(const Vector &vel)
Set new velocity vector.
Definition
constant-velocity-helper.cc:66
ns3::ConstantVelocityHelper::Pause
void Pause()
Pause mobility at current position.
Definition
constant-velocity-helper.cc:116
ns3::ConstantVelocityHelper::m_velocity
Vector m_velocity
state variable for velocity
Definition
constant-velocity-helper.h:90
ns3::ConstantVelocityHelper::m_paused
bool m_paused
state variable for paused
Definition
constant-velocity-helper.h:91
ns3::Rectangle
a 2d rectangle
Definition
rectangle.h:24
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mobility
model
constant-velocity-helper.h
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0