Hello
I know the existence of the function let cellIds = polydata.getPointCells(i, vtkTriangle);
, where “i” is the pointId. I expect a list of cellIds as output (all cells than contain the point i), but this is not the case. Any hint on how to use this undocumented function?
Regards
Maybe I am asking the wrong question, Here there are other questions with the same goal:
- How can I get the ids of all the cells that contain a known point in a polydata?
- How can I get the neighbour points connected with a known point in a polydata?
Hello,
I believe that’s not the way getPointCells()
is supposed to be called. Take a look at this: https://vtk.org/doc/nightly/html/classvtkPolyData.html#adf9caaa01f72972d9a986ba997af0ac7
take care,
PC
Thanks for your reply
However:
- I am on javascript
- I do call BuildLinks before.
- the function getPointCells does not accept vtlIdList as it doesn’t exists in vtk.js
- The returned object makes no sense to me and I can’t use it as even in the console only shows a common Dataset that I can’t get to work.
Regards
Hello,
You can make use of JS’ reflection/introspection and do some exploratory programming to discover the Dataset
object’s methods and members. For example, to get all methods of the returned object:
(...)
let cellIds = polydata.getPointCells(i, vtkTriangle);
let methods = [];
for(var key in cellIds) {
if(cellIds.hasOwnProperty(key) && typeof cellIds[key] == 'function') {
methods.push(key);
}
}
for (i = 0; i < methods.length; i++)
document.writeln("method number " + (i+1) + ": " + methods[i]);
(...)
Side note: It is recommended to post under the “web” tag, where most vtk.js
talk takes place. The “support” tag is mostly for non-web applications (mostly C++, Java and Python).
best,
PC
1 Like