Select Cells Through with Polygon

I am trying to select cells using a polygon on a surface mesh. My issue is that the “Select Cells With Polygon” seems to be missing certain triangles inside the polygon. I can’t quite figure out what is causing this behavior as it seems to be grabbing cells almost randomly. I feel like I need something that would be like a Select Cells Through with Polygon.

Using the trace function inside Paraview I’m having difficulty understanding what the Polygon(x1, y1, x2, y2… xn, yn) pairs are representing. They are much different than the point x, y coordinates from the mesh, so I’m not sure what coordinate system they are using. I was going to dump this polygon out and do a point inside polygon script to select and change these cells with a script outside of Paraview but without being able to convert these to my spatial coordinates I am not able to do this. Any help would be greatly appreciated!

Cells that are smaller than a pixel are not selected, this is caused by the way this is implemented using the image.

Select Cells Through with Polygon would indeed fix it, but it does not exist yet sadly.

What are you trying to do exactly ?

I’m trying to select regions of a 2.5D surface mesh of a terrain and change its material type through a plugin (just assigning an integer to different triangles for marking). This is a very easy process when the region is rectangular, but I commonly want to do this with roads that have curves and doing this through a lot of rectangles can be very difficult.
If I could dump the polygon generated through trace and write my own script (or plugin) to change them through checking if points are in the polygon in 2D that would work fine, but I’m having difficulty figuring out how to map these pixels to the real x y coordinate system. Thank you for the response and any help/suggestions would be greatly appreciated!

You can either:

  • Select your cells with a mathemical query
  • Zoom on your dataset when selecting with select with polygon. In tandem with grow selection that may not be too time costly.

I have thought about both of these options. I don’t think there is a way to get something like a road with a mathematical query consistently. If you could base it on surface roughness you might be able to get part of the way there, but I’m not exactly sure how to achieve this.
As far as growing the selection it is possible, but there are no guarantees that it isn’t going to skip an element that is smaller than the pixel size. With millions of elements it is too difficult to visually check and having triangles missing from the mesh tagging wouldn’t be acceptable for our application.
Is there no way to figure out how to transform the polygon coordinates into the real spatial coordinate system? I would like to map Polygon(x1, y1… xn, yn) pixel pairs and have those map to the actual spatial x1, y1… xn, yn pairs but I don’t immediately see how this would be possible.

It will not.

Thank you for your help! It would make the process a lot quicker and easier for other team members if I could develop a different solution based on the polygon coordinates. Is this task not possible?

This is definitely possible with a nicely crafted query based selection. Basically you need to write the equation corresponding to selecting, or not, the polygon. The problem is to have access to the data needed for the selection, which may not be trivial.

So if you are just selecting the cells manually there is no way to use the polygon pairs generated through the trace and get those to spatial coordinates? I’m just not sure how to understand the pixel references in a meaningful way. If you think there is an example that loosely fits my use case maybe it would help, but so far I haven’t been able to find anything. If not, I’ll select the previous answer as the solution. I appreciate your help with this!

Not directly, but you can recover them server side with a filter.

If you think there is an example that loosely fits my use case maybe it would help

I’m afraid not.

It’s less about recovering the coordinates as it is about making sense of them to the actual mesh. If I have the coordinates from the Polygon from the trace, how do I make sense of these x y pairs in terms of the actual x y spatial coordinates on the mesh? That’s the real question that I’m after at this point.

What do you mean by :

XY polygon corrdinates

?

When I’m tracing my polygon selection I see SelectSurfaceCells(Polygon=[19, 639, 28, 634, … ). I would love it if there were a way to transform these pixel values to something spatial that actually corresponds to the xy coordinates on the mesh. I don’t really see how that would be possible though, but I’m just asking just in case.