Paraview PTSReader misses the first point

I try to read .pts file in the Paraview.
here is one point in the test.pts file. the content is as follows:
7.75 14.28 19.08

Based on the source code here

There should be one point read in the Paraview.
However, there is no point at all.
image

Furthermore, when I have two points in the test.pts, such as
7.75 14.28 19.08
7.75 14.28 20.08

I will have only 1 point (the 2nd point) in the Paraview.

What need I do to have all points in the .pts file?
Thanks!

Please share your data.

The comments in the source code you link make it a little more clear what is expected:
https://github.com/Kitware/VTK/blob/master/IO/Geometry/vtkPTSReader.cxx#L164
The first line of the .pts file should contain the number of points to be read.

test1.pts (16 Bytes) test2.pts (18 Bytes)

Here are two test .pts files.
Each file has only one point.

test1.pts has point only.
test2.pts has the # of points at the first line.

I tried both formats. You can find two test files in this thread.

Furthermore,


It also shows that we can have points-only content.

Cool - do you see any issue with the code?

I just looked through the code.
The issue may be here:

let’s say onRatio = 1.0
when we process the first point,
lastCount = 0
i = 0
i * onRatio = 0
floor(i * onRatio) > lastCount is always false, lastCount remains 0
we miss the 1st point

however, in the following points
lastCount = 0
i = 1
i * onRatio = 1.0
floor(i * onRatio) > lastCount is true
we have the 2nd point,
lastCount becomes 1

then, i = 2, etc.

what’s more, even we set the Max Number of points
( onRatio = static_cast(this->MaxNumberOfPoints) / numPts;),
floor(i * onRatio) > lastCount doesn’t work as well IMHO.

I don’t understand why we need onRatio here,
why not use
if (this->MaxNumberOfPoints > lastCount)

But, I haven’t tested it yet. I am not very familiar with Paraview/VTK. And, my current work doesn’t allow me spend more time in debugging the vtkPTSReader. That’s the reason I posted this help-thread. Sorry about that.

It seems that I forgot to @ you in the previous post, please take a look at my previous post.
thank you :slight_smile: