A Discrete-Event Network Simulator Home Tutorials  ▼ Docs    ▼ Develop ▼ API
ns3::Vector3D Class Reference

a 3d vector More...

`#include "vector.h"`

## Public Member Functions

Vector3D ()
Create vector (0.0, 0.0, 0.0) More...

Vector3D (double _x, double _y, double _z)

double GetLength () const
Compute the length (magnitude) of the vector. More...

double GetLengthSquared () const
Compute the squared length of the vector. More...

## Public Attributes

double x
x coordinate of vector More...

double y
y coordinate of vector More...

double z
z coordinate of vector More...

## Friends

double CalculateDistance (const Vector3D &a, const Vector3D &b)
Calculate the Cartesian distance between two points. More...

double CalculateDistanceSquared (const Vector3D &a, const Vector3D &b)
Calculate the squared Cartesian distance between two points. More...

bool operator!= (const Vector3D &a, const Vector3D &b)
Inequality operator. More...

Vector3D operator+ (const Vector3D &a, const Vector3D &b)

Vector3D operator- (const Vector3D &a, const Vector3D &b)
Subtraction operator. More...

bool operator< (const Vector3D &a, const Vector3D &b)
Less than comparison operator. More...

std::ostream & operator<< (std::ostream &os, const Vector3D &vector)
Output streamer. More...

bool operator<= (const Vector3D &a, const Vector3D &b)
Less than or equal to comparison operator. More...

bool operator== (const Vector3D &a, const Vector3D &b)
Equality operator. More...

bool operator> (const Vector3D &a, const Vector3D &b)
Greater than comparison operator. More...

bool operator>= (const Vector3D &a, const Vector3D &b)
Greater than or equal to comparison operator. More...

std::istream & operator>> (std::istream &is, Vector3D &vector)
Input streamer. More...

## Related Functions

(Note that these are not member functions.)

