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
box.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 Dan Broyles
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Dan Broyles <dbroyl01@ku.edu>
7
*/
8
#ifndef BOX_H
9
#define BOX_H
10
11
#include "ns3/attribute-helper.h"
12
#include "ns3/attribute.h"
13
#include "ns3/vector.h"
14
15
namespace
ns3
16
{
17
18
/**
19
* \ingroup mobility
20
* \brief a 3d box
21
* \see attribute_Box
22
*/
23
class
Box
24
{
25
public
:
26
/**
27
* Enum class to specify sides of a box
28
*/
29
enum
Side
30
{
31
RIGHT
,
32
LEFT
,
33
TOP
,
34
BOTTOM
,
35
UP
,
36
DOWN
37
};
38
39
/**
40
* \param _xMin x coordinates of left boundary.
41
* \param _xMax x coordinates of right boundary.
42
* \param _yMin y coordinates of bottom boundary.
43
* \param _yMax y coordinates of top boundary.
44
* \param _zMin z coordinates of down boundary.
45
* \param _zMax z coordinates of up boundary.
46
*
47
* Create a box.
48
*/
49
Box
(
double
_xMin,
double
_xMax,
double
_yMin,
double
_yMax,
double
_zMin,
double
_zMax);
50
/**
51
* Create a zero-sized box located at coordinates (0.0,0.0,0.0)
52
*/
53
Box
();
54
/**
55
* \param position the position to test.
56
* \returns true if the input position is located within the box,
57
* false otherwise.
58
*
59
* This method compares the x, y, and z coordinates of the input position.
60
*/
61
bool
IsInside
(
const
Vector& position)
const
;
62
/**
63
* \param position the position to test.
64
* \returns the side of the cube the input position is closest to.
65
*
66
* This method compares the x, y, and z coordinates of the input position.
67
*/
68
Side
GetClosestSide
(
const
Vector& position)
const
;
69
/**
70
* \param current the current position
71
* \param speed the current speed
72
* \returns the intersection point between the rectangle and the current+speed vector.
73
*
74
* This method assumes that the current position is located _inside_
75
* the cube and checks for this with an assert.
76
* This method compares only the x and y coordinates of the input position
77
* and speed. It ignores the z coordinate.
78
*/
79
Vector
CalculateIntersection
(
const
Vector& current,
const
Vector& speed)
const
;
80
/**
81
* \brief Checks if a line-segment between position l1 and position l2
82
* intersects a box.
83
*
84
* This method considers all the three coordinates, i.e., x, y, and z.
85
* This function was developed by NYU Wireless and is based on the algorithm
86
* described here http://www.3dkingdoms.com/weekly/weekly.php?a=21.
87
* Reference: Menglei Zhang, Michele Polese, Marco Mezzavilla, Sundeep Rangan,
88
* Michele Zorzi. "ns-3 Implementation of the 3GPP MIMO Channel Model for
89
* Frequency Spectrum above 6 GHz". In Proceedings of the Workshop on ns-3
90
* (WNS3 '17). 2017.
91
*
92
* \param l1 position
93
* \param l2 position
94
* \return true if there is a intersection, false otherwise
95
*/
96
bool
IsIntersect
(
const
Vector& l1,
const
Vector& l2)
const
;
97
98
/** The x coordinate of the left bound of the box */
99
double
xMin
;
100
/** The x coordinate of the right bound of the box */
101
double
xMax
;
102
/** The y coordinate of the bottom bound of the box */
103
double
yMin
;
104
/** The y coordinate of the top bound of the box */
105
double
yMax
;
106
/** The z coordinate of the down bound of the box */
107
double
zMin
;
108
/** The z coordinate of the up bound of the box */
109
double
zMax
;
110
};
111
112
std::ostream&
operator<<
(std::ostream& os,
const
Box
& box);
113
std::istream&
operator>>
(std::istream& is,
Box
& box);
114
115
ATTRIBUTE_HELPER_HEADER
(
Box
);
116
117
}
// namespace ns3
118
119
#endif
/* BOX_H */
ns3::Box
a 3d box
Definition
box.h:24
ns3::Box::yMax
double yMax
The y coordinate of the top bound of the box.
Definition
box.h:105
ns3::Box::IsInside
bool IsInside(const Vector &position) const
Definition
box.cc:43
ns3::Box::xMin
double xMin
The x coordinate of the left bound of the box.
Definition
box.h:99
ns3::Box::Side
Side
Enum class to specify sides of a box.
Definition
box.h:30
ns3::Box::RIGHT
@ RIGHT
Definition
box.h:31
ns3::Box::UP
@ UP
Definition
box.h:35
ns3::Box::DOWN
@ DOWN
Definition
box.h:36
ns3::Box::BOTTOM
@ BOTTOM
Definition
box.h:34
ns3::Box::LEFT
@ LEFT
Definition
box.h:32
ns3::Box::TOP
@ TOP
Definition
box.h:33
ns3::Box::yMin
double yMin
The y coordinate of the bottom bound of the box.
Definition
box.h:103
ns3::Box::xMax
double xMax
The x coordinate of the right bound of the box.
Definition
box.h:101
ns3::Box::CalculateIntersection
Vector CalculateIntersection(const Vector ¤t, const Vector &speed) const
Definition
box.cc:97
ns3::Box::zMin
double zMin
The z coordinate of the down bound of the box.
Definition
box.h:107
ns3::Box::IsIntersect
bool IsIntersect(const Vector &l1, const Vector &l2) const
Checks if a line-segment between position l1 and position l2 intersects a box.
Definition
box.cc:133
ns3::Box::GetClosestSide
Side GetClosestSide(const Vector &position) const
Definition
box.cc:50
ns3::Box::Box
Box()
Create a zero-sized box located at coordinates (0.0,0.0,0.0)
Definition
box.cc:32
ns3::Box::zMax
double zMax
The z coordinate of the up bound of the box.
Definition
box.h:109
ATTRIBUTE_HELPER_HEADER
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
Definition
attribute-helper.h:397
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
ns3::operator>>
std::istream & operator>>(std::istream &is, Angles &a)
Definition
angles.cc:172
src
mobility
model
box.h
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0