# Synchronizing lists

I have a simple cluster that works well if I pass it one data item but when I pass it a list of items it falls apart. The routine takes a closed curve and a reference point and calculates its moments of inertia by breaking the curve into a bunch of mesh boundaries. Simple numerical integration.

When I attach multiple closed curves the problem is that the indices in the two “forks” of the code do not match. The code at the top creates a list of boundary representations. The code at the bottom returns the centroid of the overall bodies. At the point where the two branches of the code merge (see the red circle in the image), I have a list of four points and a tree with four branches of points, where each branch consists of thousands of points representing the centroids of each of the tiny rectangles in the mesh. But the list of four points does not properly correspond to the branches in the tree, if this makes sense.

MOI windblade test RG 29 Feb 20.gh (42.0 KB) cross section exercise blade machine circle example.3dm (18.0 KB)

The cluster is part of a larger routine, attached. The cluster is called “Calc MOI”. I am fairly new to GH so this may be a naive question.

I’m not entirely sure what you are trying to do. But grafting the Closed Shape curves might be what you need.

Welcome to the forum.
Your question is totally legit, you are already banging your head into data-tree manipulations

… me too.

“moment of inertia” means different things, and also translation into my language doesn’t help.
One thing i’m sure: you could subdivide your curve-section differently.

Your situation:

Thousands of points but still some (also more than some) accuracy is lost near the edges!

You can do this:

See the times also, your subdivision took almost 1 second… the other under 100ms.

Can you explain what you expect the cluster should do?
The formulas about d^2 * A seems good.
But you are also trying to re-construct the centroid from the sum of all the samples… why?

Thanks for your help! I like alternative approach to meshing. This will cut down on the error and the computation time.

What I call “moment of inertia” is from mechanics of solids. See:

https://www.engineeringtoolbox.com/area-moment-inertia-d_1328.html

It’s not about the centroids, that part is easy. But the moment of inertia requires the distance between the centroid of the entire region and the individual centroids of the meshed regions.

But I think ultimately I am doing something wrong with the two lists, as they are not sychronized. I know that Rhino has some inherent method for calculating these properties of sections, but I am leery of black boxes and would like to complete the calculation myself.

Thanks again. I will work on the closed curve component to see if that helps.

Adam and Riccardo, thanks. Problem solved with GRAFT. Working now on meshing updates. RG