A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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)
 
 Vector3D (double _x, double _y, double _z)
 
double GetLength () const
 Compute the length (magnitude) of the vector.
 
double GetLengthSquared () const
 Compute the squared length of the vector.
 

Public Attributes

double x
 x coordinate of vector
 
double y
 y coordinate of vector
 
double z
 z coordinate of vector
 

Friends

double CalculateDistance (const Vector3D &a, const Vector3D &b)
 Calculate the Cartesian distance between two points.
 
double CalculateDistanceSquared (const Vector3D &a, const Vector3D &b)
 Calculate the squared Cartesian distance between two points.
 
bool operator!= (const Vector3D &a, const Vector3D &b)
 Inequality operator.
 
double operator* (const Vector3D &a, const Vector3D &b)
 Dot product operator.
 
Vector3D operator* (const Vector3D &a, double b)
 Scalar multiplication operator.
 
Vector3D operator* (double a, const Vector3D &b)
 Scalar multiplication operator.
 
Vector3D operator+ (const Vector3D &a, const Vector3D &b)
 Addition operator.
 
Vector3D operator- (const Vector3D &a, const Vector3D &b)
 Subtraction operator.
 
bool operator< (const Vector3D &a, const Vector3D &b)
 Less than comparison operator.
 
std::ostream & operator<< (std::ostream &os, const Vector3D &vector)
 Output streamer.
 
bool operator<= (const Vector3D &a, const Vector3D &b)
 Less than or equal to comparison operator.
 
bool operator== (const Vector3D &a, const Vector3D &b)
 Equality operator.
 
bool operator> (const Vector3D &a, const Vector3D &b)
 Greater than comparison operator.
 
bool operator>= (const Vector3D &a, const Vector3D &b)
 Greater than or equal to comparison operator.
 
std::istream & operator>> (std::istream &is, Vector3D &vector)
 Input streamer.
 

Related Symbols

(Note that these are not member symbols.)

typedef Vector3D Vector
 Vector alias typedef for compatibility with mobility models.
 
typedef Vector3DChecker VectorChecker
 Vector alias typedef for compatibility with mobility models.
 
typedef Vector3DValue VectorValue
 Vector alias typedef for compatibility with mobility models.
 

Detailed Description

a 3d vector

See also
Vector3D Attribute

Definition at line 34 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 39 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 47 of file vector.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ GetLength()

double ns3::Vector3D::GetLength ( ) const

Compute the length (magnitude) of the vector.

Returns
the vector length.

Definition at line 70 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 84 of file vector.cc.

References NS_LOG_FUNCTION, x, y, and z.

Friends And Related Symbol 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 98 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 112 of file vector.cc.

◆ 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 176 of file vector.cc.

◆ operator* [1/3]

double operator* ( const Vector3D & a,
const Vector3D & b )
friend

Dot product operator.

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

Definition at line 206 of file vector.cc.

◆ operator* [2/3]

Vector3D operator* ( const Vector3D & a,
double b )
friend

Scalar multiplication operator.

Parameters
[in]alhs vector.
[in]brhs scalar.
Returns
The vector a scaled by b .

Definition at line 194 of file vector.cc.

◆ operator* [3/3]

Vector3D operator* ( double a,
const Vector3D & b )
friend

Scalar multiplication operator.

Parameters
[in]alhs scalar.
[in]brhs vector.
Returns
The vector b scaled by a .

Definition at line 200 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 182 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 188 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 145 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 125 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 170 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 158 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 164 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 133 of file vector.cc.

Member Data Documentation

◆ x

◆ y

◆ z

double ns3::Vector3D::z

z coordinate of vector

Definition at line 50 of file vector.h.

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


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