10#include <ns3/simulator.h>
26 Box box =
Box(890.0, 990.0, 840.0, 870.0, 0.0, 6.0);
68 :
TestCase(BuildNameString(indexPos1, indexPos2, box, intersect)),
69 m_indexPos1(indexPos1),
70 m_indexPos2(indexPos2),
72 m_intersect(intersect)
86 std::ostringstream oss;
87 oss <<
"Box line intersection test : checking"
88 <<
" pos1 index " << indexPos1 <<
" and pos2 index " << indexPos2
89 <<
" intersection with the box (" << box.
xMin <<
", " << box.
xMax <<
", " << box.
yMin
90 <<
", " << box.
yMax <<
", " << box.
zMin <<
", " << box.
zMax
91 <<
"). The expected intersection flag = " << intersect <<
" ";
105 "Unexpected result of box and line segment intersection!");
117 pos = Vector(934.0, 852.0, 1.5);
120 pos = Vector(931.0, 861.0, 1.5);
123 pos = Vector(484.0, 298.0, 1.5);
126 pos = Vector(1000.0, 850.0, 1.5);
129 pos = Vector(850.0, 850.0, 1.5);
132 pos = Vector(934.0, 852.0, boxHeight + 14.0);
static BoxLineIntersectionTestSuite boxLineIntersectionTestSuite
boxLineIntersectionTestSuite
TestCase to check the box line intersection.
uint16_t m_indexPos2
Second position index.
BoxLineIntersectionTestCase(uint16_t indexPos1, uint16_t indexPos2, Box box, bool intersect)
Create BoxLineIntersectionTestCase.
uint16_t m_indexPos1
First position index.
void DoRun() override
Setup the simulation according to the configuration set by the class constructor, run it,...
std::string BuildNameString(uint16_t indexPos1, uint16_t indexPos2, Box box, bool intersect)
Builds the test name string based on provided parameter values.
bool m_intersect
Flag to indicate the intersection.
Vector CreatePosition(uint16_t index, double boxHeight)
Create the position as per the given index.
~BoxLineIntersectionTestCase() override
Destructor.
Box m_box
The box to check the intersection with.
BoxLineIntersectionTestSuite()
Constructor.
double yMax
The y coordinate of the top bound of the box.
double xMin
The x coordinate of the left bound of the box.
double yMin
The y coordinate of the bottom bound of the box.
double xMax
The x coordinate of the right bound of the box.
double zMin
The z coordinate of the down bound of the box.
bool IsIntersect(const Vector &l1, const Vector &l2) const
Checks if a line-segment between position l1 and position l2 intersects a box.
double zMax
The z coordinate of the up bound of the box.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.