asin和atan2的区别 (CPA指向相关)

背景

在 CPA 零位系(CPA-Zero) 基础上:

绕 y 轴(俯仰轴) 转动角度 𝜃

再绕 z 轴(方位轴) 转动角度 𝜓

你现在有 CPA 零位系下的单位指向矢量:
P=(Px,Py,Pz)T \mathbf{P} = (P_x, P_y, P_z)^\mathsf{T} P=(Px,Py,Pz)T

并且已知 CPA 的几何关系:
{Px=cos⁡θcos⁡ψ Py=sin⁡ψ Pz=−sin⁡θcos⁡ψ \begin{cases} P_x = \cos\theta \cos\psi \ \\ P_y = \sin\psi \ \\ P_z = -\sin\theta \cos\psi \end{cases} ⎩ ⎨ ⎧Px=cosθcosψ Py=sinψ Pz=−sinθcosψ

(1)ψ=sin⁡−1(Py)\psi = \sin^{-1}(P_y)ψ=sin−1(Py)

这是直接利用第二个分量:

只用了 𝑃𝑦=sin𝜓

本质是在 y--z 平面投影里反算 ψ

它的隐含前提是:cosψ≥0, 也就是ψ∈[−π/2​,π/2​]

(2)

始正切关系式: tan⁡ψ=sin⁡ψcos⁡ψ=PyPx/cos⁡θ \tan \psi = \frac{\sin \psi}{\cos \psi} = \frac{P_y}{P_x / \cos \theta} tanψ=cosψsinψ=Px/cosθPy

简化后得到:[tan⁡ψ=Pycos⁡θPx] [ \tan \psi = \frac{P_y \cos \theta}{P_x} ] [tanψ=PxPycosθ]

使用 atan2 函数完整象限判断的表达式:[ψ=atan2⁡(Pycos⁡θ,Px)] [ \psi = \operatorname{atan2}(P_y \cos \theta, P_x) ][ψ=atan2(Pycosθ,Px)]

输出范围:(−π,π]

结论

反三角函数只给角度值,atan2 给方向。

所以在姿态 / 指向 / 标定问题里:

永远优先 atan2,除非你能 100% 证明 asin 不会出问题。

相关推荐
齐生11 天前
iOS 知识点 - IAP 是怎样的?
笔记
tingshuo29172 天前
D006 【模板】并查集
笔记
tingshuo29173 天前
S001 【模板】从前缀函数到KMP应用 字符串匹配 字符串周期
笔记
西岸行者8 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
starlaky8 天前
Django入门笔记
笔记·django
勇气要爆发8 天前
吴恩达《LangChain LLM 应用开发精读笔记》1-Introduction_介绍
笔记·langchain·吴恩达
悠哉悠哉愿意8 天前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
丽景头牌油墨印花材料8 天前
效率革命:丽景印刷材料有限公司发布晒版机全流程优化方案,引领网印行业生产力跃升
其他
勇气要爆发8 天前
吴恩达《LangChain LLM 应用开发精读笔记》2-Models, Prompts and Parsers 模型、提示和解析器
android·笔记·langchain
qianshanxue118 天前
计算机操作的一些笔记标题
笔记