# What is the usage of the first Parameter of vtkPoints::SetPoint method?

**URL:** https://discourse.paraview.org/t/what-is-the-usage-of-the-first-parameter-of-vtkpoints-setpoint-method/255
**Category:** In Situ Support
**Created:** [June 29, 2018, 8:19am UTC](https://discourse.paraview.org/t/what-is-the-usage-of-the-first-parameter-of-vtkpoints-setpoint-method/255 "2018-06-29T08:19:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jchou](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jchou](https://discourse.paraview.org/u/jchou)
#### Post date: [June 29, 2018, 8:19am UTC](https://discourse.paraview.org/t/what-is-the-usage-of-the-first-parameter-of-vtkpoints-setpoint-method/255/1 "2018-06-29T08:19:17Z")

</div>

Hi Everyone,

I am coming from a VisIt visualization world, with some experience on VisIt libsim. I am trying to create a curvilinear grid using ParaView catalyst. To do so, I have checked ParaView Catalyst user guide V2.0. In page 28 of this guide, there is a simple code for building curvilinear grids:

```
vtkStructuredGrid* grid = vtkStructuredGrid::New();
grid->SetExtent(0, 10, 0, 20, 0, 0);
vtkPoints* points = vtkPoints::New();
points->SetNumberOfPoints(11*21);
for(int j=0;j<21;j++)
{
    for(int i=0;i<11;i++)
    {
        points->SetPoint(i+j*11, i, j, 0);
    }
}
grid->SetPoints(points);
points->Delete();

```

Although the whole sample is clear, but I cannot understand the usage of the first parameter of SetPoint method. There is no explanation about it neither in the user guide nor in online documentations of vtkPoints class:

```
void vtkPoints::SetPoint	(	vtkIdType id,
        double x,
        double y,
        double z 
        )		
Definition at line 288 of file vtkPoints.h.

```

Can anybody make me clear about it?

Thanks  
Chou

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [June 29, 2018, 8:28am UTC](https://discourse.paraview.org/t/what-is-the-usage-of-the-first-parameter-of-vtkpoints-setpoint-method/255/2 "2018-06-29T08:28:40Z")

</div>

Sure easily explained.

You can either create a points and then insert them:

```auto
vtkPoints* points = vtkPoints::New();
for (int i=0; i < 10000; ++i)
{
    points->InsertPoint(x, y, z);
}

```

but this means that there will be some internal reallocation occurring when the points get inserted (append to the end).

Or else you pre-dimension the array before:

```auto
points->SetNumberOfPoints(10000);

```

and then set the points in the particular array location:

```auto
for (int i=0; i < 10000; ++i)
{
    points->SetPoint(i, x, y, z);
}

```

---

<div class="post-metadata">

### Author: ![jchou](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jchou](https://discourse.paraview.org/u/jchou)
#### Post date: [June 29, 2018, 8:39am UTC](https://discourse.paraview.org/t/what-is-the-usage-of-the-first-parameter-of-vtkpoints-setpoint-method/255/3 "2018-06-29T08:39:03Z")

</div>

Thanks Mark,

So, this parameter seems to be an index, instead of an Id, right?

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [June 29, 2018, 9:19am UTC](https://discourse.paraview.org/t/what-is-the-usage-of-the-first-parameter-of-vtkpoints-setpoint-method/255/4 "2018-06-29T09:19:41Z")

</div>

Index or Id are the same thing. Later you will refer to these points in your element or cell topology. Eg, your quad element has points (0 5 8 10), which are 0-indexed into the points array.
