[vtkusers] vtkPoints + InsertPoint
Bill Chivas
noo134 at googlemail.com
Fri Mar 12 09:36:02 EST 2010
To David:
If it works with only two points, try to put some more (e.g. 10).
In mine, it crashes in 3 or 4 points.
2010/3/12 Bill Chivas <noo134 at googlemail.com>
> Hi David,
>
> try to put
> points->InsertPoint(60983688, 1, 2, 3);
> points->InsertPoint(60983689, 4, 5, 6);
>
> and tell me the results.
>
> In my last reply i just noted a bug (if it is one).
> The problem i have is in the first post.
>
> Can i use SmartPointer if it is a class variable?
>
> Thanks,
> Bill
>
>
> 2010/3/12 David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> >
>
> On Fri, Mar 12, 2010 at 8:48 AM, Bill Chivas <noo134 at googlemail.com>wrote:
>>
>>> Thank you for your replies.
>>>
>>> To everyone:
>>> I did some tests and i think there is a bug.
>>> Let's say i have the following:
>>>
>>> vtkPoints *points = vtkPoints::New();
>>> points->InsertPoint(609836, x, y, z);
>>> points->InsertPoint(609837, x, y, z);
>>> points->InsertPoint(609839, x, y, z);
>>> points->InsertPoint(609838, x, y, z);
>>>
>>> The points->GetNumberOfPoints() gives 609840.
>>> So it supposes that the ids are starting from 0 and it returns (the
>>> max_id of all points plus 1) ?
>>>
>>>
>>>
>> I believe the problem is that you are not calling SetNumberOfPoints before
>> you start inserting points.
>>
>> This code works for me:
>>
>> #include <vtkSmartPointer.h>
>> #include <vtkPoints.h>
>>
>> int main(int argc, char *argv[])
>> {
>> vtkSmartPointer<vtkPoints> points =
>> vtkSmartPointer<vtkPoints>::New();
>> points->SetNumberOfPoints(610000);
>> points->InsertPoint(609836, 1, 2, 3);
>> points->InsertPoint(609837, 4, 5, 6);
>>
>> return EXIT_SUCCESS;
>> }
>>
>> On a separate note, I strongly recommend using SmartPointer's instead of
>> regular points (I used it in the example above).
>>
>> Thanks,
>>
>> David
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100312/a109ab7a/attachment.htm>
More information about the vtkusers
mailing list