角度弧度换算公式:
代码及结果在:cmath 中cos sin等常用函数的坑(弧度角度换算)-CSDN博客
pcl也有自带的rad2deg,deg2rad:
头文件
#include<pcl/common/angles.h>
代码如下
#include <iostream>
#include<pcl/common/angles.h>
int main() {
vector<double> angles = { 45,60,150,180,250,270,360,720,-45,-90,-360,0 };
vector<double> rads = { 0.785397,1.0472,2.61799,3.14159,4.36332,4.71238,6.28318,-0.785397,-1.57079,-6.28318,0 };
cout << "以下是角度转弧度:" << endl;
for (auto angle : angles) {
cout << angle << "->" << pcl::deg2rad(angle) << endl;
}
cout << "以下是弧度转角度" << endl;
for (auto rad : rads) {
cout << rad << "->" << pcl::rad2deg(rad) << endl;
}
return 0;
}
结果: