Ctrl-Z
一个多线程机器人运动控制强化学习部署框架
载入中...
搜索中...
未找到
z::math 命名空间参考

math namespace, contains some math functions 更多...

class  Tensor
 Tensor class, used to store tensor data 更多...
 
class  Tensor< bool, Dims... >
 Bool Tensor class, used to store bool type tensor data 更多...
 
class  TensorBase
 TensorBase class, base class for tensor 更多...
 
struct  TensorShape
 TensorShape struct, used to store tensor shape information 更多...
 
class  Vector
 Vector class, support some vector operations, like dot, cross, normalize, etc. 更多...
 
class  Vector< bool, N >
 Vector class for bool type, support some vector logical operations etc. 更多...
 

函数

template<typename Scalar>
z::math::Vector< Scalar, 3 > cross (const z::math::Vector< Scalar, 3 > &a, const z::math::Vector< Scalar, 3 > &b)
 cross product of two 3D vectors.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > quat_conjugate (const z::math::Vector< Scalar, 4 > &quat)
 Compute the conjugate of a quaternion.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > quat_unit (const z::math::Vector< Scalar, 4 > &quat)
 Normalize a quaternion to unit length.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > quat_mul (const z::math::Vector< Scalar, 4 > &a, const z::math::Vector< Scalar, 4 > &b)
 Multiply two quaternions.
 
template<typename Scalar>
z::math::Vector< Scalar, 3 > quat_rotate (const z::math::Vector< Scalar, 4 > &q, const z::math::Vector< Scalar, 3 > &v)
 Rotate a 3D vector by a quaternion.
 
template<typename Scalar>
z::math::Vector< Scalar, 3 > quat_rotate_inverse (const z::math::Vector< Scalar, 4 > &q, const z::math::Vector< Scalar, 3 > &v)
 Rotate a 3D vector by the inverse of a quaternion.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > quat_from_euler_xyz (const z::math::Vector< Scalar, 3 > &euler)
 Convert Euler angles (in radians) to quaternion representation.
 
template<typename Scalar>
z::math::Vector< Scalar, 3 > get_euler_xyz (const z::math::Vector< Scalar, 4 > &quat)
 Convert quaternion representation to Euler angles (in radians).
 
template<typename Scalar>
z::math::Vector< Scalar, 3 > so3_from_quat (const z::math::Vector< Scalar, 4 > &quat)
 Convert a quaternion to an so(3) vector representation.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > so3_to_quat (const z::math::Vector< Scalar, 3 > &so3)
 Convert an so(3) vector representation to a quaternion.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > quat_slerp (const z::math::Vector< Scalar, 4 > &a, const z::math::Vector< Scalar, 4 > &b, Scalar t)
 Perform spherical linear interpolation (SLERP) between two quaternions.
 
template<typename Scalar>
z::math::Vector< Scalar, 4 > quat_diff (const z::math::Vector< Scalar, 4 > &a, const z::math::Vector< Scalar, 4 > &b)
 Compute the difference between two quaternions, ensuring the shortest path.
 
template<typename Scalar>
z::math::Vector< Scalar, 3 > so3_diff (const z::math::Vector< Scalar, 3 > &a, const z::math::Vector< Scalar, 3 > &b)
 Compute the difference between two so(3) vectors, ensuring the shortest path.
 
template<typename T, size_t... Ns>
constexpr auto cat (const std::array< T, Ns > &... arrays)
 concatenate multiple std::array
 
template<typename T, size_t ... Ns>
constexpr auto cat (Vector< T, Ns > &... vectors)
 concatenate multiple z Vector
 

详细描述

math namespace, contains some math functions

函数说明

◆ cat() [1/2]

template<typename T, size_t... Ns>
auto z::math::cat ( const std::array< T, Ns > &... arrays)
constexpr

concatenate multiple std::array

模板参数
Ttype
Nslength of arrays
参数
arraysarrays
返回
auto

◆ cat() [2/2]

template<typename T, size_t ... Ns>
auto z::math::cat ( Vector< T, Ns > &... vectors)
constexpr

concatenate multiple z Vector

模板参数
Ttype
Nslength of vectors
参数
vectorsvectors
返回
auto

◆ cross()

template<typename Scalar>
z::math::Vector< Scalar, 3 > z::math::cross ( const z::math::Vector< Scalar, 3 > & a,
const z::math::Vector< Scalar, 3 > & b )

cross product of two 3D vectors.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
a3D vector a
b3D vector b
返回
z::math::Vector<Scalar, 3> Resulting vector from the cross product of a and b.

◆ get_euler_xyz()

template<typename Scalar>
z::math::Vector< Scalar, 3 > z::math::get_euler_xyz ( const z::math::Vector< Scalar, 4 > & quat)

Convert quaternion representation to Euler angles (in radians).

模板参数
ScalarType of the scalar (e.g., float, double).
参数
quatA vector containing the quaternion representation in XYZW format.
返回
z::math::Vector<Scalar, 3> Euler angles in radians, in the order of (roll, pitch, yaw).

◆ quat_conjugate()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::quat_conjugate ( const z::math::Vector< Scalar, 4 > & quat)

Compute the conjugate of a quaternion.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
quatA quaternion represented as a vector in XYZW format.
返回
z::math::Vector<Scalar, 4> Quaternion conjugate in XYZW format.

◆ quat_diff()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::quat_diff ( const z::math::Vector< Scalar, 4 > & a,
const z::math::Vector< Scalar, 4 > & b )

Compute the difference between two quaternions, ensuring the shortest path.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
aquaternion a represented as the first quaternion in XYZW format.
bquaternion b represented as the second quaternion in XYZW format.
返回
z::math::Vector<Scalar, 4> Quaternion representing the difference between a and b, ensuring the shortest path.

◆ quat_from_euler_xyz()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::quat_from_euler_xyz ( const z::math::Vector< Scalar, 3 > & euler)

Convert Euler angles (in radians) to quaternion representation.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
eulerA vector containing the Euler angles in radians, in the order of (roll, pitch, yaw).
返回
z::math::Vector<Scalar, 4> Quaternion representation(XYZW format) of the Euler angles.

◆ quat_mul()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::quat_mul ( const z::math::Vector< Scalar, 4 > & a,
const z::math::Vector< Scalar, 4 > & b )

Multiply two quaternions.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
aA quaternion represented as a vector in XYZW format.
bAnother quaternion represented as a vector in XYZW format.
返回
z::math::Vector<Scalar, 4> Quaternion resulting from the multiplication of a and b, in XYZW format.

◆ quat_rotate()

template<typename Scalar>
z::math::Vector< Scalar, 3 > z::math::quat_rotate ( const z::math::Vector< Scalar, 4 > & q,
const z::math::Vector< Scalar, 3 > & v )

Rotate a 3D vector by a quaternion.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
quatA quaternion represented as a vector in XYZW format.
vecA 3D vector to be rotated by the quaternion.
返回
z::math::Vector<Scalar, 3> Resulting vector after rotation by the quaternion.

◆ quat_rotate_inverse()

template<typename Scalar>
z::math::Vector< Scalar, 3 > z::math::quat_rotate_inverse ( const z::math::Vector< Scalar, 4 > & q,
const z::math::Vector< Scalar, 3 > & v )

Rotate a 3D vector by the inverse of a quaternion.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
quatA quaternion represented as a vector in XYZW format.
vecA 3D vector to be rotated by the inverse of the quaternion.
返回
z::math::Vector<Scalar, 3> Resulting vector after rotation by the inverse of the quaternion.

◆ quat_slerp()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::quat_slerp ( const z::math::Vector< Scalar, 4 > & a,
const z::math::Vector< Scalar, 4 > & b,
Scalar t )

Perform spherical linear interpolation (SLERP) between two quaternions.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
aquaternion a represented as begin interpolation quaternion in XYZW format.
bquaternion b represented as end interpolation quaternion in XYZW format.
tinterpolation parameter, where t = 0 corresponds to a and t = 1 corresponds to b.
返回
z::math::Vector<Scalar, 4> Interpolated quaternion in XYZW format.

◆ quat_unit()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::quat_unit ( const z::math::Vector< Scalar, 4 > & quat)

Normalize a quaternion to unit length.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
quatA quaternion represented as a vector in XYZW format.
返回
z::math::Vector<Scalar, 4> Unit quaternion in XYZW format.
异常
std::runtime_errorIf the quaternion norm is zero, indicating it cannot be normalized.

◆ so3_diff()

template<typename Scalar>
z::math::Vector< Scalar, 3 > z::math::so3_diff ( const z::math::Vector< Scalar, 3 > & a,
const z::math::Vector< Scalar, 3 > & b )

Compute the difference between two so(3) vectors, ensuring the shortest path.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
aso(3) vector a represented as the first vector in 3D space.
bso(3) vector b represented as the second vector in 3D space.
返回
z::math::Vector<Scalar, 3> Vector representing the difference between a and b, ensuring the shortest path.

◆ so3_from_quat()

template<typename Scalar>
z::math::Vector< Scalar, 3 > z::math::so3_from_quat ( const z::math::Vector< Scalar, 4 > & quat)

Convert a quaternion to an so(3) vector representation.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
quatA quaternion represented as a vector in XYZW format.
返回
z::math::Vector<Scalar, 3> so(3) vector representation of the quaternion.

◆ so3_to_quat()

template<typename Scalar>
z::math::Vector< Scalar, 4 > z::math::so3_to_quat ( const z::math::Vector< Scalar, 3 > & so3)

Convert an so(3) vector representation to a quaternion.

模板参数
ScalarType of the scalar (e.g., float, double).
参数
so3A vector representing the so(3) representation of a rotation.
返回
z::math::Vector<Scalar, 4> Quaternion representation of the so(3) vector in XYZW format.