ns3::Ptr< const ns3::AttributeAccessorMakeVectorAccessor (T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method. More...

ns3::Ptr< const ns3::AttributeAccessorMakeVectorAccessor (T1 a1, T2 a2)
Create an AttributeAccessor using a pair of get functor and set methods from a class. More...

Ptr< const AttributeCheckerMakeVectorChecker (void)

typedef Vector3D Vector
Vector alias typedef for compatibility with mobility models. More...

typedef Vector3DChecker VectorChecker
Vector alias typedef for compatibility with mobility models. More...

typedef Vector3DValue VectorValue
Vector alias typedef for compatibility with mobility models. More...

## Detailed Description

a 3d vector

Vector3D Attribute

Definition at line 45 of file vector.h.

## ◆ Vector3D() [1/2]

 ns3::Vector3D::Vector3D ( double _x, double _y, double _z )
Parameters
 [in] _x X coordinate of vector [in] _y Y coordinate of vector [in] _z Z coordinate of vector

Create vector (_x, _y, _z)

Definition at line 48 of file vector.cc.

References NS_LOG_FUNCTION.

## ◆ Vector3D() [2/2]

 ns3::Vector3D::Vector3D ( )

Create vector (0.0, 0.0, 0.0)

Definition at line 56 of file vector.cc.

References NS_LOG_FUNCTION.

## ◆ GetLength()

 double ns3::Vector3D::GetLength ( ) const

Compute the length (magnitude) of the vector.

Returns
the vector length.

Definition at line 79 of file vector.cc.

References NS_LOG_FUNCTION, x, y, and z.

## ◆ GetLengthSquared()

 double ns3::Vector3D::GetLengthSquared ( ) const

Compute the squared length of the vector.

Returns
the vector length squared.

Definition at line 92 of file vector.cc.

References NS_LOG_FUNCTION, x, y, and z.

## ◆ CalculateDistance

 double CalculateDistance ( const Vector3D & a, const Vector3D & b )
friend

Calculate the Cartesian distance between two points.

Parameters
 [in] a One point [in] b Another point
Returns
The distance between a and b.

Definition at line 105 of file vector.cc.

## ◆ CalculateDistanceSquared

 double CalculateDistanceSquared ( const Vector3D & a, const Vector3D & b )
friend

Calculate the squared Cartesian distance between two points.

Parameters
 [in] a One point [in] b Another point
Returns
The distance between a and b.

Definition at line 118 of file vector.cc.

## ◆ MakeVectorAccessor() [1/2]

 ns3::Ptr< const ns3::AttributeAccessor > MakeVectorAccessor ( T1 a1 )
related

Create an AttributeAccessor for a class data member, or a lone class get functor or set method.

The get functor method should have a signature like

typedef U (T::*getter)(void) const

where T is the class and U is the type of the return value.

The set method should have one of these signatures:

typedef void (T::*setter)(U)
typedef bool (T::*setter)(U)

where T is the class and U is the type of the value to set the attribute to, which should be compatible with the specific AttributeValue type V which holds the value (or the type implied by the name `Make<V>Accessor` of this function.) In the case of a setter returning bool, the return value should be `true` if the value could be set successfully.

Template Parameters
 V [explicit] (If present) The specific AttributeValue type to use to represent the Attribute. (If not present, the type V is implicit in the name of this function, as "MakeAccessor" T1 [deduced] The type of the class data member, or the type of the class get functor or set method.
Parameters
 [in] a1 The address of the data member, or the get or set method.
Returns
The AttributeAccessor
AttributeAccessor

Definition at line 354 of file vector.h.

## ◆ MakeVectorAccessor() [2/2]

 ns3::Ptr< const ns3::AttributeAccessor > MakeVectorAccessor ( T1 a1, T2 a2 )
related

Create an AttributeAccessor using a pair of get functor and set methods from a class.

The get functor method should have a signature like

typedef U (T::*getter)(void) const

where T is the class and U is the type of the return value.

The set method should have one of these signatures:

typedef void (T::*setter)(U)
typedef bool (T::*setter)(U)

where T is the class and U is the type of the value to set the attribute to, which should be compatible with the specific AttributeValue type V which holds the value (or the type implied by the name `Make<V>Accessor` of this function.) In the case of a setter returning bool, the return value should be true if the value could be set successfully.

In practice the setter and getter arguments can appear in either order, but setter first is preferred.

Template Parameters
 V [explicit] (If present) The specific AttributeValue type to use to represent the Attribute. (If not present, the type V is implicit in the name of this function as "MakeAccessor" T1 [deduced] The type of the class data member, or the type of the class get functor or set method. T2 [deduced] The type of the getter class functor method.
Parameters
 [in] a2 The address of the class method to set the attribute. [in] a1 The address of the data member, or the get or set method.
Returns
The AttributeAccessor
AttributeAccessor

Definition at line 354 of file vector.h.

## ◆ MakeVectorChecker()

 Ptr< const AttributeChecker > MakeVectorChecker ( void )
related
Returns
The AttributeChecker.
AttributeChecker

Definition at line 41 of file vector.cc.

## ◆ operator!=

 bool operator!= ( const Vector3D & a, const Vector3D & b )
friend

Inequality operator.

Parameters
 [in] a lhs vector. [in] b rhs vector.
Returns
`true` if a is not equal to b.

Definition at line 171 of file vector.cc.

## ◆ operator+

 Vector3D operator+ ( const Vector3D & a, const Vector3D & b )
friend

Parameters
 [in] a lhs vector. [in] b rhs vector.
Returns
The vector sum of a and b.

Definition at line 176 of file vector.cc.

## ◆ operator-

 Vector3D operator- ( const Vector3D & a, const Vector3D & b )
friend

Subtraction operator.

Parameters
 [in] a lhs vector. [in] b rhs vector.
Returns
The vector difference of a and b.

Definition at line 181 of file vector.cc.

## ◆ operator<

 bool operator< ( const Vector3D & a, const Vector3D & b )
friend

Less than comparison operator.

Parameters
 [in] a lhs vector [in] b rhs vector
Returns
`true` if a is less than b

Definition at line 146 of file vector.cc.

## ◆ operator<<

 std::ostream& operator<< ( std::ostream & os, const Vector3D & vector )
friend

Output streamer.

Vectors are written as "x:y:z".

Parameters
 [in,out] os The stream. [in] vector The vector to stream
Returns
The stream.

Definition at line 130 of file vector.cc.

## ◆ operator<=

 bool operator<= ( const Vector3D & a, const Vector3D & b )
friend

Less than or equal to comparison operator.

Parameters
 [in] a lhs vector [in] b rhs vector
Returns
`true` if a is less than or equal to b.

Definition at line 151 of file vector.cc.

## ◆ operator==

 bool operator== ( const Vector3D & a, const Vector3D & b )
friend

Equality operator.

Parameters
 [in] a lhs vector. [in] b rhs vector.
Returns
`true` if a is equal to b.

Definition at line 166 of file vector.cc.

## ◆ operator>

 bool operator> ( const Vector3D & a, const Vector3D & b )
friend

Greater than comparison operator.

Parameters
 [in] a lhs vector [in] b rhs vector
Returns
`true` if a is greater than b.

Definition at line 156 of file vector.cc.

## ◆ operator>=

 bool operator>= ( const Vector3D & a, const Vector3D & b )
friend

Greater than or equal to comparison operator.

Parameters
 [in] a lhs vector [in] b rhs vector
Returns
`true` if a is greater than or equal to b.

Definition at line 161 of file vector.cc.

## ◆ operator>>

 std::istream& operator>> ( std::istream & is, Vector3D & vector )
friend

Input streamer.

Vectors are expected to be in the form "x:y:z".

Parameters
 [in,out] is The stream. [in] vector The vector.
Returns
The stream.

Definition at line 135 of file vector.cc.

## ◆ Vector

 typedef Vector3D Vector
related

Vector alias typedef for compatibility with mobility models.

Definition at line 324 of file vector.h.

## ◆ VectorChecker

 typedef Vector3DChecker VectorChecker
related

Vector alias typedef for compatibility with mobility models.

Definition at line 336 of file vector.h.

## ◆ VectorValue

 typedef Vector3DValue VectorValue
related

Vector alias typedef for compatibility with mobility models.

Definition at line 330 of file vector.h.

## ◆ x

 double ns3::Vector3D::x

## ◆ y

 double ns3::Vector3D::y

y coordinate of vector

Definition at line 60 of file vector.h.

## ◆ z

 double ns3::Vector3D::z

z coordinate of vector

Definition at line 61 of file vector.h.

The documentation for this class was generated from the following files: