# Disconnect endpoints in vtkPolyData

**URL:** https://discourse.vtk.org/t/disconnect-endpoints-in-vtkpolydata/4771
**Category:** Support
**Created:** [December 3, 2020, 8:31am UTC](https://discourse.vtk.org/t/disconnect-endpoints-in-vtkpolydata/4771 "2020-12-03T08:31:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jothybasu\_Selvaraj](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jothybasu_selvaraj/32/695_2.png) [@Jothybasu\_Selvaraj](https://discourse.vtk.org/u/Jothybasu_Selvaraj)
#### Post date: [December 3, 2020, 8:31am UTC](https://discourse.vtk.org/t/disconnect-endpoints-in-vtkpolydata/4771/1 "2020-12-03T08:31:29Z")

</div>

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

 ![Untitled](https://discourse.vtk.org/uploads/default/original/2X/3/32d63457244519b1814d10c02dd55fb40d419426.png)

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joachim_p/32/3272_2.png) [@Joachim\_P](https://discourse.vtk.org/u/Joachim_P)
#### Post date: [December 4, 2020, 12:00am UTC](https://discourse.vtk.org/t/disconnect-endpoints-in-vtkpolydata/4771/2 "2020-12-04T00:00:29Z")

</div>

Jothy,

A polygon is by definition a closed set of line segments. If you want to create a ‘C’ shape, this is a polyline. Then you have to store it in the `Lines` structure of the `vtkPolyData`. Technically you have to replace the call to `arc->SetPolys(cells);` by `arc->SetLines(cells);`.

Hope this helps,  
Joachim

---

<div class="post-metadata">

### Author: ![Jothybasu\_Selvaraj](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jothybasu_selvaraj/32/695_2.png) [@Jothybasu\_Selvaraj](https://discourse.vtk.org/u/Jothybasu_Selvaraj)
#### Post date: [December 4, 2020, 8:15am UTC](https://discourse.vtk.org/t/disconnect-endpoints-in-vtkpolydata/4771/3 "2020-12-04T08:15:21Z")

</div>

Thanks a lot, will try.
