A Discrete-Event Network Simulator
API
rectangle.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 #ifndef RECTANGLE_H
20 #define RECTANGLE_H
21 
22 #include "ns3/attribute-helper.h"
23 #include "ns3/attribute.h"
24 #include "ns3/vector.h"
25 
26 namespace ns3
27 {
28 
34 class Rectangle
35 {
36  public:
40  enum Side
41  {
44  TOP,
45  BOTTOM
46  };
47 
56  Rectangle(double _xMin, double _xMax, double _yMin, double _yMax);
60  Rectangle();
68  bool IsInside(const Vector& position) const;
76  Side GetClosestSide(const Vector& position) const;
87  Vector CalculateIntersection(const Vector& current, const Vector& speed) const;
88 
89  double xMin;
90  double xMax;
91  double yMin;
92  double yMax;
93 };
94 
95 std::ostream& operator<<(std::ostream& os, const Rectangle& rectangle);
96 std::istream& operator>>(std::istream& is, Rectangle& rectangle);
97 
99 
100 } // namespace ns3
101 
102 #endif /* RECTANGLE_H */
a 2d rectangle
Definition: rectangle.h:35
Side GetClosestSide(const Vector &position) const
Definition: rectangle.cc:56
double yMax
The y coordinate of the top bound of the rectangle.
Definition: rectangle.h:92
bool IsInside(const Vector &position) const
Definition: rectangle.cc:49
double xMax
The x coordinate of the right bound of the rectangle.
Definition: rectangle.h:90
Vector CalculateIntersection(const Vector &current, const Vector &speed) const
Definition: rectangle.cc:178
Side
enum for naming sides
Definition: rectangle.h:41
double xMin
The x coordinate of the left bound of the rectangle.
Definition: rectangle.h:89
Rectangle()
Create a zero-sized rectangle located at coordinates (0.0,0.0)
Definition: rectangle.cc:40
double yMin
The y coordinate of the bottom bound of the rectangle.
Definition: rectangle.h:91
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ATTRIBUTE_HELPER_HEADER(ValueClassTest)
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:153
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129