Hi All,
I am trying to create an arc suing vtkPolyData and it works well
except I don’t want the ends to be connected. I just want ti to be
like ‘C’. I tried to remove the last point but it still connects the
ends.
Here is the code:
double startAngle=0;
double stopAngle=270;
double radius=400;
vtkSmartPointer<vtkPoints>points =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> cells =
vtkSmartPointer<vtkCellArray>::New();
points->SetNumberOfPoints(270);
cells->InsertNextCell(270);
for(double curAngle=startAngle;curAngle<stopAngle;curAngle++)
{
cells->InsertCellPoint(curAngle);
}
for(double curAngle=startAngle;curAngle<stopAngle;curAngle++)
{
double xCord=radius*cos(vtkMath::RadiansFromDegrees(curAngle));
double yCord=radius*sin(vtkMath::RadiansFromDegrees(curAngle));
points->SetPoint(curAngle,xCord,yCord,0);
qDebug()<<curAngle;
}
vtkSmartPointer<vtkPolyData>arc=
vtkSmartPointer<vtkPolyData>::New();
arc->Initialize();
arc->SetPolys(cells);
arc->SetPoints(points);
vtkSmartPointer<vtkPolyDataMapper>rectangleMapper=
vtkSmartPointer<vtkPolyDataMapper>::New();
rectangleMapper->SetInputData(arc);
vtkSmartPointer<vtkActor>arcActor=
vtkSmartPointer<vtkActor>::New();
arcActor->SetMapper(rectangleMapper);
arcActor->GetProperty()->SetColor(1,1,0);
arcActor->GetProperty()->SetLineWidth(5.0);
arcActor->GetProperty()->SetRepresentationToWireframe();
arcActor->SetOrigin(0,0,0);
arcActor->RotateZ(-90);
arcActor->GetProperty()->EdgeVisibilityOff();
Any hints?
Thanks,
Jothy