A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
26namespace ns3
27{
28
35{
36 public:
40 enum Side
41 {
50 };
51
60 Rectangle(double _xMin, double _xMax, double _yMin, double _yMax);
64 Rectangle();
72 bool IsInside(const Vector& position) const;
80 bool IsOnTheBorder(const Vector& position) const;
102 Side GetClosestSideOrCorner(const Vector& position) const;
113 Vector CalculateIntersection(const Vector& current, const Vector& speed) const;
114
115 double xMin;
116 double xMax;
117 double yMin;
118 double yMax;
119};
120
121std::ostream& operator<<(std::ostream& os, const Rectangle& rectangle);
122std::istream& operator>>(std::istream& is, Rectangle& rectangle);
123std::ostream& operator<<(std::ostream& os, const Rectangle::Side& side);
124
126
127} // namespace ns3
128
129#endif /* RECTANGLE_H */
a 2d rectangle
Definition: rectangle.h:35
double yMax
The y coordinate of the top bound of the rectangle.
Definition: rectangle.h:118
Side GetClosestSideOrCorner(const Vector &position) const
Definition: rectangle.cc:64
bool IsInside(const Vector &position) const
Definition: rectangle.cc:50
bool IsOnTheBorder(const Vector &position) const
Definition: rectangle.cc:57
double xMax
The x coordinate of the right bound of the rectangle.
Definition: rectangle.h:116
Vector CalculateIntersection(const Vector &current, const Vector &speed) const
Definition: rectangle.cc:152
Side
enum for naming sides
Definition: rectangle.h:41
double xMin
The x coordinate of the left bound of the rectangle.
Definition: rectangle.h:115
Rectangle()
Create a zero-sized rectangle located at coordinates (0.0,0.0)
Definition: rectangle.cc:41
double yMin
The y coordinate of the bottom bound of the rectangle.
Definition: rectangle.h:117
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:183