[vtkusers] In vtkCellPicker assertion from GetCellType fails
David E DeMarle
dave.demarle at kitware.com
Wed Sep 19 14:53:34 EDT 2018
You might try and bypass the problem by setting the actor for the point
cloud to be non pickable.
David E DeMarle
21 Corporate Drive
Clifton Park, NY 12065-8662
On Mon, Sep 17, 2018 at 4:38 PM Jaspar Löchte <jstach at uni-osnabrueck.de>
> Hello there!
> I use VTK 6.3 in a project for my thesis in an Qt desktop application.
> I am storing Pointclouds and do some manipulation, calculating hulls, etc.
> For the hulls I display some vtkLines in an extra vtkActor and wanted to
> create a possiblity to modify the polygon.
> Therfore i want to be able to move points AND want to pick lines and
> create a new Point on the line to be able to move that one to.
> So I wanted to use the vtkCellPicker to pick the lines (which works quite
> well so far …).
> Since I needed a ContextMenu in Qt I manipulated the MouseEvents and use
> them allready in the Qt MainWindow. Like this:
> In my Code I want to detect a vtkLine with this vtkCellPicker, like this:
> m_picker->Pick(x, y, 0, m_mainStyle->GetDefaultRenderer());
> long l = m_cicker->GetCellId();
> if(l > 0)
> vtkSmartPointer<vtkActor> actor = m_picker->GetActor();
> long O = actor->GetMapper()->GetInput()->GetCellType(l);
> if(O == 3)
> vtkSmartPointer<vtkLine> line =
> vtkSmartPointer<vtkPoints> points = line->GetPoints();
> double p;
> if(points->GetNumberOfPoints() > 0)
> for(int i = 0; i < points->GetNumberOfPoints(); i++)
> points->GetPoint(i, p);
> std::cout << "(" << p << ", " << p << ", " << p << ")" <<
> As I said … this works pretty well, except for any random points, the
> CellPicker also picks vertices from the Pointcloud (CellType == 1) and on
> random points my program crashes, because of an assertion fail …
> I found out that the call to vtkCellPicker::Pick() calls superclass vtkPicker::Pick()
> and there is a call to IntersectWithLine() from the CellPicker, in this
> function the call to IntersectActorWithLine() calls in line 414 this one
> int cellType = data->GetCellType(cellId); … and here I get the assertion
> T vtkDataArrayTemplate<T>::GetValue(vtkIdType) [with T = unsigned char;
> vtkIdType = long long int]: Assertion `id >= 0 && id < this->Size' failed.
> Refered to
> I really don’t know how to debug this, and why this happens.
> Any Ideas for me?
> If there is anything not clear - ask me, I can try to go more into detail,
> give more Code, or something like that.
> Thank you!
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers