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

a 2d vector More...

`#include "vector.h"`

## Public Member Functions

Vector2D (double _x, double _y)

Vector2D ()
Constructor: (0.0, 0.0) More...

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

## Public Attributes

double x
x coordinate of vector More...

double y
y coordinate of vector More...

## Friends

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

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

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

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

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

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

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

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

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

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

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

## Detailed Description

a 2d vector

Vector2D Attribute

Definition at line 168 of file vector.h.

## ◆ Vector2D() [1/2]

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

Create vector (_x, _y)

Definition at line 64 of file vector.cc.

References NS_LOG_FUNCTION.

## ◆ Vector2D() [2/2]

 ns3::Vector2D::Vector2D ( )

Constructor: (0.0, 0.0)

Definition at line 71 of file vector.cc.

References NS_LOG_FUNCTION.

## ◆ GetLength()

 double ns3::Vector2D::GetLength ( ) const

Compute the length (magnitude) of the vector.

Returns
the vector length.

Definition at line 85 of file vector.cc.

References NS_LOG_FUNCTION, x, and y.

Here is the caller graph for this function:

## ◆ CalculateDistance

 double CalculateDistance ( const Vector2D & a, const Vector2D & 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 98 of file vector.cc.

## ◆ operator!=

 bool operator!= ( const Vector2D & a, const Vector2D & 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 199 of file vector.cc.

## ◆ operator+

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

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

Definition at line 204 of file vector.cc.

## ◆ operator-

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

Subtraction operator.

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

Definition at line 209 of file vector.cc.

## ◆ operator<

 bool operator< ( const Vector2D & a, const Vector2D & 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 174 of file vector.cc.

## ◆ operator<<

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

Output streamer.

Vectors are written as "x:y".

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

Definition at line 159 of file vector.cc.

## ◆ operator<=

 bool operator<= ( const Vector2D & a, const Vector2D & 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 179 of file vector.cc.

## ◆ operator==

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

Equality operator.

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

Definition at line 194 of file vector.cc.

## ◆ operator>

 bool operator> ( const Vector2D & a, const Vector2D & 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 184 of file vector.cc.

## ◆ operator>=

 bool operator>= ( const Vector2D & a, const Vector2D & 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 189 of file vector.cc.

## ◆ operator>>

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

Input streamer.

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

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

Definition at line 164 of file vector.cc.

## ◆ x

 double ns3::Vector2D::x

x coordinate of vector

Definition at line 180 of file vector.h.

## ◆ y

 double ns3::Vector2D::y

y coordinate of vector

Definition at line 181 of file vector.h.

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