level 7
@ 又是一年春冬天
//利用隐函数创建一个球体
vtkSmartPointer<vtkSphere>pSphere=vtkSphere::New();
pSphere->SetRadius(1.0);
//对隐函进行采样,生成一个结构化的点集
vtkSmartPointer<vtkSampleFunction>pSampltFun=vtkSampleFunction::New();
//设置被采样的隐函数
pSampltFun->SetImplicitFunction(pSphere);
vtkSmartPointer<vtkContourFilter>pContouFilter=vtkContourFilter::New();
pContouFilter->SetInput((vtkDataObject *)pSampltFun->GetOutput());
//隐函数值等于0的表面F(x,y,z)=0
pContouFilter->SetValue(0,0);
2017年01月04日 13点01分
3
level 6
我第一个想法是这样的,先用鼠标确定一个点,然后移动鼠标,捕捉鼠标移动的点,让第二个点绕着第一个点旋转360°,每隔几度确定一个点,最后把所有点连起来,就画成一个圆了。
2017年01月06日 10点01分
4
大哥,怎么做到每隔几度确定一个点?坐标系能改成极坐标么?望回答
2017年01月14日 09点01分
@又是一年春冬天 用vtkTransform中的旋转啊,想转几度转几度
2017年01月15日 00点01分
level 6
这个更好
void CreateCircle( const double& z, const double& radius, const int& resolution, vtkPolyData* polyData )
{
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(); vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
points->SetNumberOfPoints( resolution );
cells->Allocate( 1, resolution );
cells->InsertNextCell( resolution );
for( int i = 0 ; i < resolution; ++i ) {
double theta = vtkMath::RadiansFromDegrees(360.*i/double(resolution));
double x = radius*cos(theta);
double y = radius*sin(theta);
points->SetPoint( i, x, y, z );
cells->InsertCellPoint( i );
}
polyData->Initialize();
polyData->SetPolys( cells );
polyData->SetPoints( points );
}
2017年01月15日 01点01分
5
实在是太感谢了!!
![[大拇指]](/static/emoticons/u5927u62c7u6307.png)
![[大拇指]](/static/emoticons/u5927u62c7u6307.png)
麻烦大哥了
2017年01月15日 07点01分
怎么样确定原点和起始点呢,我想画一个圆弧
2017年09月26日 01点09分
6666666学习了
2017年10月11日 19点10分
这样的话z轴是不是已经固定了?
2018年07月25日 05点07分