A Discrete-Event Network Simulator
API
box.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2009 Dan Broyles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Dan Broyles <dbroyl01@ku.edu>
19 */
20#ifndef BOX_H
21#define BOX_H
22
23#include "ns3/attribute.h"
24#include "ns3/attribute-helper.h"
25#include "ns3/vector.h"
26
27namespace ns3 {
28
34class Box
35{
36public:
40 enum Side {
46 DOWN
47 };
58 Box (double _xMin, double _xMax,
59 double _yMin, double _yMax,
60 double _zMin, double _zMax);
64 Box ();
72 bool IsInside (const Vector &position) const;
79 Side GetClosestSide (const Vector &position) const;
90 Vector CalculateIntersection (const Vector &current, const Vector &speed) const;
107 bool IsIntersect (const Vector &l1, const Vector &l2) const;
108
110 double xMin;
112 double xMax;
114 double yMin;
116 double yMax;
118 double zMin;
120 double zMax;
121};
122
123std::ostream &operator << (std::ostream &os, const Box &box);
124std::istream &operator >> (std::istream &is, Box &box);
125
127
128} // namespace ns3
129
130#endif /* BOX_H */
a 3d box
Definition: box.h:35
double yMax
The y coordinate of the top bound of the box.
Definition: box.h:116
bool IsInside(const Vector &position) const
Definition: box.cc:54
double xMin
The x coordinate of the left bound of the box.
Definition: box.h:110
Side
Enum class to specify sides of a box.
Definition: box.h:40
@ RIGHT
Definition: box.h:41
@ UP
Definition: box.h:45
@ DOWN
Definition: box.h:46
@ BOTTOM
Definition: box.h:44
@ LEFT
Definition: box.h:42
@ TOP
Definition: box.h:43
double yMin
The y coordinate of the bottom bound of the box.
Definition: box.h:114
double xMax
The x coordinate of the right bound of the box.
Definition: box.h:112
Vector CalculateIntersection(const Vector &current, const Vector &speed) const
Definition: box.cc:110
double zMin
The z coordinate of the down bound of the box.
Definition: box.h:118
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:147
Side GetClosestSide(const Vector &position) const
Definition: box.cc:63
Box()
Create a zero-sized box located at coordinates (0.0,0.0,0.0)
Definition: box.cc:43
double zMax
The z coordinate of the up bound of the box.
Definition: box.h:120
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ATTRIBUTE_HELPER_HEADER(ValueClassTest)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:139
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:162