GaitGeneration by Graph Search
|
3次元の位置ベクトルを表す構造体. [詳解]
#include <math_vector3.h>
公開メンバ関数 | |
constexpr | Vector3 () |
< デフォルトコンストラクタ.(0,0,0)で初期化される. | |
constexpr | Vector3 (const float x_pos, const float y_pos, const float z_pos) |
constexpr | Vector3 (const Vector3 &other)=default |
コピーコンストラクタ. | |
constexpr | Vector3 (Vector3 &&other) noexcept=default |
ムーブコンストラクタ. | |
constexpr Vector3 & | operator= (const Vector3 &other)=default |
代入演算子. | |
~Vector3 ()=default | |
constexpr bool | operator== (const Vector3 &v) const noexcept |
2つのベクトルが等しいかどうかを返す.誤差を許容する. | |
constexpr bool | operator!= (const Vector3 &other) const noexcept |
bool | operator< (const Vector3 &other) const noexcept |
bool | operator> (const Vector3 &other) const noexcept |
bool | operator<= (const Vector3 &other) const noexcept |
bool | operator>= (const Vector3 &other) const noexcept |
constexpr Vector3 | operator+ () const noexcept |
constexpr Vector3 | operator- () const noexcept |
constexpr Vector3 | operator+ (const Vector3 &other) const noexcept |
constexpr Vector3 | operator- (const Vector3 &other) const noexcept |
constexpr Vector3 | operator* (const float num) const noexcept |
constexpr Vector3 | operator/ (const float num) const |
Vector3 & | operator+= (const Vector3 &other) noexcept |
Vector3 & | operator-= (const Vector3 &other) noexcept |
Vector3 & | operator*= (const float num) noexcept |
Vector3 & | operator/= (const float num) |
constexpr float | GetSquaredLength () const noexcept |
ベクトルの長さの2乗を返す. | |
float | GetLength () const noexcept |
ベクトルの長さを返す. | |
constexpr float | Dot (const Vector3 &other) const noexcept |
自分・引数 の内積の結果を返す. | |
constexpr Vector3 | Cross (const Vector3 &other) const noexcept |
自分×引数 の外積の結果を返す. | |
float | GetDistanceFrom (const Vector3 &other) const noexcept |
別のベクトルと,このベクトルの距離を返す. | |
Vector3 | GetNormalized () const noexcept |
単位ベクトルを返す. normalizeとは,ベクトルを正規化(単位ベクトルに変換)する操作を表す. 絶対値が0のベクトルの場合,そのまま0ベクトルを返す. | |
constexpr bool | IsZero () const noexcept |
x,y,zともに絶対値が0ならば true を返す. | |
void | Normalize () noexcept |
このベクトルを正規化する. 絶対値が0のベクトルの場合,そのまま0ベクトルになる. | |
constexpr Vector2 | ProjectedXY () const noexcept |
XY平面に射影したベクトルを返す. | |
std::string | ToString () const |
このベクトルを文字列にして返す. (x, y, z) の形式,小数点以下3桁まで. | |
std::string | ToCsvString () const |
このベクトルをCSV形式の文字列にして返す. x, y, z の形式,小数点以下3桁まで. | |
静的公開メンバ関数 | |
static constexpr Vector3 | GetFrontVec () noexcept |
正面に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetFrontVec() と呼び出せる. | |
static constexpr Vector3 | GetLeftVec () noexcept |
左に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetLeftVec() と呼び出せる. | |
static constexpr Vector3 | GetUpVec () noexcept |
上に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetUpVec() と呼び出せる. | |
static constexpr Vector3 | GetZeroVec () noexcept |
零ベクトルを返す. 静的な関数なので,Vector3::GetZeroVec() と呼び出せる. | |
公開変数類 | |
float | x |
ロボットの正面方向に正. | |
float | y |
ロボットの左向きに正. | |
float | z |
ロボットの上向きに正. | |
3次元の位置ベクトルを表す構造体.
座標系はロボットの進行方向にXの正,ロボットの上向きにZの正, 右手座標系にYをとっている.
ヘッダファイル内に実装を書くのは個人的には避けたいのだが, constexpr関数を使う場合,このようにする必要がある. constexpr関数はコンパイル時に値を計算できることを, コンパイラに伝えるためのものである. (C言語のマクロのような動作ができる) 実行速度が大切なプロジェクトであるため,このように処理を記述する.
math_vector3.h の 39 行目に定義があります。
|
inlineconstexpr |
< デフォルトコンストラクタ.(0,0,0)で初期化される.
math_vector3.h の 42 行目に定義があります。
|
inlineconstexpr |
math_vector3.h の 44 行目に定義があります。
|
constexprdefault |
コピーコンストラクタ.
|
constexprdefaultnoexcept |
ムーブコンストラクタ.
|
default |
自分×引数 の外積の結果を返す.
[in] | other | 外積の掛け算:後ろのベクトル. |
math_vector3.h の 160 行目に定義があります。
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlinestaticconstexprnoexcept |
正面に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetFrontVec() と呼び出せる.
math_vector3.h の 211 行目に定義があります。
|
inlinestaticconstexprnoexcept |
左に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetLeftVec() と呼び出せる.
math_vector3.h の 217 行目に定義があります。
|
inlinenoexcept |
ベクトルの長さを返す.
math_vector3.h の 143 行目に定義があります。
|
noexcept |
単位ベクトルを返す. normalizeとは,ベクトルを正規化(単位ベクトルに変換)する操作を表す.
絶対値が0のベクトルの場合,そのまま0ベクトルを返す.
math_vector3.cpp の 19 行目に定義があります。
|
inlineconstexprnoexcept |
ベクトルの長さの2乗を返す.
math_vector3.h の 134 行目に定義があります。
|
inlinestaticconstexprnoexcept |
上に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetUpVec() と呼び出せる.
math_vector3.h の 223 行目に定義があります。
|
inlinestaticconstexprnoexcept |
零ベクトルを返す. 静的な関数なので,Vector3::GetZeroVec() と呼び出せる.
math_vector3.h の 229 行目に定義があります。
|
inlineconstexprnoexcept |
x,y,zともに絶対値が0ならば true を返す.
math_vector3.h の 182 行目に定義があります。
|
inlinenoexcept |
このベクトルを正規化する.
絶対値が0のベクトルの場合,そのまま0ベクトルになる.
math_vector3.h の 197 行目に定義があります。
|
inlineconstexprnoexcept |
math_vector3.h の 74 行目に定義があります。
|
inlineconstexprnoexcept |
math_vector3.h の 115 行目に定義があります。
|
noexcept |
math_vector3.cpp の 64 行目に定義があります。
|
inlineconstexprnoexcept |
math_vector3.h の 101 行目に定義があります。
|
inlineconstexprnoexcept |
math_vector3.h の 105 行目に定義があります。
math_vector3.cpp の 48 行目に定義があります。
|
inlineconstexprnoexcept |
math_vector3.h の 103 行目に定義があります。
|
inlineconstexprnoexcept |
math_vector3.h の 110 行目に定義があります。
math_vector3.cpp の 56 行目に定義があります。
|
inlineconstexpr |
math_vector3.h の 120 行目に定義があります。
Vector3 & designlab::Vector3::operator/= | ( | const float | num | ) |
math_vector3.cpp の 72 行目に定義があります。
|
inlinenoexcept |
|
inlinenoexcept |
math_vector3.h の 90 行目に定義があります。
|
inlineconstexprnoexcept |
|
inlinenoexcept |
math_vector3.h の 85 行目に定義があります。
|
inlinenoexcept |
math_vector3.h の 95 行目に定義があります。
|
inlineconstexprnoexcept |
std::string designlab::Vector3::ToCsvString | ( | ) | const |
このベクトルをCSV形式の文字列にして返す.
x, y, z の形式,小数点以下3桁まで.
math_vector3.cpp の 41 行目に定義があります。
std::string designlab::Vector3::ToString | ( | ) | const |
このベクトルを文字列にして返す.
(x, y, z) の形式,小数点以下3桁まで.
math_vector3.cpp の 33 行目に定義があります。
float designlab::Vector3::x |
ロボットの正面方向に正.
math_vector3.h の 243 行目に定義があります。
float designlab::Vector3::y |
ロボットの左向きに正.
math_vector3.h の 244 行目に定義があります。
float designlab::Vector3::z |
ロボットの上向きに正.
math_vector3.h の 245 行目に定義があります。