cpp_robotics::Vector2
2次元のベクトル More...
#include <vector2.hpp>
Public Types
Name | |
---|---|
using FLOATING_TYPE | value_type |
Public Functions
Name | |
---|---|
Vector2() =default Construct a new Vector 2 object. |
|
constexpr | Vector2(value_type vx, value_type vy) Construct a new Vector 2 object. |
constexpr | Vector2(const Vector2 & ) =default Construct a new Vector 2 object. |
constexpr void | set(const value_type vx, const value_type vy) 値の代入 |
void | set_polar(const value_type radius, const value_type theta) 極形式での値の代入 |
constexpr value_type | dot(const Vector2 & v) const |
constexpr value_type | cross(const Vector2 & v) const |
constexpr value_type | norm_sq() const |
constexpr value_type | norm() const ベクトルの大きさを返す |
void | normalize() 単位ベクトル化 |
constexpr value_type | angle() const ベクトルの角度を返す |
constexpr Vector2 | get_normalized() 単位ベクトル化したベクトルを返す |
void | rotate(const value_type theta) 原点中心に回転 |
constexpr Vector2 | get_rotated(const value_type theta) const 原点中心に回転させたベクトルを返す |
constexpr bool | is_zero() const |
constexpr bool | has_nan() const |
constexpr Vector2 | yx() const |
constexpr Vector2 | nyx() const |
constexpr Vector2 | ynx() const |
constexpr Vector2 | nxy() const |
constexpr Vector2 | xny() const |
constexpr Vector2 | lerp(const Vector2 & b, const value_type t) const |
constexpr Vector2 | operator+() const |
constexpr Vector2 | operator-() const |
constexpr bool | operator==(const Vector2 & v) const |
constexpr bool | operator!=(const Vector2 & v) const |
constexpr Vector2 | operator+(const Vector2 & v) const |
constexpr Vector2 | operator-(const Vector2 & v) const |
constexpr Vector2 & | operator+=(const Vector2 & v) |
constexpr Vector2 & | operator-=(const Vector2 & v) |
constexpr Vector2 & | operator*=(const value_type value) |
constexpr Vector2 & | operator/=(const value_type value) |
value_type & | operator[](const size_t index) |
constexpr value_type | operator[](const size_t index) const |
constexpr value_type | dot(const Vector2 & a, const Vector2 & b) |
constexpr value_type | angle(const Vector2 & a, const Vector2 & b) |
constexpr value_type | distance(const Vector2 & a, const Vector2 & b) |
constexpr Vector2 | lerp(const Vector2 & a, const Vector2 & b, const value_type t) |
constexpr Vector2 | zero() |
constexpr Vector2 | up() |
constexpr Vector2 | down() |
constexpr Vector2 | right() |
constexpr Vector2 | left() |
Public Attributes
Name | |
---|---|
value_type | x |
value_type | y |
Friends
Name | |
---|---|
constexpr friend Vector2 | operator/(const Vector2 & v, const value_type value) |
constexpr friend Vector2 | operator*(const Vector2 & v, const Scaler s) |
constexpr friend Vector2 | operator*(const Scaler s, const Vector2 & v) |
Detailed Description
template <typename FLOATING_TYPE >
struct cpp_robotics::Vector2;
2次元のベクトル
Public Types Documentation
using value_type
using cpp_robotics::Vector2< FLOATING_TYPE >::value_type = FLOATING_TYPE;
Public Functions Documentation
function Vector2
Vector2() =default
Construct a new Vector 2 object.
function Vector2
inline constexpr Vector2(
value_type vx,
value_type vy
)
Construct a new Vector 2 object.
Parameters:
- vx
- vy
function Vector2
constexpr Vector2(
const Vector2 &
) =default
Construct a new Vector 2 object.
Parameters:
- v
function set
inline constexpr void set(
const value_type vx,
const value_type vy
)
値の代入
Parameters:
- vx value_type
- vy
function set_polar
inline void set_polar(
const value_type radius,
const value_type theta
)
極形式での値の代入
Parameters:
- radius 半径
- theta 角度[rad]
function dot
inline constexpr value_type dot(
const Vector2 & v
) const
Parameters:
- v
Return: constexpr value_type
function cross
inline constexpr value_type cross(
const Vector2 & v
) const
Parameters:
- v
Return: constexpr value_type
function norm_sq
inline constexpr value_type norm_sq() const
Return: constexpr value_type
function norm
inline constexpr value_type norm() const
ベクトルの大きさを返す
Return: value_type
function normalize
inline void normalize()
単位ベクトル化
function angle
inline constexpr value_type angle() const
ベクトルの角度を返す
Return: value_type
function get_normalized
inline constexpr Vector2 get_normalized()
単位ベクトル化したベクトルを返す
Return: Vector2
function rotate
inline void rotate(
const value_type theta
)
原点中心に回転
Parameters:
- theta [rad]
function get_rotated
inline constexpr Vector2 get_rotated(
const value_type theta
) const
原点中心に回転させたベクトルを返す
Parameters:
- theta
Return: Vector2
function is_zero
inline constexpr bool is_zero() const
Return:
- true
- false
function has_nan
inline constexpr bool has_nan() const
Return:
- true
- false
function yx
inline constexpr Vector2 yx() const
Return: constexpr Vector2
function nyx
inline constexpr Vector2 nyx() const
Return: constexpr Vector2
function ynx
inline constexpr Vector2 ynx() const
Return: constexpr Vector2
function nxy
inline constexpr Vector2 nxy() const
function xny
inline constexpr Vector2 xny() const
function lerp
inline constexpr Vector2 lerp(
const Vector2 & b,
const value_type t
) const
Parameters:
- b
- t
Return: constexpr Vector2
function operator+
inline constexpr Vector2 operator+() const
Return: constexpr Vector2
function operator-
inline constexpr Vector2 operator-() const
Return: constexpr Vector2
function operator==
inline constexpr bool operator==(
const Vector2 & v
) const
Parameters:
- v
Return:
- true
- false
function operator!=
inline constexpr bool operator!=(
const Vector2 & v
) const
Parameters:
- v
Return:
- true
- false
function operator+
inline constexpr Vector2 operator+(
const Vector2 & v
) const
Parameters:
- v
Return: Vector2
function operator-
inline constexpr Vector2 operator-(
const Vector2 & v
) const
Parameters:
- v
Return: Vector2
function operator+=
inline constexpr Vector2 & operator+=(
const Vector2 & v
)
Parameters:
- v
Return: Vector2&
function operator-=
inline constexpr Vector2 & operator-=(
const Vector2 & v
)
Parameters:
- v
Return: Vector2&
function operator*=
inline constexpr Vector2 & operator*=(
const value_type value
)
Parameters:
- value
Return: Vector2&
function operator/=
inline constexpr Vector2 & operator/=(
const value_type value
)
Parameters:
- value
Return: Vector2&
function operator[]
inline value_type & operator[](
const size_t index
)
Parameters:
- index
Return: value_type&
function operator[]
inline constexpr value_type operator[](
const size_t index
) const
Parameters:
- index
Return: constexpr value_type
function dot
static inline constexpr value_type dot(
const Vector2 & a,
const Vector2 & b
)
Parameters:
- a
- b
Return: constexpr value_type
function angle
static inline constexpr value_type angle(
const Vector2 & a,
const Vector2 & b
)
Parameters:
- a
- b
Return: value_type
function distance
static inline constexpr value_type distance(
const Vector2 & a,
const Vector2 & b
)
Parameters:
- a
- b
Return: value_type
function lerp
static inline constexpr Vector2 lerp(
const Vector2 & a,
const Vector2 & b,
const value_type t
)
Parameters:
- a
- b
- t
Return: constexpr Vector2
function zero
static inline constexpr Vector2 zero()
Return: const Vector2
function up
static inline constexpr Vector2 up()
Return: const Vector2
function down
static inline constexpr Vector2 down()
Return: const Vector2
function right
static inline constexpr Vector2 right()
Return: const Vector2
function left
static inline constexpr Vector2 left()
Return: const Vector2
Public Attributes Documentation
variable x
value_type x;
variable y
value_type y;
Friends
friend operator/
friend constexpr friend Vector2 operator/(
const Vector2 & v,
const value_type value
);
Parameters:
- value
Return: Vector2
friend operator*
friend constexpr friend Vector2 operator*(
const Vector2 & v,
const Scaler s
);
Parameters:
- v
- s
Template Parameters:
- Scaler
Return: constexpr Vector2
friend operator*
friend constexpr friend Vector2 operator*(
const Scaler s,
const Vector2 & v
);
Parameters:
- s
- v
Template Parameters:
- Scaler
Return: constexpr Vector2
Updated on 2024-05-28 at 06:55:40 +0000