您的位置:首页 > 财经 > 产业 > 七台河新闻综合频道节目表_合肥企业建站系统_百度客服人工服务电话_网站seo 优化

七台河新闻综合频道节目表_合肥企业建站系统_百度客服人工服务电话_网站seo 优化

2025/5/24 3:26:57 来源:https://blog.csdn.net/comedate/article/details/142502289  浏览:    关键词:七台河新闻综合频道节目表_合肥企业建站系统_百度客服人工服务电话_网站seo 优化
七台河新闻综合频道节目表_合肥企业建站系统_百度客服人工服务电话_网站seo 优化

VTK 实现旋转,有四元数的方案,也有 vtkTransform 的方案;主要示例代码如下:

    //构造旋转四元数vtkQuaterniond rotation;rotation.SetRotationAngleAndAxis(vtkMath::RadiansFromDegrees(90.0),0.0, 1.0, 0.0);//构造旋转点四元数vtkQuaterniond p;p.Set(0.0,1.0,0.0,0.0);//转置vtkQuaterniond inverse = rotation.Inverse();//计算旋转结果vtkQuaterniond res = rotation*p*inverse;double resdata[4] = {0};res.Get(resdata);
vtkSmartPointer<vtkTransform> trans = vtkSmartPointer<vtkTransform>::New();
trans->PostMultiply();
trans->Translate(1, 0, 0);
trans->RotateZ(45);
import math
import numpy as np
import vtkdef radians_to_degrees(radians):return radians * (180.0 / math.pi)def degrees_to_radians(degree):return degree / 180.0 * math.pi# 示例使用
radians = 1.0
degrees = radians_to_degrees(radians)polyline_pts = [[math.sin(degrees_to_radians(60)), math.cos(degrees_to_radians(60)), 0],[math.sin(degrees_to_radians(30)), math.cos(degrees_to_radians(30)), 0.0]]t = np.cross(np.array(polyline_pts[0]), np.array(polyline_pts[1]))
print(t)print(polyline_pts[0])# 创建点
points = vtk.vtkPoints()
points.InsertNextPoint(0, 0, 0)
points.InsertNextPoint(1, 0, 0)
points.InsertNextPoint(1, 1, 0)
points.InsertNextPoint(0, 1, 0)# 创建单元数组
lines = vtk.vtkCellArray()
lines.InsertNextCell(4)
lines.InsertCellPoint(0)
lines.InsertCellPoint(1)
lines.InsertCellPoint(2)
lines.InsertCellPoint(3)# 创建多边形数据
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.SetLines(lines)# 创建映射器
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(polydata)# 创建actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)# 创建渲染器、渲染窗口和渲染窗口交互器
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)# 添加actor到渲染器并进行渲染
renderer.AddActor(actor)
renderer.SetBackground(0, 0, 0)
renderWindow.SetSize(640, 480)
renderWindow.Render()
renderWindowInteractor.Start()

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com