# vtkPolyData points Data type inconsistency?

**URL:** https://discourse.vtk.org/t/vtkpolydata-points-data-type-inconsistency/13875
**Category:** Support
**Created:** [May 13, 2024, 9:04pm UTC](https://discourse.vtk.org/t/vtkpolydata-points-data-type-inconsistency/13875 "2024-05-13T21:04:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Seun](https://discourse.vtk.org/user_avatar/discourse.vtk.org/seun/32/767_2.png) [@Seun](https://discourse.vtk.org/u/Seun)
#### Post date: [May 13, 2024, 9:04pm UTC](https://discourse.vtk.org/t/vtkpolydata-points-data-type-inconsistency/13875/1 "2024-05-13T21:04:24Z")

</div>

Hi Everyone,

I was wondering if someone could help with this. I am reading a `DXF` file and trying to build a `vtkPolyData` from it. The `DXF` file has coordinates that constitutes points that form a triangle. one of the points coordinate has a value of `9999999999999999999999999999999999999999` which when inspected in the debugger is eventually stored as `1.0E+40` which is fine with me as I would like my values to be `finite`. I’m storing the points as follows

```auto
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
for (int idx = 0; idx < numberOfPoints; idx++)
	{
		double x = m_struct.points[idx].x;
		double y = m_struct.points[idx].y;
		double z = m_struct.points[idx].z;
		points->InsertNextPoint(x, y, z);
	}

vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);

```

where ‘inMeshStruct.points’ is where I stored the data read from the DXF file all above works thus far

However, when I read the same poly data for the points as follows

```auto
vtkSmartPointer<vtkPoints> points = inPolyData->GetPoints();
if (points)
{
	vtkSmartPointer<vtkDataArray> pointsDataArray = points->GetData();
	
        // this returns as FLOAT - even though I never specified it to be (perhaps it defaults to that).
        //pointsDataArray->GetDataType() == VTK_FLOAT

       for (vtkIdType idx = 0; idx < sizePoints; idx++)
	{
		double x = pointsDataArray->GetComponent(idx, 0);
		double y = pointsDataArray->GetComponent(idx, 1);
		double z = pointsDataArray->GetComponent(idx, 2);
		printf("z = %.10f\n", z); //---> issue reported here 
	}
}

```

the previous value of `9999999999999999999999999999999999999999` which was stored as `1.0E+40` is now being reported as `Inf` which isn’t what I expect nor want. Also it’s worth nothing that

`pointsDataArray->GetDataType() returns as VTK_FLOAT`, now could it be that it reports `Inf` for the `z-coordinate` because I’m storing the value read in a `double`?

Could someone shed some light on this, thanks.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [May 14, 2024, 1:22am UTC](https://discourse.vtk.org/t/vtkpolydata-points-data-type-inconsistency/13875/2 "2024-05-14T01:22:36Z")

</div>

Hi Seun,

Yep, `vtkPoints` defaults to `float`. You can create a `vtkPoints` with `double` representation with the code

`vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(VTK_DOUBLE);`

Or you can set the type after creating it

```auto
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
points->SetDataTypeToDouble();

```

Give that a try and see if it handles `1.0E+40` better (it should).

---

<div class="post-metadata">

### Author: ![Seun](https://discourse.vtk.org/user_avatar/discourse.vtk.org/seun/32/767_2.png) [@Seun](https://discourse.vtk.org/u/Seun)
#### Post date: [May 14, 2024, 11:17am UTC](https://discourse.vtk.org/t/vtkpolydata-points-data-type-inconsistency/13875/3 "2024-05-14T11:17:29Z")

</div>

Hi Cory,

It was quite straightforward, indeed the points were defaulting to `float` as you mentioned.  
I tried your suggestion & it worked, now it handles `1.0E+40` better. Thanks a lot.
