vtkPlaneSource 显示的大些,仅用作显示


//注意:这里的中心是0,0,0 要在ACTOR 中设置位置。
vtkNew<vtkPlaneSource> plane1;
plane1->SetCenter(0,0,0);
plane1->SetNormal(normal);
plane1->SetResolution(1, 1);
plane1->Update();

//将plane 里面的点每个都 乘以10
vtkPoints* points = plane1->GetOutput()->GetPoints();
for (int i = 0; i < points->GetNumberOfPoints(); i++)
{
    double p[3];
    points->GetPoint(i, p);
    p[0] *= 500;
    p[1] *= 500;
    p[2] *= 500;
    points->SetPoint(i, p);
}

vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputData(plane1->GetOutput());
mapper->Update();

vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->SetPosition(center);
actor->GetProperty()->SetColor(r, g, b);

m_renderer->AddActor(actor);

 

posted @ 2024-08-16 15:09  lma_o  阅读(11)  评论(0编辑  收藏  举报