A Discrete-Event Network Simulator Home Tutorials  ▼ Docs    ▼ Develop ▼ API
vector.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 INRIA
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
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef NS3_VECTOR_H
21 #define NS3_VECTOR_H
22
23 #include "attribute.h"
24 #include "attribute-helper.h"
25
26 namespace ns3 {
27
31 class Vector3D
32 {
33 public:
41  Vector3D (double _x, double _y, double _z);
45  Vector3D ();
49  double x;
53  double y;
57  double z;
58 };
59
63 class Vector2D
64 {
65 public:
72  Vector2D (double _x, double _y);
76  Vector2D ();
80  double x;
84  double y;
85 };
86
92 double CalculateDistance (const Vector3D &a, const Vector3D &b);
93
99 double CalculateDistance (const Vector2D &a, const Vector2D &b);
100
111
112 std::ostream &operator << (std::ostream &os, const Vector3D &vector);
113 std::istream &operator >> (std::istream &is, Vector3D &vector);
114 std::ostream &operator << (std::ostream &os, const Vector2D &vector);
115 std::istream &operator >> (std::istream &is, Vector2D &vector);
116
117 // for compatibility with mobility models
118 typedef Vector3D Vector;
119 typedef Vector3DValue VectorValue;
120 typedef Vector3DChecker VectorChecker;
122 Ptr<const AttributeChecker> MakeVectorChecker (void);
123
124 } // namespace ns3
125
126 #endif /* NS3_VECTOR_H */
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:49
double x
Definition: vector.h:49
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
a 3d vector
Definition: vector.h:31
double x
Definition: vector.h:80
double y
Definition: vector.h:84
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition: vector.cc:71