1.VTK绘制紫色球体
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
//
#include <vtkSphereSource.h>
void ShapeRender::SphereRender() {
// 创建球体对象
vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
sphere->SetThetaResolution(40);
sphere->SetPhiResolution(40);
// 创建 Mapper
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(sphere->GetOutputPort());
// 创建 Actor
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(1.0, 0.0, 1.0); // 设置颜色为紫色
VTKRender(actor);
}
|
2.效果
文章作者
梵梵爸
上次更新
2024-03-13
许可协议
原创文章,如需转载请注明文章作者和出处。谢谢