#ifndef VTKHSWSPHEREWIDGET_H
#define VTKHSWSPHEREWIDGET_H
/*
* ModuleName: vtkHSWSphereWidget
* Description: 實現球
* Author: hsw
* Date: 2020-03-22
*
*/
#include <vtkSmartPointer.h>
#include <vtkSphereSource.h>
#include <vtkDataSetMapper.h>
class vtkHSWSphereWidget
{
public:
vtkHSWSphereWidget();
~vtkHSWSphereWidget();
public:
vtkSmartPointer<vtkDataSetMapper> createSphere(double* sphereCenter,
double sphereRadius,
int thetaResolution,
int phiResolution);
private:
vtkSmartPointer<vtkSphereSource> _sphereSource;
vtkSmartPointer<vtkDataSetMapper> _sphereMapper;
};
#endif // VTKHSWSPHEREWIDGET_H
#include "vtkhswspherewidget.h"
vtkHSWSphereWidget::vtkHSWSphereWidget()
{
_sphereSource = vtkSmartPointer<vtkSphereSource>::New();
_sphereMapper = vtkSmartPointer<vtkDataSetMapper>::New();
}
vtkHSWSphereWidget::~vtkHSWSphereWidget()
{
// TODO...
}
vtkSmartPointer<vtkDataSetMapper> vtkHSWSphereWidget::createSphere(double *sphereCenter,
double sphereRadius,
int thetaResolution,
int phiResolution)
{
_sphereSource->SetCenter(sphereCenter);
_sphereSource->SetRadius(sphereRadius);
_sphereSource->SetThetaResolution(thetaResolution);
_sphereSource->SetPhiResolution(phiResolution);
_sphereMapper->SetInputConnection(_sphereSource->GetOutputPort());
return _sphereMapper;
}