CGAL在三维中按x轴旋转
CGAL rotation by x-axis in 3D
CGAL中是否有预定义的x轴旋转。如果没有,为什么不呢?如果我必须定义它,我会怎么做?
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Aff_transformation_3.h>
#include <cmath>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Aff_transformation_3<Kernel> transform3D;
transform3D rotationX(double angle)
{
const double cosa{cos(angle)};
const double sina{sin(angle)};
return transform3D(
1.0, 0.0, 0.0,
0.0, cosa, -sina,
0.0, sina, cosa);
}
void test()
{
using Point3D = CGAL::Point_3<Kernel>;
Point3D p{1.0,1.0,1.0};
const transform3D rotate{rotationX(M_PI_2)};
rotate(p);
}
要在3D中旋转,可以使用Aff_transformation_3并使用变换矩阵指定变换矩阵。
例如:要在x轴上旋转某个角度x,可以使用以下矩阵:
1 0 0 0
0 cos(x) -sin(x) 0
0 sin(x) cos(x) 0
0 0 0 1
相关文章:
- 如何将三维尺寸不固定的三维阵列展平为一维阵列
- 如何使用qt缩放三维网格
- 三维数组中的C/C++DWORD到BYTE和BYTE到DWORD的转换
- 使用vtkImageReslice重新切片三维原始图像
- 特征:创建一个具有函数的三维阵列
- 扩充矩阵的行缩减-三维样条曲线计算
- 使用pcl transformcloud将三维点平移并旋转到原点
- 用C++从三维矢量中删除元素
- 如何访问CGAL三维三角测量中的面
- 如何在Openscenegraph中从二维鼠标点击的屏幕坐标点计算三维点(世界坐标)
- std::将三维数组复制到三维向量中
- 显示结构的三维数组
- 如何将X 2维数组连接到一个三维阵列中
- 使用unique_ptr来管理三维数组
- 如何访问三维矩阵元素
- Qt OpengL-旋转三维固定场景
- CGAL在三维中按x轴旋转
- 现代C++:简单的三维旋转(运行unix)
- 如果我知道三维中的齐次变换矩阵,如何使用opencv找到旋转和平移的角度
- OpenGL在自己的轴上旋转三维立方体