A Discrete-Event Network Simulator
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...
 
Vector2D operator+ (const Vector2D &a, const Vector2D &b)
 Addition operator. More...
 
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...
 
std::istream & operator>> (std::istream &is, Vector2D &vector)
 Input streamer. More...
 

Detailed Description

a 2d vector

See also
Vector2D Attribute

Definition at line 128 of file vector.h.

Constructor & Destructor Documentation

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

Create vector (_x, _y)

Definition at line 64 of file vector.cc.

References NS_LOG_FUNCTION.

ns3::Vector2D::Vector2D ( )

Constructor: (0.0, 0.0)

Definition at line 71 of file vector.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

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.

Friends And Related Function Documentation

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

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

Addition operator.

Parameters
[in]alhs vector.
[in]brhs vector.
Returns
The vector sum of a and b.

Definition at line 156 of file vector.cc.

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

Subtraction operator.

Parameters
[in]alhs vector.
[in]brhs vector.
Returns
The vector differend of a less b.

Definition at line 161 of file vector.cc.

bool operator< ( const Vector2D a,
const Vector2D b 
)
friend

Less than comparison operator.

Parameters
[in]alhs vector
[in]brhs vector
Returns
true if a is less than b

Definition at line 150 of file vector.cc.

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

Output streamer.

Vectors are written as "x:y".

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

Definition at line 135 of file vector.cc.

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

Input streamer.

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

Parameters
[in,out]isThe stream.
[in]vectorThe vector.
Returns
The stream.

Definition at line 140 of file vector.cc.

Member Data Documentation


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