Center of mass , (center of data)

Hi all ,
I have a set of 3d points that rapresent atoms in a macro molecule , the atoms mass is the same for each atoms in the molecule, there is a way in paraview to found the center of a certain number of point that rapresent my data in a VTK polydata file ? there is no information about mass , I need just to find out the geometric center of the set of 3d points
How can I do that ?

there is not a tools … like filter to compute that points ?

What about CellCenters filter?

@mwestphal I believe the user is asking for the center point of the dataset, not the center point of individual cells.

I believe the filter to do this doesn’t exist. However, you can easily build one. The tools for this are found in the tips and tricks post here: Pointing the camera at the center of a dataset using Python. What you are asking for is the center of the bounds.

yes I need to find the center of the points not the center of cell ! I need to know the coordinate of the center not just to center the camera is it possible ?

You will need to implement that as a Programmable Filter.
https://www.paraview.org/Wiki/Python_Programmable_Filter

I’m have not idea of how to implement … may give me an help ?

The following steps should get you the center of mass (being the average of a set of equally weighted points) without having to write a programmable filter. (It will give you the coordinates but not draw them in the 3D view.)

  1. Add the Calculator filter.
    1.a. Set the Result Array Name to position
    1.b. Set the expression (the text box right above the calculator buttons) to coords.
    1.c Hit Apply. (This will create a field named position containing the coordinates of each point.)
  2. Run the Descriptive Statistics filter. Apply.

Once run, the Descriptive Statistics filter will open up a spreadsheet view showing statistics like mean, min, max, etc. The mean for position_0 (X), position_1 (Y), and position_2 (Z) should give the center of gravity of your molecule. (That is, if I understand your problem correctly.)

7 Likes

Hi,

Thank you for this solution, it works well! However, I have a follow up question. So I have two datasets (two different geometries) with different centroids. Can I reposition one so both geometries can share the same centroid? Thanks in advance!

Gening