#include <vector_2d.h>
Public メソッド | |
Vector2D () | |
default constructor. | |
Vector2D (const double &xx, const double &yy) | |
create Vector with XY value directly. | |
bool | valid () const |
check if this vector has validate values. | |
const Vector2D & | assign (const double &xx, const double &yy) |
type conversion operator. alias of valid(). assign XY value directly. | |
const Vector2D & | setPolar (const double &radius, const AngleDeg &dir) |
assign XY value from POLAR value. | |
const Vector2D & | invalidate () |
double | r2 () const |
get the squared length of vector. | |
double | r () const |
get the length of vector. | |
double | length () const |
get the length of vector. | |
AngleDeg | th () const |
get the angle of vector. | |
AngleDeg | dir () const |
get the angle of vector. | |
Vector2D | abs () const |
get new vector that XY values were set to absolute value. | |
double | absX () const |
get absolute x value | |
double | absY () const |
get absolute y value | |
const Vector2D & | add (const double &xx, const double &yy) |
add XY values respectively. | |
const Vector2D & | operator+ () const |
return this vector | |
Vector2D | operator- () const |
create reversed vector | |
const Vector2D & | operator+= (const Vector2D &v) |
add vector to itself | |
const Vector2D & | operator-= (const Vector2D &v) |
subtract vector to itself | |
const Vector2D & | operator *= (const double &scalar) |
multiplied by 'scalar' | |
const Vector2D & | operator/= (const double &scalar) |
divided by 'scalar'. | |
double | dist2 (const Vector2D &p) const |
get the squared distance from this to 'p'. | |
double | dist (const Vector2D &p) const |
get the distance from this to 'p'. | |
const Vector2D & | setLength (const double &len) |
set vector length to 'len'. | |
Vector2D | setLengthVector (const double &len) const |
get new vector that the length is set to 'len' | |
const Vector2D & | normalize () |
normalize vector. length is set to 1.0. | |
Vector2D | norm () const |
get new normalized vector that the length is set to 1.0 but angle is same | |
const Vector2D & | rotate (const double °) |
rotete this vector with 'deg' | |
const Vector2D & | rotate (const AngleDeg &angle) |
rotate this vector with 'angle'. | |
Vector2D | rotatedVector (const double °) const |
get new vector that is rotated by 'deg'. | |
Vector2D | rotatedVector (const AngleDeg &angle) const |
get new vector that is rotated by 'angle'. | |
const Vector2D & | setDir (const AngleDeg &dir) |
set vector's angle to 'angle' | |
double | innerProduct (const Vector2D &v) const |
get inner(dot) product with 'v'. | |
double | outerProduct (const Vector2D &v) const |
get virtal outer(cross) product with 'v'. | |
std::ostream & | print (std::ostream &os) const |
output XY values to ostream. | |
std::ostream & | printRound (std::ostream &os, const double &prec=0.1) const |
output rounded XY values to ostream. | |
Static Public メソッド | |
static Vector2D | polar2vector (const double &mag, const AngleDeg &theta) |
get new Vector created by POLAR value. | |
static Vector2D | from_polar (const double &mag, const AngleDeg &theta) |
get new Vector created by POLAR value. | |
static double | inner_product (const Vector2D &v1, const Vector2D &v2) |
get inner(dot) product for v1 and v2. | |
static double | outer_product (const Vector2D &v1, const Vector2D &v2) |
get outer(cross) product for v1 and v2. | |
Public 変数 | |
double | x |
X coordinate | |
double | y |
Y coordinate | |
Static Public 変数 | |
static const double | ERROR_VALUE |
constant error value for XY (= std::numeric_limits< doulble >::max()). | |
static const Vector2D | INVALIDATED |
invalidated value vector | |
構成 | |
class | AbsXCmp |
comparison predicate for absolute X value. [詳細] | |
class | AbsYCmp |
comparison predicate for absolute Y value. [詳細] | |
class | IsWithin |
template predicate for 2D region sign detection. [詳細] | |
class | XCmp |
comparison predicate for X value. [詳細] | |
class | YCmp |
comparison predicate for Y value. [詳細] |
rcsc::Vector2D::Vector2D | ( | const double & | xx, | |
const double & | yy | |||
) | [inline] |
create Vector with XY value directly.
xx | assigned x value | |
yy | assigned x value |
bool rcsc::Vector2D::valid | ( | ) | const [inline] |
check if this vector has validate values.
const Vector2D& rcsc::Vector2D::assign | ( | const double & | xx, | |
const double & | yy | |||
) | [inline] |
type conversion operator. alias of valid(). assign XY value directly.
xx | assigned x value | |
yy | assigned y value |
assign XY value from POLAR value.
radius | vector's radius | |
dir | vector's angle |
double rcsc::Vector2D::r2 | ( | ) | const [inline] |
get the squared length of vector.
double rcsc::Vector2D::r | ( | ) | const [inline] |
get the length of vector.
double rcsc::Vector2D::length | ( | ) | const [inline] |
get the length of vector.
AngleDeg rcsc::Vector2D::th | ( | ) | const [inline] |
get the angle of vector.
AngleDeg rcsc::Vector2D::dir | ( | ) | const [inline] |
get the angle of vector.
Vector2D rcsc::Vector2D::abs | ( | ) | const [inline] |
get new vector that XY values were set to absolute value.
double rcsc::Vector2D::absX | ( | ) | const [inline] |
get absolute x value
double rcsc::Vector2D::absY | ( | ) | const [inline] |
get absolute y value
const Vector2D& rcsc::Vector2D::add | ( | const double & | xx, | |
const double & | yy | |||
) | [inline] |
add XY values respectively.
xx | added x value | |
yy | added y value |
const Vector2D& rcsc::Vector2D::operator+ | ( | ) | const [inline] |
return this vector
Vector2D rcsc::Vector2D::operator- | ( | ) | const [inline] |
create reversed vector
add vector to itself
v | added vector |
subtract vector to itself
v | subtract argument |
const Vector2D& rcsc::Vector2D::operator *= | ( | const double & | scalar | ) | [inline] |
multiplied by 'scalar'
scalar | multiplication argument |
const Vector2D& rcsc::Vector2D::operator/= | ( | const double & | scalar | ) | [inline] |
divided by 'scalar'.
scalar | division argument |
double rcsc::Vector2D::dist2 | ( | const Vector2D & | p | ) | const [inline] |
get the squared distance from this to 'p'.
p | target point |
double rcsc::Vector2D::dist | ( | const Vector2D & | p | ) | const [inline] |
get the distance from this to 'p'.
p | target point |
const Vector2D& rcsc::Vector2D::setLength | ( | const double & | len | ) | [inline] |
set vector length to 'len'.
len | new length to be set |
Vector2D rcsc::Vector2D::setLengthVector | ( | const double & | len | ) | const [inline] |
get new vector that the length is set to 'len'
len | new length to be set |
const Vector2D& rcsc::Vector2D::normalize | ( | ) | [inline] |
normalize vector. length is set to 1.0.
Vector2D rcsc::Vector2D::norm | ( | ) | const [inline] |
get new normalized vector that the length is set to 1.0 but angle is same
const Vector2D& rcsc::Vector2D::rotate | ( | const double & | deg | ) | [inline] |
rotete this vector with 'deg'
deg | rotated angle by double type |
rotate this vector with 'angle'.
angle | rotated angle |
Vector2D rcsc::Vector2D::rotatedVector | ( | const double & | deg | ) | const [inline] |
get new vector that is rotated by 'deg'.
deg | rotated angle. double type. |
get new vector that is rotated by 'angle'.
angle | rotated angle. |
set vector's angle to 'angle'
dir | new angle to be set |
double rcsc::Vector2D::innerProduct | ( | const Vector2D & | v | ) | const [inline] |
get inner(dot) product with 'v'.
v | target vector |
double rcsc::Vector2D::outerProduct | ( | const Vector2D & | v | ) | const [inline] |
get virtal outer(cross) product with 'v'.
v | target vector |
static Vector2D rcsc::Vector2D::polar2vector | ( | const double & | mag, | |
const AngleDeg & | theta | |||
) | [inline, static] |
get new Vector created by POLAR value.
mag | length of vector | |
theta | angle of vector |
static Vector2D rcsc::Vector2D::from_polar | ( | const double & | mag, | |
const AngleDeg & | theta | |||
) | [inline, static] |
get new Vector created by POLAR value.
mag | length of vector | |
theta | angle of vector |
static double rcsc::Vector2D::inner_product | ( | const Vector2D & | v1, | |
const Vector2D & | v2 | |||
) | [inline, static] |
get inner(dot) product for v1 and v2.
v1 | input 1 | |
v2 | input 2 |
static double rcsc::Vector2D::outer_product | ( | const Vector2D & | v1, | |
const Vector2D & | v2 | |||
) | [inline, static] |
get outer(cross) product for v1 and v2.
v1 | input 1 | |
v2 | input 2 |
std::ostream& rcsc::Vector2D::print | ( | std::ostream & | os | ) | const [inline] |
output XY values to ostream.
os | reference to ostream |
std::ostream& rcsc::Vector2D::printRound | ( | std::ostream & | os, | |
const double & | prec = 0.1 | |||
) | const [inline] |
output rounded XY values to ostream.
os | reference to ostream | |
prec | precision of output value |