偏航坐标变换与刚体杆臂速度
题目
给定右手系机体系位置 、速度 、角速度 和杆臂 ,计算 是主动旋转,正角从 向 ;不是 NED/ENU 自动转换。
输入
13 个实数:(rad),、、、 各 3 个分量。各输入绝对值不超过 。
输出
的三个分量,随后 的三个分量,共 6 个实数。
示例
输入
0 1 2 3 0 0 0 0 0 1 1 0 0
期望输出
2.0 2.0 3 0.0 1.0 0
在线 C++17 练习
在浏览器编译运行,代码不上传;首次下载约 28 MB。
尚未运行
运行环境
Clang 22 / C++17 / WASI,支持本题所需标准库;不支持线程、C++ 异常或任意宿主系统访问。每例 2 秒、256 MiB 线性内存、64 KiB 输出;编译器另占浏览器内存,不适合低内存设备。初次加载最多等待 120 秒,可随时停止。
草稿保存在本浏览器。测试公开,属于本地自测而非防作弊竞赛判题;参考解答不参与运行。所有运行资产均由本站提供。
编译器来源与开源许可参考实现(完成后再展开)
对照自己的推导,检查状态更新顺序、边界条件与单位,而不只比较最终输出。
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <tuple>
#include <limits>
using namespace std;
// Reference implementation: optional; solve the starter before opening.
int main() {
cout << setprecision(17);
double y,r[3],v[3],w[3],l[3];
cin>>y;
for(auto &a:r)cin>>a;
for(auto &a:v)cin>>a;
for(auto &a:w)cin>>a;
for(auto &a:l)cin>>a;
double p[3],u[3];
for(int k=0;k<3;k++) {
p[k]=r[k]+l[k];
u[k]=v[k]+w[(k+1)%3]*l[(k+2)%3]-w[(k+2)%3]*l[(k+1)%3];
}
for(auto a: {
p,u
}
) cout<<cos(y)*a[0]-sin(y)*a[1]<<" "<<sin(y)*a[0]+cos(y)*a[1]<<" "<<a[2]<<" ";
}