A Discrete-Event Network Simulator
API
ns3::Vector3D Class Reference

a 3d vector More...

#include "vector.h"

+ Collaboration diagram for ns3::Vector3D:

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)
 Addition operator. More...
 
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

See also
Vector3D Attribute

Definition at line 45 of file vector.h.

Constructor & Destructor Documentation

◆ Vector3D() [1/2]

ns3::Vector3D::Vector3D ( double  _x,
double  _y,
double  _z 
)
Parameters
[in]_xX coordinate of vector
[in]_yY coordinate of vector
[in]_zZ 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.

Member Function Documentation

◆ GetLength()

double ns3::Vector3D::GetLength ( void  ) 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.

Friends And Related Function Documentation

◆ CalculateDistance

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

Calculate the Cartesian distance between two points.

Parameters
[in]aOne point
[in]bAnother 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]aOne point
[in]bAnother 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 "Make<V>Accessor"
T1[deduced] The type of the class data member, or the type of the class get functor or set method.
Parameters
[in]a1The address of the data member, or the get or set method.
Returns
The AttributeAccessor
See also
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 "Make<V>Accessor"
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]a2The address of the class method to set the attribute.
[in]a1The address of the data member, or the get or set method.
Returns
The AttributeAccessor
See also
AttributeAccessor

Definition at line 354 of file vector.h.

◆ MakeVectorChecker()

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

Definition at line 41 of file vector.cc.

References ns3::MakeVector3DChecker(), and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ operator!=

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

Inequality operator.

Parameters
[in]alhs vector.
[in]brhs 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

Addition operator.

Parameters
[in]alhs vector.
[in]brhs 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]alhs vector.
[in]brhs 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]alhs vector
[in]brhs 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]osThe stream.
[in]vectorThe 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]alhs vector
[in]brhs 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]alhs vector.
[in]brhs 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]alhs vector
[in]brhs 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]alhs vector
[in]brhs 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]isThe stream.
[in]vectorThe 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.

Member Data Documentation

◆ x

◆ y

◆ z

double ns3::Vector3D::z

z coordinate of vector

Definition at line 61 of file vector.h.

Referenced by GetLength(), GetLengthSquared(), and showPosition().


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