[vtkusers] Pick From vtkLineSource added to vtkAppendPolyData

Alex Malyushytskyy alexmalvtk at gmail.com
Thu Sep 12 18:29:33 EDT 2013


Bhanu,

First of all we are talking about polydata (vtkPolyData) where your data is
stored, not grid , not vtkLineSource.
vtkLineSource is just a source which generates polydata cells which
represent the line,
but it does not matter how they were generated.


You  append  polydata which represent the line to existing polydata.

If you had first polydata with 10 triangles (cells) and second with 3 lines
(cells)
result of appending will have 10 triangles followed by 2 lines.

So it is relatively easy to find out where cell data which comes from
second polydata begins (11th to 13 cells ).
But you are free to use any approach you want to recognize objects.

For example
If you set global IDs to both polydata before appending, such  arrays
should be preserved(appended)  and you can use the same approach
If your source creates multiple cells as polydata output and you want to be
able recognize all cells as a single object you might use custom arrays
which would
help you to find the relations.
( in above example set 1 to each cell from 1st polydata, 2 for second  )

Hope this helps,
      Alex



On Thu, Sep 12, 2013 at 8:48 AM, Bhanu Hariharan <bhanu at petrotel.com> wrote:

> Thanks Alex. It would be very helpful if you could please clarify a bit
> more.
>
> My display already has a grid of cells and a vtkCellPicker to pick cells
> in the grid. And I use Picker->GetCellId() to get the cell picked. I map
> the cell id returned using Picker->GetCellId() to a global cell id using
> something like
>
> pickerdataset->GetCellData()->GetGlobalIds()->GetTuple1(m_pidCellID);
>
>
> In the same display I also have Multiple Lines added first to vtkPolydata
> using
>
> do for each Line
>
>           ids->InsertId( linenumber, someId);
>            Lines->InsertNextCell (ids);
>
>            mypolydata->SetPoints(mypoints);
>            mypolydata->SetLines(Lines);  //Lines is the vtkCellArray
>
>            myAppendPolyData->AddInput (mypolydata);
> end do
>
> mymapper ->SetInput( myAppendPolyData->GetOutput());
>
>
> My question is
> 1. Can I use the same vtkCellPicker to pick both grid cells and Lines or
> should I declare 2 different vtkCellPickers
> Picker1 and Picker 2 .
>
> 2. Will the Picker for Lines be used the same WAY as Picker for grid cells.
> That is Can I do Picker->GetCellIId to get the Line Number? And then map
> to back to some Global Line ID?
>
>
> Thanks for your patience and I look forward to your suggestion.
>
> Bhanu
>
>
>
>
> On Wed, Sep 11, 2013 at 7:46 PM, Alex Malyushytskyy <alexmalvtk at gmail.com>wrote:
>
>>
>> vtkPropPicker works only with actors.
>> vtkCellPicker will allow you to identify which cell was picked  in
>> polydata
>>
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Picking/CellPicking
>>
>>
>> Alex
>>
>>
>>
>> On Wed, Sep 11, 2013 at 9:50 AM, Bhanu Hariharan <bhanu at petrotel.com>wrote:
>>
>>> Hello,
>>>
>>>
>>> I was wondering if someone can help me on how to pick Lines added to a
>>> vtkAppendPolyData.
>>> before adding to Mapper and Actor.
>>>
>>> I saw some example where a linesource was added directly to Mapper and
>>> Actor.
>>>
>>> But I have several lines and having an actor for each one will slow
>>> things down considerably. So I use vtkAppendPolyData and add all line
>>> sources to it. I then pass the vtkAppendPolyData thorugh a vtktransform and
>>> vtktube filter before adding to mapper and actor.
>>>
>>> Can someone please tell me if its possible to use vtkPropPicker or
>>> VtkPicker with vtkAppendPolyData.
>>> Also once picked how can I tell which line was picked. Can I assign a
>>> global Id to each line?
>>>
>>> Thanks,
>>> Bhanu
>>>
>>>
>>> ------------------------------
>>> *DISCLAIMER*: This e-mail and any files transmitted with it ("Message")
>>> is intended only for the use of the recipient(s) named above and may
>>> contain confidential information. You are hereby notified that the taking
>>> of any action in reliance upon, or any review, retransmission,
>>> dissemination, distribution, printing or copying of this Message or any
>>> part thereof by anyone other than the intended recipient(s) is strictly
>>> prohibited. If you have received this Message in error, you should delete
>>> this Message immediately and advise the sender by return e-mail. Opinions,
>>> conclusions and other information in this Message that do not relate to the
>>> official business of PETROTEL  or its affiliated Companies shall be
>>> understood as neither given nor endorsed by PETROTEL or any of its
>>> affiliated companies.
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>
> ------------------------------
> *DISCLAIMER*: This e-mail and any files transmitted with it ("Message")
> is intended only for the use of the recipient(s) named above and may
> contain confidential information. You are hereby notified that the taking
> of any action in reliance upon, or any review, retransmission,
> dissemination, distribution, printing or copying of this Message or any
> part thereof by anyone other than the intended recipient(s) is strictly
> prohibited. If you have received this Message in error, you should delete
> this Message immediately and advise the sender by return e-mail. Opinions,
> conclusions and other information in this Message that do not relate to the
> official business of PETROTEL  or its affiliated Companies shall be
> understood as neither given nor endorsed by PETROTEL or any of its
> affiliated companies.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130912/f7c6b420/attachment.htm>


More information about the vtkusers mailing list