vtk-js: PointPicker implementation doesn't work for certain lines
Hi,
I’m using the PointPicker as shown in the examples: https://kitware.github.io/vtk-js/examples/PointPicker.html
I get the content of an XML file with VTKFile/PolyData from the API and render that on the client. For this simple case it’s just a structure with 6 points which are connected by 3 lines. What I want to do with the PointPicker is picking one of the six points, show the position and some meta data for the point.
But that works only in some cases. With the following the definition the PointPicker works as expected:
<VTKFile type="PolyData">
<PolyData>
<Piece NumberOfPoints="6" NumberOfLines="3" NumberOfPolys="0">
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii">0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3</DataArray>
</Points>
<PointData>
<DataArray type="Int32" Name="node_ids" NumberOfComponents="1" format="ascii">1 3 3 4 4 2</DataArray>
</PointData>
<CellData Scalars="element_type_cell_colors">
<DataArray type="Int32" Name="element_ids" NumberOfComponents="1" format="ascii">1 2 3</DataArray>
<DataArray type="UInt8" Name="element_type_cell_colors" NumberOfComponents="3" format="ascii">255 0 0 255 0 0 255 0 0</DataArray>
</CellData>
<Lines>
<DataArray type="Int64" Name="connectivity" format="ascii">0 1 2 3 4 5</DataArray>
<DataArray type="Int64" Name="offsets" format="ascii">2 4 6</DataArray>
</Lines>
</Piece>
</PolyData>
</VTKFile>
But for these PolyData definitions the PointPicker doesn’t work! The picker.getActors() function always returns an empty array!
<VTKFile type="PolyData">
<PolyData>
<Piece NumberOfPoints="6" NumberOfLines="3" NumberOfPolys="0">
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii"> 0 1 1 1 1 1 1 1 1 2 1 1 2 1 1 3 1 1</DataArray>
</Points>
<PointData>
<DataArray type="Int32" Name="node_ids" NumberOfComponents="1" format="ascii"> 1 3 3 4 4 2</DataArray>
</PointData>
<CellData Scalars="element_type_cell_colors">
<DataArray type="Int32" Name="element_ids" NumberOfComponents="1" format="ascii">1 2 3</DataArray>
<DataArray type="UInt8" Name="element_type_cell_colors" NumberOfComponents="3" format="ascii"> 255 0 0 255 0 0 255 0 0</DataArray>
</CellData>
<Lines>
<DataArray type="Int64" Name="connectivity" format="ascii"> 0 1 2 3 4 5</DataArray>
<DataArray type="Int64" Name="offsets" format="ascii"> 2 4 6</DataArray>
</Lines>
</Piece>
</PolyData>
</VTKFile>
As you can see the difference between the two models is only in the coordinates of the points. I have tried several other coordinates. It’s also not working with the following point sets:
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii"> 0 0 1 1 0 1 1 0 1 2 0 1 2 0 1 3 0 1</DataArray>
</Points>
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii"> 0 1 0 1 1 0 1 1 0 2 1 0 2 1 0 3 1 0</DataArray>
</Points>
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii"> 0 0 0 1 0 0 1 0 0 2 0 0 2 0 0 3 0 0</DataArray>
</Points>
Is this a known issue? Are there some other possibilities to pick a point from a PolyData model? I have already tried the HardwareSelector approach, but this is not working well.
Thanks and Best Regards, Florian
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (3 by maintainers)
Commits related to this issue
- #1738: add tests for PointPicker with reading from XML PolyData file — committed to goflo/vtk-js by goflo 3 years ago
- #1738: adapt LineSource point picker test to fail — committed to goflo/vtk-js by goflo 3 years ago
- fix(picker): add tolerance when picking box VTK has a tolerance added to the mapper bounds fix #1738 — committed to finetjul/vtk-js by finetjul 3 years ago
- fix(picker): add tolerance when picking box VTK has a tolerance added to the mapper bounds fix #1738 — committed to finetjul/vtk-js by finetjul 3 years ago
- fix(picker): add tolerance when picking box VTK has a tolerance added to the mapper bounds fix #1738 — committed to finetjul/vtk-js by finetjul 3 years ago
@finetjul I let you do the integration. Thanks @goflo for those tests.
BTW, you could write your lineSource setup that way too