Allocate vs. SetNumberOfPoints

For vtkPoints and other similar objects, when should I use Allocate and when should I use SetNumberOfPoints?

They pretty much do the same stuff. SetNumberOfPoints calls SetNumberOfTuples who calls Allocate. Using SetNumberOfPoints is easier to read so I would stick with that.

Allocate just allocate the memory but leave the number of points to 0. So after that, you can use the InsertXXX methods.

While SetNumberOfPoints allocate and set the number of points, so after, you need to call SetPoint(index, x, y, z).

What’s the unit of a in vtkPoints::Allocate(a) and vtkPolyData::Allocate(a) ?

I would assume it is the number of values in the given vtkDataArray.
So for points you will do points->Allocate(nbPoints * 3).