Locate the normal point on a surface from a given point in world coordinates

I have a polydata of 3D face. I would like to locate the z normal point from a given coordinate. For example, I could get the centre with coordinate x, y, z of the cluster from the nose region. But the point does not fall on the surface of the nose tip. I want to get the coordinate on the surface which is perpendicular to the centre of the cluster that i got.
How can i locate these points in Paraview?

in world coordinates?

What’s that?

I can’t think of a filter that directly computes the intersection of a ray with a polygonal dataset. You can effectively do the same by slicing the polydata with two non-co-planar slices where the ray lies in both planes. There are an infinite number of such planes - you just need two that are not co-planar.

In ParaView, use two Slice filters in succession. You’ll just need to orient the slice planes according to the center coordinate and normal. Details on the math to find those plane normals are left to the reader - any two directions orthogonal to the ray normal will work.

Create the first Slice filter:

Here, the thick white line represents the ray from the center on one end that passes through the surface. You’ll have to compute this from the clustering algorithm. The result of this operation is a polyline where the plane intersects the polydata.

Next, create the second Slice filter, attached to the first:

The plane should be rotated about the ray so it is not coplanar with the first. The result of this filter will consist of a single point and single cell. The bounds of the result of the second slice under the Information tab will tell you the point on the surface. You can also use the SpreadSheet View to see the coordinates of the point on the surface.

1 Like

Thanks for your reply.
Do you have any idea if I can process eg. 50 dataset with same slice coordinates automatically, instead of slicing one by one manually and collect the surface point manually?

Sure. ParaView has Python scripting capabilities to loop over datasets and change properties like Slice coordinates. You can learn more about it in the ParaView Guide. People often use this to process many datasets with the same processing pipeline.

Thanks! I will give it a try! If I fail, I will be back.

1 Like

Using the build-in Python tracing feature is helpful to learning how to create Python scripts. From the Guide:

This guide provides a fair overview of ParaView’s Python API. However, there will be cases when you just want to know how to complete a particular action or sequence of actions that you can do with the GUI using a Python script instead. To accomplish this, paraview supports tracing your actions in the UI as a Python script. Simply start tracing by clicking on Tools -> Start Trace . paraview now enters a mode where all your actions (or at least those relevant for scripting) are monitored. Any time you create a source or filter, open data files, change properties and hit Apply, interact with the 3D scene, or save screenshots, etc., your actions will be monitored. Once you are done with the series of actions that you want to script, click Tools -> Stop Trace. paraview will then pop up an editor window with the generated trace. This will be the Python script equivalent for the actions you performed. You can now save this as a script to use for batch processing.

This sound easier instead of doing the script from scratch. I will give it a try.
I have to find 7 points from one data, I applied each point with 2 normal (x, y) and to collect the coordinates on the surface. I have no idea if i can put in all the 7 points to slice and get the 7 points automatically. And also if the result can be saved under .csv or .txt file?

Definitely possible with scripting.

I could save the coordinates into csv file. But, the saved file contains the whole range of the slice x value. How can I save only the point coordinate that is intersected between x and y normal?

Got it! Solved!

1 Like