A Discrete-Event Network Simulator
API
ns3::Box Class Reference

a 3d box More...

#include "box.h"

+ Collaboration diagram for ns3::Box:

Public Types

enum  Side {
  RIGHT , LEFT , TOP , BOTTOM ,
  UP , DOWN
}
 Enum class to specify sides of a box. More...
 

Public Member Functions

 Box ()
 Create a zero-sized box located at coordinates (0.0,0.0,0.0) More...
 
 Box (double _xMin, double _xMax, double _yMin, double _yMax, double _zMin, double _zMax)
 
Vector CalculateIntersection (const Vector &current, const Vector &speed) const
 
Side GetClosestSide (const Vector &position) const
 
bool IsInside (const Vector &position) const
 
bool IsIntersect (const Vector &l1, const Vector &l2) const
 Checks if a line-segment between position l1 and position l2 intersects a box. More...
 

Public Attributes

double xMax
 The x coordinate of the right bound of the box. More...
 
double xMin
 The x coordinate of the left bound of the box. More...
 
double yMax
 The y coordinate of the top bound of the box. More...
 
double yMin
 The y coordinate of the bottom bound of the box. More...
 
double zMax
 The z coordinate of the up bound of the box. More...
 
double zMin
 The z coordinate of the down bound of the box. More...
 

Detailed Description

a 3d box

See also
Box Attribute

Definition at line 34 of file box.h.

Member Enumeration Documentation

◆ Side

Enum class to specify sides of a box.

Enumerator
RIGHT 
LEFT 
TOP 
BOTTOM 
UP 
DOWN 

Definition at line 40 of file box.h.

Constructor & Destructor Documentation

◆ Box() [1/2]

ns3::Box::Box ( double  _xMin,
double  _xMax,
double  _yMin,
double  _yMax,
double  _zMin,
double  _zMax 
)
Parameters
_xMinx coordinates of left boundary.
_xMaxx coordinates of right boundary.
_yMiny coordinates of bottom boundary.
_yMaxy coordinates of top boundary.
_zMinz coordinates of down boundary.
_zMaxz coordinates of up boundary.

Create a box.

Definition at line 31 of file box.cc.

◆ Box() [2/2]

ns3::Box::Box ( )

Create a zero-sized box located at coordinates (0.0,0.0,0.0)

Definition at line 43 of file box.cc.

Member Function Documentation

◆ CalculateIntersection()

Vector ns3::Box::CalculateIntersection ( const Vector &  current,
const Vector &  speed 
) const
Parameters
currentthe current position
speedthe current speed
Returns
the intersection point between the rectangle and the current+speed vector.

This method assumes that the current position is located inside the cube and checks for this with an assert. This method compares only the x and y coordinates of the input position and speed. It ignores the z coordinate.

Definition at line 110 of file box.cc.

References IsInside(), NS_ASSERT, xMax, xMin, yMax, and yMin.

+ Here is the call graph for this function:

◆ GetClosestSide()

Box::Side ns3::Box::GetClosestSide ( const Vector &  position) const
Parameters
positionthe position to test.
Returns
the side of the cube the input position is closest to.

This method compares the x, y, and z coordinates of the input position.

Definition at line 63 of file box.cc.

References BOTTOM, DOWN, LEFT, min, RIGHT, TOP, UP, xMax, yMax, and zMax.

◆ IsInside()

bool ns3::Box::IsInside ( const Vector &  position) const
Parameters
positionthe position to test.
Returns
true if the input position is located within the box, false otherwise.

This method compares the x, y, and z coordinates of the input position.

Definition at line 54 of file box.cc.

References xMax, xMin, yMax, yMin, zMax, and zMin.

Referenced by CalculateIntersection(), ns3::RandomWalk2dOutdoorMobilityModel::CalculateIntersectionFromOutside(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::Building::IsInside(), and IsIntersect().

+ Here is the caller graph for this function:

◆ IsIntersect()

bool ns3::Box::IsIntersect ( const Vector &  l1,
const Vector &  l2 
) const

Checks if a line-segment between position l1 and position l2 intersects a box.

This method considers all the three coordinates, i.e., x, y, and z. This function was developed by NYU Wireless and is based on the algorithm described here http://www.3dkingdoms.com/weekly/weekly.php?a=21. Reference: Menglei Zhang, Michele Polese, Marco Mezzavilla, Sundeep Rangan, Michele Zorzi. "ns-3 Implementation of the 3GPP MIMO Channel Model for Frequency Spectrum above 6 GHz". In Proceedings of the Workshop on ns-3 (WNS3 '17). 2017.

Parameters
l1position
l2position
Returns
true if there is a intersection, false otherwise

Definition at line 147 of file box.cc.

References IsInside(), xMax, xMin, yMax, yMin, zMax, and zMin.

Referenced by BoxLineIntersectionTestCase::DoRun(), and ns3::Building::IsIntersect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ xMax

◆ xMin

◆ yMax

◆ yMin

◆ zMax

◆ zMin


The documentation for this class was generated from the following files: