Metadata-Version: 2.4
Name: transform-base
Version: 0.0.7
Summary: 欧拉角、旋转矩阵、四元数、角轴、UTM/ECEF/ENU 及多格式矩阵计算基础库
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.20
Requires-Dist: pyproj>=3.6
Requires-Dist: PyYAML>=6.0
Requires-Dist: scipy>=1.10
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# transform-base 0.0.7

欧拉角、旋转矩阵、四元数、角轴、外参和 geodesy 工具。这个版本把大写内旋顺序扩展到 SciPy 支持的 6 种顺序，并补了显式 helper。

## 安装

```bash
pip install transform-base
```

## 公开 API

- 0.0.6 的全部公开 API
- `SUPPORTED_INTRINSIC_EULER_ORDERS`
- `intrinsic_euler_to_rotation_matrix`
- `rotation_matrix_to_intrinsic_euler`
- `rotation_z_deg_matrix`

## 顺序规则

- `standard_euler_to_rotation_matrix`、`rotation_matrix_to_standard_euler`、`standard_euler_to_quaternion`、`quaternion_to_standard_euler`、`standard_euler_to_axis_angle`、`axis_angle_to_standard_euler` 和 `ExtrinsicParam(euler_order=...)` 现在都支持 `ZYX`、`XYZ`、`XZY`、`YXZ`、`YZX`、`ZXY`
- 默认仍是 `ZYX`
- 小写顺序、外旋写法或其他未列出的值会直接抛 `ValueError`
- `intrinsic_euler_to_rotation_matrix` / `rotation_matrix_to_intrinsic_euler` 是显式 helper 别名，适合需要把内旋语义写在接口名里的调用方

## 快速开始

```python
from transform_base import (
    ExtrinsicParam,
    SUPPORTED_INTRINSIC_EULER_ORDERS,
    convert_tum_utm_rows_to_enu_rows,
    ecef_to_geodetic,
    ecef_to_enu,
    enu_to_latlon,
    geodetic_pose_to_utm_tum,
    geodetic_to_ecef,
    intrinsic_euler_to_rotation_matrix,
    latlon_to_utm_grs80,
    rotation_matrix_to_intrinsic_euler,
    rotation_z_deg_matrix,
    standard_euler_to_rotation_matrix,
    utm_to_latlon,
)

euler = [10.0, 20.0, 30.0]
for order in SUPPORTED_INTRINSIC_EULER_ORDERS:
    R = intrinsic_euler_to_rotation_matrix(*euler, order=order)
    round_trip = rotation_matrix_to_intrinsic_euler(R, order=order)

R_z = rotation_z_deg_matrix(90.0)
ext = ExtrinsicParam(euler=euler, translation=[1.0, 2.0, 3.0], euler_order="XYZ")
payload = ext.get_homogeneous_matrix()

ecef = geodetic_to_ecef(40.120463671211, 116.24020617119622, 33.895422)
lat, lon, alt = ecef_to_geodetic(*ecef)
east, north, up = ecef_to_enu(*ecef, 40.120463671211, 116.24020617119622, 33.895422)
lat2, lon2, alt2 = enu_to_latlon(east, north, up, 40.120463671211, 116.24020617119622, 33.895422)

pose = geodetic_pose_to_utm_tum(
    lat=22.5096,
    lon=114.0441,
    height=10.0,
    geoid_undulation=1.25,
    roll_deg=10.0,
    pitch_deg=20.0,
    yaw_deg=30.0,
)
easting, northing, zone, northern = latlon_to_utm_grs80(22.5096, 114.0441)
lat3, lon3 = utm_to_latlon(500000.0, 3450000.0, zone=50)
enu_rows = convert_tum_utm_rows_to_enu_rows([
    "1000.000 500000.000 3450000.000 10.000 0 0 0 1",
    "1001.000 500010.000 3450000.000 10.000 0 0 0 1",
])
```

## 版本记录

- 0.0.7：`standard_euler_to_rotation_matrix`、`rotation_matrix_to_standard_euler`、`standard_euler_to_quaternion`、`quaternion_to_standard_euler`、`standard_euler_to_axis_angle`、`axis_angle_to_standard_euler` 和 `ExtrinsicParam(euler_order=...)` 扩展为 6 种大写内旋顺序；新增 `SUPPORTED_INTRINSIC_EULER_ORDERS`、`intrinsic_euler_to_rotation_matrix`、`rotation_matrix_to_intrinsic_euler` 和 `rotation_z_deg_matrix`。
- 0.0.6：把 `latlon_to_utm` / `utm_to_latlon` 的实现统一到缓存 `pyproj.Transformer`；新增 `geodetic_to_ecef`、`ecef_to_geodetic`、`ecef_to_enu`、`enu_to_ecef` 和 `enu_to_latlon`；旋转矩阵、四元数、角轴、外参组合/逆和点变换统一到 SciPy `Rotation`。
- 0.0.5：新增 `latlon_to_utm_grs80`、`euler_rz_ry_rx_to_quaternion`、`UtmTumPose` 和 `geodetic_pose_to_utm_tum`，统一参考 INS 程序的 GRS80 UTM、南北半球、姿态和高度计算。
- 0.0.4：首次公开 `latlon_to_utm`、`utm_to_latlon`、`latlon_to_enu`、`convert_tum_utm_rows_to_enu_rows` 和 `convert_tum_utm_file_to_enu_file`。

## 依赖

- Python >= 3.10
- numpy >= 1.20
- pyproj >= 3.6
- PyYAML >= 6.0
- scipy >= 1.10

## License

MIT

## 设计原则

- [版本无关设计原则](../../design_principle.md)
