a 2d vector More...
#include "vector.h"
Public Member Functions | |
Vector2D () | |
Constructor: (0.0, 0.0) | |
Vector2D (double _x, double _y) | |
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 | |
Friends | |
double | CalculateDistance (const Vector2D &a, const Vector2D &b) |
Calculate the Cartesian distance between two points. | |
double | CalculateDistanceSquared (const Vector2D &a, const Vector2D &b) |
Calculate the squared Cartesian distance between two points. | |
bool | operator!= (const Vector2D &a, const Vector2D &b) |
Inequality operator. | |
double | operator* (const Vector2D &a, const Vector2D &b) |
Dot product operator. | |
Vector2D | operator* (const Vector2D &a, double b) |
Scalar multiplication operator. | |
Vector2D | operator* (double a, const Vector2D &b) |
Scalar multiplication operator. | |
Vector2D | operator+ (const Vector2D &a, const Vector2D &b) |
Addition operator. | |
Vector2D | operator- (const Vector2D &a, const Vector2D &b) |
Subtraction operator. | |
bool | operator< (const Vector2D &a, const Vector2D &b) |
Less than comparison operator. | |
std::ostream & | operator<< (std::ostream &os, const Vector2D &vector) |
Output streamer. | |
bool | operator<= (const Vector2D &a, const Vector2D &b) |
Less than or equal to comparison operator. | |
bool | operator== (const Vector2D &a, const Vector2D &b) |
Equality operator. | |
bool | operator> (const Vector2D &a, const Vector2D &b) |
Greater than comparison operator. | |
bool | operator>= (const Vector2D &a, const Vector2D &b) |
Greater than or equal to comparison operator. | |
std::istream & | operator>> (std::istream &is, Vector2D &vector) |
Input streamer. | |
[in] | _x | X coordinate of vector |
[in] | _y | Y coordinate of vector |
Create vector (_x, _y)
Definition at line 55 of file vector.cc.
References NS_LOG_FUNCTION, x, and y.
Referenced by CalculateDistance, CalculateDistanceSquared, operator!=, operator*, operator*, operator*, operator+, operator-, operator<, operator<<, operator<=, operator==, operator>, operator>=, and operator>>.
ns3::Vector2D::Vector2D | ( | ) |
Constructor: (0.0, 0.0)
Definition at line 62 of file vector.cc.
References NS_LOG_FUNCTION, x, and y.
double ns3::Vector2D::GetLength | ( | ) | const |
Compute the length (magnitude) of the vector.
Definition at line 77 of file vector.cc.
References NS_LOG_FUNCTION, x, and y.
Referenced by ns3::ThreeGppPropagationLossModel::GetShadowing().
double ns3::Vector2D::GetLengthSquared | ( | ) | const |
Compute the squared length of the vector.
Definition at line 91 of file vector.cc.
References NS_LOG_FUNCTION, x, and y.
Calculate the Cartesian distance between two points.
[in] | a | One point |
[in] | b | Another point |
Definition at line 105 of file vector.cc.
References Vector2D(), and NS_LOG_FUNCTION.
Calculate the squared Cartesian distance between two points.
[in] | a | One point |
[in] | b | Another point |
Definition at line 119 of file vector.cc.
References Vector2D(), and NS_LOG_FUNCTION.
Inequality operator.
[in] | a | lhs vector. |
[in] | b | rhs vector. |
true
if a is not equal to b. Definition at line 261 of file vector.cc.
References Vector2D().
Dot product operator.
[in] | a | lhs vector. |
[in] | b | rhs vector. |
Definition at line 291 of file vector.cc.
References Vector2D(), x, and y.
Scalar multiplication operator.
[in] | a | lhs vector. |
[in] | b | rhs scalar. |
Definition at line 279 of file vector.cc.
References Vector2D(), x, and y.
Scalar multiplication operator.
[in] | a | lhs scalar. |
[in] | b | rhs vector. |
Definition at line 285 of file vector.cc.
References Vector2D(), x, and y.
Addition operator.
[in] | a | lhs vector. |
[in] | b | rhs vector. |
Definition at line 267 of file vector.cc.
References Vector2D(), x, and y.
Subtraction operator.
[in] | a | lhs vector. |
[in] | b | rhs vector. |
Definition at line 273 of file vector.cc.
References Vector2D(), x, and y.
Less than comparison operator.
[in] | a | lhs vector |
[in] | b | rhs vector |
true
if a is less than b Definition at line 230 of file vector.cc.
References Vector2D(), x, and y.
|
friend |
Output streamer.
Vectors are written as "x:y".
[in,out] | os | The stream. |
[in] | vector | The vector to stream |
Definition at line 211 of file vector.cc.
References Vector2D().
Less than or equal to comparison operator.
[in] | a | lhs vector |
[in] | b | rhs vector |
true
if a is less than or equal to b. Definition at line 236 of file vector.cc.
References Vector2D(), x, and y.
Equality operator.
[in] | a | lhs vector. |
[in] | b | rhs vector. |
true
if a is equal to b. Definition at line 255 of file vector.cc.
References Vector2D(), x, and y.
Greater than comparison operator.
[in] | a | lhs vector |
[in] | b | rhs vector |
true
if a is greater than b. Definition at line 243 of file vector.cc.
References Vector2D(), x, and y.
Greater than or equal to comparison operator.
[in] | a | lhs vector |
[in] | b | rhs vector |
true
if a is greater than or equal to b. Definition at line 249 of file vector.cc.
References Vector2D(), x, and y.
|
friend |
Input streamer.
Vectors are expected to be in the form "x:y".
[in,out] | is | The stream. |
[in] | vector | The vector. |
Definition at line 219 of file vector.cc.
References Vector2D().
double ns3::Vector2D::x |
x coordinate of vector
Definition at line 207 of file vector.h.
Referenced by Vector2D(), Vector2D(), visualizer.svgitem.SvgItem::do_get_property(), visualizer.svgitem.SvgItem::do_set_property(), visualizer.svgitem.SvgItem::do_simple_is_item_at(), visualizer.svgitem.SvgItem::do_simple_paint(), GetLength(), GetLengthSquared(), operator*, operator*, operator*, operator+, operator-, operator<, operator<=, operator==, operator>, and operator>=.
double ns3::Vector2D::y |
y coordinate of vector
Definition at line 208 of file vector.h.
Referenced by Vector2D(), Vector2D(), visualizer.svgitem.SvgItem::do_get_property(), visualizer.svgitem.SvgItem::do_set_property(), visualizer.svgitem.SvgItem::do_simple_is_item_at(), visualizer.svgitem.SvgItem::do_simple_paint(), GetLength(), GetLengthSquared(), operator*, operator*, operator*, operator+, operator-, operator<, operator<=, operator==, operator>, and operator>=.